/* ═══════════════════════════════════════════════════════════════
   DECA - Tema personalizado
   Paleta: azul corporativo #1e3a8a / grises neutros
   Consistente con el color del PDF (#1e3a8a)
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Primarios */
    --primary: #1e3a8a;
    --primary-light: #2563eb;
    --primary-dark: #1e3a8a;
    --primary-darker: #172e6e;
    --primary-lightest: #dbeafe;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.08);

    /* Fondos */
    --bg-body: #f8fafc;
    --bg-card: #FFFFFF;

    /* Texto */
    --text-dark: #1e293b;
    --text-muted: #64748b;

    /* Semánticos */
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;

    /* Bordes */
    --border-light: #e2e8f0;
    --border-input: #cbd5e1;

    /* Acento (antes dorado, ahora azul claro) */
    --accent: #dbeafe;
}

body {
    background: var(--bg-body);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    color: var(--text-dark);
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-header i {
    font-size: 28px;
    color: var(--primary-light);
}

.sidebar-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: white;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary-light);
}

.sidebar .nav-link.active {
    background: rgba(37, 99, 235, 0.2);
    color: white;
    border-left-color: var(--primary-light);
    font-weight: 600;
}

.sidebar-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 20px 8px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info i {
    font-size: 28px;
    color: var(--primary-light);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: var(--primary);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .btn-link {
    color: white !important;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(30, 58, 138, 0.06);
    transition: box-shadow 0.2s ease;
    background: var(--bg-card);
}

.card:hover {
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.1);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--primary-lightest);
    font-weight: 700;
    color: var(--primary);
    padding: 16px 20px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Botón Editar (mismo azul corporativo) */
.btn-editar {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-editar:hover,
.btn-editar:focus {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

/* ── Table ───────────────────────────────────────────────── */
.table {
    --bs-table-bg: transparent;
}

.table thead th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
    color: var(--text-dark);
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: rgba(30, 58, 138, 0.03);
}

.table tbody tr[style*="cursor"] {
    cursor: pointer;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.form-control,
.form-select {
    border-color: var(--border-input);
    background-color: #ffffff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
    background-color: white;
}

.form-control[readonly] {
    background-color: #f1f5f9;
    color: var(--text-dark);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ── QR / PDF popup ──────────────────────────────────────── */
.pdf-modal .modal-dialog {
    max-width: 95vw;
    height: 95vh;
    margin: 2.5vh auto;
}

.pdf-modal .modal-content {
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
}

.pdf-modal .modal-body {
    padding: 0;
    overflow: auto;
}

.pdf-modal iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Setup / Login ───────────────────────────────────────── */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-darker) 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.auth-card .card-header {
    background: var(--bg-card);
    text-align: center;
    padding: 30px 20px 10px;
    border: none;
    border-bottom: 3px solid var(--primary-lightest);
}

.auth-card .card-header i {
    font-size: 48px;
    color: var(--primary);
}

.auth-card .card-body {
    padding: 20px 30px 30px;
    background: #ffffff;
}

/* ── Company logo in table ───────────────────────────────── */
.company-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    background: white;
    padding: 2px;
    border: 1px solid var(--border-light);
}

/* ── Service photos (detail view) ────────────────────────── */
.service-photo {
    width: 90px;
    height: 90px;
}

/* ── Badges de rol ───────────────────────────────────────── */
.badge-rol-superadmin {
    background: #7c3aed;
    color: white;
}

.badge-rol-admin {
    background: var(--primary);
    color: white;
}

.badge-rol-gestor {
    background: #0891b2;
    color: white;
}

.badge-rol-chofer {
    background: var(--success);
    color: white;
}

/* ── Badges de completitud ──────────────────────────────── */
.badge-completo {
    font-size: 11px;
    padding: 3px 6px;
    vertical-align: middle;
}

.badge-incompleto {
    font-size: 11px;
    padding: 3px 6px;
    vertical-align: middle;
}

/* ── Alert / flash messages ──────────────────────────────── */
.alert-success {
    background-color: #dcfce7;
    border-color: var(--success);
    color: #166534;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border-color: var(--primary-light);
    color: #1e40af;
}

/* ── Settings tabs (submenú lateral) ───────────────────── */
.sidebar-submenu {
    padding-left: 1.75rem;
    margin-top: 2px;
    margin-bottom: 4px;
}

.sidebar-submenu .subnav-link {
    padding: 0.4rem 0.85rem;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.15s ease;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.sidebar-submenu .subnav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-submenu .subnav-link.active {
    background: rgba(37, 99, 235, 0.2);
    color: #fff;
    font-weight: 600;
}

.sidebar-submenu .subnav-link i {
    margin-right: 0.4rem;
    font-size: 0.85rem;
}

.sidebar-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.nav-link[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

/* ── Topbar móvil/tablet ─────────────────────────────────── */
.topbar-mobile {
    display: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .topbar-mobile {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
        z-index: 1050;
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 12px !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h2 {
        font-size: 1.3rem;
    }

    /* Cards de servicio en mobile */
    .service-card-mobile {
        cursor: pointer;
        transition: all 0.2s ease;
        border: 2px solid transparent;
    }

    .service-card-mobile:active {
        transform: scale(0.98);
        border-color: var(--primary);
    }

    /* Botón QR prominente en mobile */
    .btn-qr-mobile {
        width: 56px;
        height: 56px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
        flex-shrink: 0;
    }

    /* Fotos de servicio más grandes en mobile */
    .service-photo {
        width: 120px;
        height: 120px;
    }

    /* Cards de versiones en mobile */
    .version-card-mobile {
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .version-card-mobile:active {
        background: rgba(30, 58, 138, 0.04);
    }

    /* Cards de vehículos en mobile */
    .vehicle-card-mobile {
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .vehicle-card-mobile:active {
        background: rgba(30, 58, 138, 0.04);
    }

    /* Formularios en mobile */
    .form-label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .form-control,
    .form-select {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 10px 12px;
    }

    .card-header {
        padding: 12px 16px;
        font-size: 14px;
    }

    .card-body {
        padding: 16px;
    }

    /* Botones más grandes en mobile */
    .btn {
        padding: 10px 16px;
        font-size: 15px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .content-wrapper {
        padding: 20px !important;
    }

    .table thead th {
        font-size: 12px;
        padding: 10px 12px;
    }

    .table tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ── Utilities ───────────────────────────────────────────── */
.text-primary-deca { color: var(--primary) !important; }
.bg-primary-deca { background: var(--primary) !important; }

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

.page-header h2 {
    margin: 0;
    color: var(--primary);
    font-weight: 700;
}

.page-header h2 i {
    margin-right: 8px;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--border-input);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
