/* ═══════════════════════════════════════════════════════════════
   DECA - Tema personalizado
   Paleta: rojo corporativo #E22E30 / fondo crema #FBDD96
   ═══════════════════════════════════════════════════════════════ */

:root {
    --primary: #E22E30;
    --primary-light: #F04E50;
    --primary-dark: #C41E20;
    --primary-darker: #A81818;
    --sidebar-width: 260px;
    --sidebar-bg: #C41E20;
    --sidebar-hover: rgba(255, 255, 255, 0.12);
    --bg-body: #FBDD96;
    --bg-card: #FFFFFF;
    --text-dark: #2D2D2D;
    --accent-gold: #FBDD96;
}

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: linear-gradient(180deg, var(--primary) 0%, var(--primary-darker) 100%);
    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.18);
    background: rgba(0, 0, 0, 0.08);
}

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

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

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.85);
    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: rgba(251, 221, 150, 0.5);
}

.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: white;
    border-left-color: var(--accent-gold);
    font-weight: 600;
}

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

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

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

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

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

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

/* ── 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(226, 46, 48, 0.08);
    transition: box-shadow 0.2s ease;
    background: var(--bg-card);
}

.card:hover {
    box-shadow: 0 4px 20px rgba(226, 46, 48, 0.14);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--accent-gold);
    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-dark);
    border-color: var(--primary-dark);
    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;
}

/* ── 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(226, 46, 48, 0.05);
}

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

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

.form-control,
.form-select {
    border-color: #d4c5a0;
    background-color: #FFFDF5;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(226, 46, 48, 0.12);
    background-color: white;
}

.form-control[readonly] {
    background-color: #f0ead6;
    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;
}

/* ── Signature canvas ────────────────────────────────────── */
.signature-pad {
    border: 2px dashed var(--primary-light);
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
}

.signature-pad-block {
    border: 2px dashed var(--primary-light);
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
    display: block;
}

/* ── Setup / Login ───────────────────────────────────────── */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 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(--accent-gold);
}

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

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

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

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

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

.badge-rol-chofer {
    background: #1B7A3D;
    color: white;
}

.badge-rol-mozo {
    background: #0D6EFD;
    color: white;
}

.badge-rol-supervisor {
    background: #6F42C1;
    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: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--primary);
    color: #721c24;
}

/* ── 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.75);
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.15s ease;
    border-left: 2px solid rgba(255, 255, 255, 0.2);
}

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

.sidebar-submenu .subnav-link.active {
    background: rgba(255, 255, 255, 0.18);
    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(25, 135, 84, 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(226, 46, 48, 0.05);
    }

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

    .vehicle-card-mobile:active {
        background: rgba(226, 46, 48, 0.05);
    }

    /* 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;
    }

    /* Signatures más grandes en mobile */
    .signature-pad {
        height: 180px !important;
    }

    /* 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: #f0e6cc;
}

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

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