/* ============================================================
   Trinitec — Sistema de Reparaciones
   ============================================================ */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --accent: #0d6efd;
    --topbar-height: 56px;
}

/* ── Layout ─────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: #cdd3da;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform .3s ease;
}

#sidebar .sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
    display: block;
}
#sidebar .sidebar-brand .brand-name {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .5px;
}
#sidebar .sidebar-brand .brand-sub {
    color: #8b949e;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#sidebar .nav-section {
    padding: .35rem 1rem .1rem;
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6c757d;
    font-weight: 600;
}

#sidebar .nav-link {
    color: #adb5bd;
    padding: .5rem 1rem;
    font-size: .87rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    transition: background .15s, color .15s;
    text-decoration: none;
}
#sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
#sidebar .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left: 3px solid var(--accent);
}
#sidebar .nav-link .bi {
    font-size: 1rem;
    width: 1.2rem;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: .75rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .8rem;
    color: #6c757d;
}

/* ── Main content ────────────────────────────────────────── */
#main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e3e6ea;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: .75rem;
}
.topbar .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #343a40;
    flex: 1;
}
.topbar .user-badge {
    font-size: .8rem;
    color: #6c757d;
}

.content-area {
    padding: 1.5rem;
    flex: 1;
}

/* ── Cards ───────────────────────────────────────────────── */
.stat-card {
    border: none;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    transition: box-shadow .2s;
}
.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-card {
    border: none;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    overflow: hidden;
}
.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    padding: .85rem 1.25rem;
}
.table th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
    font-weight: 600;
    background: #f8f9fa;
}
.table td {
    vertical-align: middle;
    font-size: .88rem;
}

/* ── Badges de color "purple" ────────────────────────────── */
.bg-purple { background-color: #6f42c1 !important; }
.text-purple { color: #6f42c1 !important; }
.border-purple { border-color: #6f42c1 !important; }

/* ── Prioridades ─────────────────────────────────────────── */
tr.prioridad-urgente td:first-child {
    border-left: 3px solid #dc3545;
}
tr.prioridad-alta td:first-child {
    border-left: 3px solid #ffc107;
}

/* ── Login page ──────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

/* ── Historial de estados ────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: .5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}
.timeline-item {
    position: relative;
    margin-bottom: 1rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -.95rem;
    top: .4rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--accent);
}
.timeline-item .time {
    font-size: .75rem;
    color: #6c757d;
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    #sidebar, .topbar, .no-print { display: none !important; }
    #main { margin-left: 0 !important; }
    body { background: #fff; }
    .content-area { padding: 0; }
    .print-container { max-width: 100%; }
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #main {
        margin-left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1039;
    }
    .sidebar-overlay.show { display: block; }
}
