/* ============================================================
   MOTOIQ — Estilos Globales
   Tema Industrial / Mecánica a Domicilio
   ============================================================ */

:root {
    --red:      #E63946;
    --red-dark: #c62d3a;
    --dark:     #0D0D0D;
    --panel:    #141414;
    --card:     #1C1C1C;
    --card2:    #222222;
    --border:   #2A2A2A;
    --text:     #F0EDE8;
    --muted:    #888880;
    --muted2:   #555550;
    --gold:     #F4A261;
    --green:    #22C55E;
    --yellow:   #EAB308;
    --blue:     #3B82F6;
    --sidebar-w: 260px;
    --topbar-h:  64px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--dark);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---- ADMIN LAYOUT ---- */
.admin-body {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform .3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
    width: 40px; height: 40px;
    background: var(--red);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px; color: white;
    flex-shrink: 0;
}

.sidebar-logo-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px; letter-spacing: 2px;
}

.sidebar-logo-role {
    font-size: 10px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 2px;
}

/* NAV */
.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted2);
    padding: 16px 8px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--muted);
    transition: all .15s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--card);
    color: var(--text);
}

.nav-item.active {
    background: rgba(230,57,70,.15);
    color: var(--red);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
    padding: 16px 16px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 36px; height: 36px;
    background: var(--red);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px; color: white;
    flex-shrink: 0;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
    transition: all .15s;
}

.btn-logout:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(230,57,70,.08);
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* TOPBAR */
.topbar {
    height: var(--topbar-h);
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 2px;
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notif-btn {
    position: relative;
    width: 38px; height: 38px;
    background: var(--card);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: background .15s;
}

.notif-btn:hover { background: var(--card2); }

.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    padding: 0 3px;
    background: var(--red);
    border-radius: 50px;
    font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    animation: notif-pulse 2s infinite;
}

@keyframes notif-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230,57,70,.6); }
    50%       { box-shadow: 0 0 0 5px rgba(230,57,70,0); }
}

.topbar-avatar {
    width: 38px; height: 38px;
    background: var(--red);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px; color: white;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
}

/* PAGE CONTENT */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ---- CARDS ---- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 1px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color .2s;
}

.stat-card:hover { border-color: var(--red); }

.stat-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-card-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 42px;
    line-height: 1;
    color: var(--text);
}

.stat-card-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.stat-card-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    opacity: 0.08;
}

/* ---- GRID LAYOUTS ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(255,255,255,.02); }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    white-space: nowrap;
}

.badge-success  { background: rgba(34,197,94,.15);  color: #4ade80; }
.badge-warning  { background: rgba(234,179,8,.15);  color: #fbbf24; }
.badge-danger   { background: rgba(230,57,70,.15);  color: #f87171; }
.badge-info     { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-primary  { background: rgba(230,57,70,.2);   color: var(--red); }
.badge-secondary{ background: rgba(255,255,255,.08);color: var(--muted); }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-red    { background: var(--red);   color: white; }
.btn-red:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(230,57,70,.35); }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--muted); background: var(--card); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--card); color: var(--text); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 14px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(230,57,70,.1);
}

.form-control::placeholder { color: #3a3a3a; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* FORM GRID */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-danger  { background: rgba(230,57,70,.1); border: 1px solid rgba(230,57,70,.25); color: #f87171; }
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25); color: #4ade80; }
.alert-warning { background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.25); color: #fbbf24; }
.alert-info    { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25); color: #60a5fa; }

/* ---- MODALS ---- */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { opacity:0; transform:translateY(16px) scale(.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 1px;
}

.modal-close {
    width: 32px; height: 32px;
    background: var(--card2);
    border: none;
    border-radius: 50%;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: .4; }
.empty-state-title { font-family: 'Bebas Neue', sans-serif; font-size: 24px; color: var(--text); margin-bottom: 8px; }
.empty-state-desc { font-size: 14px; }

/* ---- MOTO CARD ---- */
.moto-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: border-color .2s, transform .2s;
    position: relative;
    overflow: hidden;
}

.moto-card:hover {
    border-color: var(--red);
    transform: translateY(-2px);
}

.moto-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--red);
    transform: scaleX(0);
    transition: transform .2s;
}

.moto-card:hover::before { transform: scaleX(1); }

.moto-brand { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 1px; }
.moto-model { font-size: 14px; color: var(--muted); }
.moto-plate {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: var(--card2);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--gold);
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    letter-spacing: 2px;
}

.page-header-sub { font-size: 14px; color: var(--muted); }

/* ---- SEARCH BAR ---- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
    min-width: 260px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    flex: 1;
}

.search-bar input::placeholder { color: var(--muted2); }

/* ---- PROGRESS BAR ---- */
.progress {
    height: 6px;
    background: var(--card2);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--red);
    transition: width .4s ease;
}

.progress-bar.green  { background: var(--green); }
.progress-bar.yellow { background: var(--yellow); }

/* ---- TIMELINE ---- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 0; bottom: 0;
    width: 1px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-dot {
    position: absolute;
    left: -24px; top: 4px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--dark);
}

.timeline-date { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.timeline-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.timeline-desc  { font-size: 13px; color: var(--muted); }

/* ---- MAINTENANCE STATUS ---- */
.maint-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.maint-item:last-child { border-bottom: none; }
.maint-name { font-size: 14px; font-weight: 500; }
.maint-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.5); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .page-content { padding: 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ---- TOAST ---- */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 9999;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    display: flex; align-items: center; gap: 10px;
    animation: toastIn .3s ease;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
    min-width: 280px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-danger  { border-left: 3px solid var(--red); }
.toast-warning { border-left: 3px solid var(--yellow); }

@keyframes toastIn {
    from { opacity:0; transform: translateX(20px); }
    to   { opacity:1; transform: translateX(0); }
}

/* ---- CLIENT LAYOUT ---- */
.client-body {
    display: flex;
    min-height: 100vh;
}

.client-sidebar {
    width: 240px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.client-main {
    margin-left: 240px;
    flex: 1;
}
