@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Paleta Oficial MAZ Express */
    --blue-primary: #0963D5;
    --blue-dark: #092A6D;
    --red-primary: #ED3237;
    --red-dark: #8F0000;
    --gray-light: #CACFD5;
    --pure-white: #FFFFFF;
    
    /* Colores por Estado de Envío */
    --step-1-color: #8e44ad;
    --step-2-color: #0984e3;
    --step-3-color: #e67e22;
    --step-4-color: #d32f2f;
    --step-5-color: #2ecc71;
    
    /* Neutros Modernos */
    --bg-light: #f4f6f9;
    --card-bg: #FFFFFF;
    --text-dark: #092A6D;
    --text-muted: #556270;
    --gray-border: #CACFD5;
    
    /* Panel Lateral Admin */
    --sidebar-bg: #092A6D;
    --sidebar-hover: #0963D5;
    
    /* Bordes y Sombras UI */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 2px 8px rgba(9, 42, 109, 0.06);
    --shadow-md: 0 12px 24px -4px rgba(9, 42, 109, 0.12);
    --shadow-lg: 0 20px 40px -12px rgba(9, 42, 109, 0.2);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
}

body { 
    background-color: var(--bg-light); 
    color: var(--text-dark); 
    line-height: 1.5; 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   NAVBAR - RESPONSIVE
   ========================================== */
nav { 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 3px solid var(--blue-primary); 
    padding: 12px 4%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 10px;
}

.logo img {
    height: 60px;
    object-fit: contain;
}

.nav-links { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    flex-wrap: wrap;
}

.nav-links a, 
.nav-links button { 
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none; 
    color: var(--text-dark); 
    font-weight: 600; 
    font-size: 0.85rem; 
    transition: color 0.2s ease;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links button:hover {
    color: var(--red-primary);
    background: rgba(237, 50, 55, 0.05);
}

/* ==========================================
   MÓDULOS DE NAVEGACIÓN
   ========================================== */
.page-module { 
    display: none; 
}

.page-module.active { 
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

/* ==========================================
   HERO - RESPONSIVE
   ========================================== */
.hero { 
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-primary) 100%); 
    color: white; 
    padding: 50px 5% 80px; 
    text-align: center; 
    position: relative;
}

.hero h1 { 
    font-size: 2.2rem; 
    margin-bottom: 12px; 
    font-weight: 800; 
    letter-spacing: -0.8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero p { 
    font-size: 1rem; 
    max-width: 620px; 
    margin: 0 auto 20px; 
    opacity: 0.95; 
    font-weight: 400;
}

/* ==========================================
   BOTONES
   ========================================== */
.btn-primary { 
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 100%); 
    color: var(--pure-white); 
    font-weight: 700; 
    border: none; 
    padding: 14px 32px; 
    border-radius: var(--radius-sm); 
    cursor: pointer; 
    font-size: 0.95rem; 
    transition: transform 0.2s ease, box-shadow 0.2s ease; 
    text-decoration: none; 
    display: inline-block; 
    box-shadow: 0 4px 12px rgba(237, 50, 55, 0.3);
}

.btn-primary:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(237, 50, 55, 0.45);
}

.btn-primary:active {
    transform: scale(0.96);
}

/* ==========================================
   HERO DE TRACKING
   ========================================== */

.tracking-hero {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-primary) 100%);
    color: white;
    padding: 50px 5% 100px;
    text-align: center;
    position: relative;
}

.tracking-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tracking-hero p {
    font-size: 1rem;
    max-width: 620px;
    margin: 0 auto;
    opacity: 0.9;
}

/* ==========================================
   TARJETA DE RASTREO - DISEÑO ORIGINAL (ROJO)
   ========================================== */

.track-card-container { 
    width: 100%;
    max-width: 820px; 
    padding: 0 16px; 
    position: relative;
    z-index: 10;
}

/* En la página de inicio, flota sobre el hero */
#module-home .track-card-container {
    margin: -30px auto 40px;
}

/* En la página de tracking, flota sobre el hero de tracking */
#module-tracking .track-card-container {
    margin: -40px auto 40px;
}

.track-card { 
    background: var(--pure-white); 
    border-radius: var(--radius-lg); 
    padding: 44px 48px; 
    box-shadow: var(--shadow-lg); 
    border: 1px solid var(--gray-border); 
    border-top: 5px solid var(--red-primary);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.track-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.track-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
}

.search-box { 
    display: flex; 
    gap: 12px; 
    margin-top: 25px; 
    align-items: center;
}

.search-box input { 
    flex: 1; 
    padding: 14px 20px; 
    border: 1px solid var(--gray-border); 
    border-radius: var(--radius-sm); 
    font-size: 0.95rem; 
    color: var(--text-dark);
    outline: none; 
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus { 
    border-color: var(--blue-primary); 
    box-shadow: 0 0 0 3px rgba(9, 99, 213, 0.15);
}

.search-box input::placeholder {
    color: #94a3b8;
}

.btn-track {
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 100%);
    color: var(--pure-white);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(237, 50, 55, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.btn-track:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(237, 50, 55, 0.45);
}

/* ==========================================
   RESPONSIVE - TARJETA DE RASTREO
   ========================================== */

@media (max-width: 850px) {
    .tracking-hero {
        padding: 40px 5% 80px;
    }
    
    .tracking-hero h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 580px) {
    .track-card {
        padding: 30px 24px;
    }
    
    .track-card h3 {
        font-size: 1.2rem;
    }
    
    .search-box { 
        flex-direction: column; 
    }
    .search-box input {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    .btn-track { 
        width: 100%; 
        justify-content: center;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .tracking-hero {
        padding: 30px 4% 70px;
    }
    
    .tracking-hero h1 {
        font-size: 1.4rem;
    }
    
    .tracking-hero p {
        font-size: 0.9rem;
    }
    
    #module-tracking .track-card-container {
        margin: -30px auto 30px;
    }
}

/* ==========================================
   BANNER DE ESTADÍSTICAS - CON IMAGEN Y GLASSMORPHISM
   ========================================== */

.stats-banner {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto 50px;
    padding: 70px;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: url('https://images.unsplash.com/photo-1586528116311-ad8dd3c8310d?auto=format&fit=crop&w=1350&q=80') center/cover no-repeat;
    min-height: 220px;
}

.stats-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(9, 42, 109, 0.55);
    z-index: 1;
}

.stats-glass-card {
    position: relative;
    z-index: 2;
    background: rgba(9, 42, 109, 0.25);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    min-height: 180px;
}

.stat-item {
    text-align: center;
    color: var(--pure-white);
    padding: 12px 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 15%;
    height: 70%;
    width: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.stat-item h2 {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--pure-white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
}

.stat-item p {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
    margin: 0;
}

/* Responsive para estadísticas */
@media (max-width: 850px) {
    .stats-banner {
        min-height: 180px;
        padding: 16px;
    }
    
    .stats-glass-card { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 20px 16px;
        padding: 30px 20px;
        min-height: 150px;
    }
    .stat-item:nth-child(2)::after { display: none; }
    .stat-item h2 { font-size: 2rem; }
}

@media (max-width: 580px) {
    .stats-banner {
        min-height: 150px;
        padding: 12px;
    }
    
    .stats-glass-card {
        grid-template-columns: 1fr 1fr;
        gap: 14px 10px;
        padding: 20px 14px;
        min-height: 120px;
    }
    .stat-item {
        padding: 6px 8px;
    }
    .stat-item::after { display: none !important; }
    .stat-item h2 { font-size: 1.6rem; }
    .stat-item p { font-size: 0.75rem; }
}

@media (max-width: 400px) {
    .stats-banner {
        min-height: 120px;
        padding: 10px;
    }
    
    .stats-glass-card {
        grid-template-columns: 1fr 1fr;
        gap: 10px 6px;
        padding: 14px 10px;
        min-height: 100px;
    }
    .stat-item h2 { font-size: 1.2rem; }
    .stat-item p { font-size: 0.65rem; }
}

/* ==========================================
   TIMELINE - CON ANIMACIONES HOVER
   ========================================== */

.timeline { 
    list-style: none; 
    padding: 25px 10px 10px 10px; 
    position: relative; 
}

.timeline::before { 
    content: ''; 
    position: absolute; 
    left: 33px; 
    top: 48px;  
    bottom: 33px; 
    width: 3px; 
    background: var(--gray-border); 
    border-radius: 4px;
    z-index: 1;
}

.timeline-step { 
    position: relative; 
    margin-bottom: 24px; 
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 2;
    cursor: default;
    transition: transform 0.3s ease;
}

.timeline-step .step-icon { 
    width: 46px; 
    height: 46px; 
    border-radius: 50%; 
    background: var(--pure-white); 
    border: 2px solid var(--gray-border);
    color: var(--text-muted); 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem; 
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                background-color 0.3s ease, 
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

.timeline-step .step-icon i,
.timeline-step .step-icon svg {
    transition: transform 0.3s ease;
}

.timeline-step .step-content {
    flex: 1;
    background: var(--pure-white);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, 
                box-shadow 0.25s ease, 
                border-color 0.25s ease,
                background-color 0.25s ease;
}

.timeline-step h4 { 
    font-size: 0.95rem; 
    color: var(--text-dark); 
    font-weight: 700;
    transition: color 0.3s ease;
}

.timeline-step p { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    margin-top: 2px;
    transition: color 0.3s ease;
}

/* ==========================================
   ANIMACIONES HOVER DEL TIMELINE
   ========================================== */

/* Efecto al pasar el mouse sobre todo el paso */
.timeline-step:hover {
    transform: translateX(4px);
}

.timeline-step:hover .step-icon {
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.timeline-step:hover .step-icon i,
.timeline-step:hover .step-icon svg {
    transform: rotate(-8deg) scale(1.1);
}

.timeline-step:hover .step-content {
    transform: translateX(6px);
    box-shadow: var(--shadow-md);
    border-color: var(--blue-primary);
    background: #f8fafc;
}

.timeline-step:hover h4 {
    color: var(--blue-primary);
}

.timeline-step:hover p {
    color: var(--text-dark);
}

/* ==========================================
   COLORES DINÁMICOS DEL TIMELINE
   ========================================== */

.timeline-step:nth-child(1).completed .step-icon,
.timeline-step:nth-child(1).active .step-icon { 
    background: var(--step-1-color); 
    border-color: var(--step-1-color); 
    color: white; 
}

.timeline-step:nth-child(2).completed .step-icon,
.timeline-step:nth-child(2).active .step-icon { 
    background: var(--step-2-color); 
    border-color: var(--step-2-color); 
    color: white; 
}

.timeline-step:nth-child(3).completed .step-icon,
.timeline-step:nth-child(3).active .step-icon { 
    background: var(--step-3-color); 
    border-color: var(--step-3-color); 
    color: white; 
}

.timeline-step:nth-child(4).completed .step-icon,
.timeline-step:nth-child(4).active .step-icon { 
    background: var(--step-4-color); 
    border-color: var(--step-4-color); 
    color: white; 
}

.timeline-step:nth-child(5).completed .step-icon,
.timeline-step:nth-child(5).active .step-icon { 
    background: var(--step-5-color); 
    border-color: var(--step-5-color); 
    color: white; 
}

/* Efecto de brillo en el icono activo */
.timeline-step.active .step-icon {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(237, 50, 55, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(237, 50, 55, 0);
    }
}

.timeline-step.active .step-content {
    border-left: 4px solid var(--red-primary);
    box-shadow: var(--shadow-md);
}

.timeline-step.active:hover .step-content {
    border-left-color: var(--blue-primary);
}

/* ==========================================
   RESPONSIVE - TIMELINE
   ========================================== */

@media (max-width: 580px) {
    .timeline { 
        padding: 20px 6px 6px 6px; 
    }
    
    .timeline::before { 
        left: 24px; 
        top: 40px;  
        bottom: 24px; 
    }
    
    .timeline-step { 
        margin-bottom: 18px; 
        gap: 14px;
    }
    
    .timeline-step .step-icon { 
        width: 38px; 
        height: 38px; 
        font-size: 0.9rem; 
    }
    
    .timeline-step .step-content {
        padding: 10px 14px;
    }
    
    .timeline-step h4 { 
        font-size: 0.85rem; 
    }
    
    .timeline-step p { 
        font-size: 0.75rem; 
    }
    
    .timeline-step:hover {
        transform: translateX(2px);
    }
    
    .timeline-step:hover .step-content {
        transform: translateX(3px);
    }
}

/* ==========================================
   ADMIN - LAYOUT PRINCIPAL RESPONSIVE
   ========================================== */
.admin-container { 
    max-width: 1200px; 
    margin: 12px auto; 
    padding: 0 10px; 
    width: 100%;
}

#admin-login-view { 
    display: block; 
    width: 100%;
}
#admin-dashboard-view { 
    display: none; 
    width: 100%;
}

.admin-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: var(--pure-white);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-border);
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.btn-logout {
    background: var(--red-primary);
    color: var(--pure-white);
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-logout:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
}

/* ==========================================
   ADMIN - SIDEBAR RESPONSIVE
   ========================================== */
.admin-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    width: 100%;
}

.admin-sidebar {
    width: 220px;
    min-width: 180px;
    background: var(--sidebar-bg);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.dropdown-btn {
    width: 100%;
    background: transparent;
    color: var(--pure-white);
    border: none;
    padding: 10px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.dropdown-btn:hover {
    background: var(--sidebar-hover);
}

.submenu {
    display: none;
    flex-direction: column;
    padding-left: 8px;
    margin-top: 4px;
    gap: 2px;
}

.submenu.open { display: flex; }

.submenu a {
    color: var(--gray-light);
    text-decoration: none;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.submenu a:hover {
    background: var(--sidebar-hover);
    color: var(--pure-white);
    transform: translateX(3px);
}

.admin-content { 
    flex: 1; 
    min-width: 0;
    width: 100%;
}

/* ==========================================
   ADMIN - FORMULARIOS Y TARJETAS
   ========================================== */
.form-panel { display: none; }
.form-panel.active-panel { display: block !important; }

.admin-card { 
    background: var(--pure-white); 
    padding: 20px; 
    border-radius: var(--radius-md); 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--gray-border);
    border-top: 4px solid var(--blue-primary);
    overflow-x: auto;
    width: 100%;
}

.admin-card h3 {
    margin-bottom: 14px;
    font-size: 1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.form-group { 
    margin-bottom: 12px; 
    width: 100%;
}

.form-group label { 
    display: block; 
    font-size: 0.8rem; 
    font-weight: 600; 
    margin-bottom: 4px; 
}

.form-group input, 
.form-group select { 
    width: 100%; 
    padding: 10px 12px; 
    border: 1px solid var(--gray-border); 
    border-radius: var(--radius-sm); 
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(9, 99, 213, 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.form-row .form-group {
    flex: 1;
    min-width: 130px;
}

/* ==========================================
   TABLAS - RESPONSIVE
   ========================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
    width: 100%;
}

.table-responsive table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
    min-width: 500px;
}

.table-responsive table th,
.table-responsive table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    word-break: break-word;
}

.table-responsive table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==========================================
   AUDITORÍA - RESPONSIVE
   ========================================== */
.audit-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-border);
    background: var(--pure-white);
    margin-top: 10px;
    width: 100%;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 600px;
}

.audit-table thead th {
    background: #f1f5f9;
    color: var(--text-dark);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--gray-border);
    text-align: left;
}

.audit-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.audit-table tbody tr:hover {
    background: #f8fafc;
}

.audit-table tbody tr:last-child td {
    border-bottom: none;
}

.audit-action-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e9ecef;
    color: #475569;
}

.audit-action-badge.crear { background: #dbeafe; color: #1d4ed8; }
.audit-action-badge.modificar { background: #fef3c7; color: #b45309; }
.audit-action-badge.eliminar { background: #fdecea; color: #b91c1c; }
.audit-action-badge.login { background: #d1fae5; color: #065f46; }

.audit-table .checkbox-cell {
    width: 36px;
    text-align: center;
}

.audit-table .checkbox-cell input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue-primary);
    cursor: pointer;
}

.btn-delete-row {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-delete-row:hover {
    background: #fdecea;
    color: var(--red-primary);
    transform: scale(1.1);
}

/* ==========================================
   AUDITORÍA - FILTROS Y TOOLBAR
   ========================================== */
.audit-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 4px;
    width: 100%;
}

.audit-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--pure-white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    flex: 1;
    min-width: 160px;
    max-width: 280px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.audit-search-box:focus-within {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(9, 99, 213, 0.1);
}

.audit-search-box i {
    color: #94a3b8;
    font-size: 0.85rem;
}

.audit-search-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-dark);
    background: transparent;
}

.audit-date-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.audit-date-filters label {
    display: flex;
    flex-direction: column;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    gap: 2px;
}

.audit-date-filters input[type="date"] {
    padding: 5px 8px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    outline: none;
    background: var(--pure-white);
    transition: border-color 0.2s ease;
    max-width: 120px;
}

.audit-date-filters input[type="date"]:focus {
    border-color: var(--blue-primary);
}

.btn-audit-filter,
.btn-audit-clear {
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    height: 32px;
}

.btn-audit-filter {
    background: var(--blue-primary);
    color: var(--pure-white);
}

.btn-audit-filter:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
}

.btn-audit-clear {
    background: #e9ecef;
    color: var(--text-dark);
}

.btn-audit-clear:hover {
    background: #d5d9e0;
    transform: translateY(-1px);
}

/* ==========================================
   AUDITORÍA - ACCIONES MASIVAS
   ========================================== */
.audit-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-border);
    width: 100%;
}

.audit-select-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
}

.audit-select-all-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue-primary);
    cursor: pointer;
}

.btn-audit-danger {
    background: var(--red-primary);
    color: var(--pure-white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-audit-danger:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
}

.btn-audit-danger-outline {
    background: transparent;
    color: var(--red-primary);
    border: 1.5px solid var(--red-primary);
    border-radius: var(--radius-sm);
    padding: 5px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-audit-danger-outline:hover {
    background: #fdecea;
    transform: translateY(-1px);
}

/* ==========================================
   AUDITORÍA - PAGINACIÓN
   ========================================== */
.audit-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 14px;
    width: 100%;
}

.audit-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--gray-border);
    background: var(--pure-white);
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audit-page-btn:hover:not(:disabled):not(.active) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.audit-page-btn.active {
    background: var(--blue-primary);
    color: var(--pure-white);
    border-color: var(--blue-primary);
}

.audit-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.audit-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.audit-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
    opacity: 0.5;
}

.audit-empty-state p {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==========================================
   ETIQUETA DE IMPRESIÓN - 1 SOLA PÁGINA
   ========================================== */
#printable-ticket {
    display: none;
    background: var(--pure-white);
    width: 320px;
    max-width: 95%;
    padding: 14px 16px 10px;
    border: 2px solid #000;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    color: #000;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.3;
    box-sizing: border-box;
}

#printable-ticket .ticket-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

#printable-ticket .ticket-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 1px;
}

#printable-ticket .ticket-header p {
    font-size: 0.65rem;
    margin: 0;
    color: #555;
}

#printable-ticket .ticket-tracking {
    text-align: center;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
}

#printable-ticket .ticket-tracking span {
    display: block;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 1px;
}

#printable-ticket .ticket-tracking strong {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #0963D5;
}

#printable-ticket .ticket-details {
    font-size: 0.75rem;
    line-height: 1.4;
}

#printable-ticket .ticket-details p {
    margin: 2px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dotted #eee;
    padding-bottom: 1px;
}

#printable-ticket .ticket-details p:last-child {
    border-bottom: none;
}

#printable-ticket .ticket-details strong {
    font-weight: 600;
}

#printable-ticket .ticket-qr-section {
    text-align: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #ccc;
}

#printable-ticket .ticket-qr-section #qrcode {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

#printable-ticket .ticket-qr-section #qrcode img,
#printable-ticket .ticket-qr-section #qrcode canvas {
    max-width: 80px !important;
    max-height: 80px !important;
}

#printable-ticket .ticket-qr-section small {
    font-size: 0.55rem;
    color: #555;
    display: block;
    margin-top: 1px;
}

#printable-ticket .ticket-footer {
    text-align: center;
    margin-top: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #333;
}

/* ==========================================
   PAGINA NO ENCONTRADA
   ========================================== */

.notfound-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e9edf3 100%);
    min-height: 60vh;
}

.notfound-card {
    text-align: center;
    background: var(--pure-white);
    max-width: 480px;
    width: 100%;
    padding: 50px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-border);
    border-top: 5px solid var(--red-primary);
    animation: notfound-fade-in 0.5s ease;
}

.notfound-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(9, 99, 213, 0.3);
}

.notfound-icon i {
    font-size: 2.4rem;
    color: var(--pure-white);
}

.notfound-card h1 {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--blue-primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -2px;
}

.notfound-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.notfound-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.5;
}

.notfound-card .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@keyframes notfound-fade-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 580px) {
    .notfound-card {
        padding: 36px 24px;
    }
    .notfound-card h1 {
        font-size: 3rem;
    }
    .notfound-card h2 {
        font-size: 1rem;
    }
    .notfound-icon {
        width: 70px;
        height: 70px;
    }
    .notfound-icon i {
        font-size: 2rem;
    }
}

/* ==========================================
   FOOTER
   ========================================== */
footer { 
    background: var(--blue-dark); 
    color: var(--gray-light); 
    text-align: center; 
    padding: 20px 5%; 
    margin-top: auto; 
    border-top: 4px solid var(--red-primary); 
    font-size: 0.8rem;
}

/* ==========================================
   RESPONSIVE - TABLETS (<= 1024px)
   ========================================== */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 180px;
        min-width: 150px;
    }
}

/* ==========================================
   RESPONSIVE - TABLETS PEQUEÑAS (<= 850px)
   ========================================== */
@media (max-width: 850px) {
    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 40px 5% 70px; }
    
    .track-card { padding: 24px 18px; }
    .track-card h3 { font-size: 1.1rem; }
    
    .stats-glass-card { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 16px 12px;
        padding: 24px 16px;
    }
    .stat-item:nth-child(2)::after { display: none; }
    .stat-item h2 { font-size: 1.6rem; }
    
    .admin-layout { 
        flex-direction: column; 
    }
    .admin-sidebar { 
        width: 100%; 
        min-width: unset;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 10px;
    }
    .admin-sidebar .menu-item-single,
    .admin-sidebar .menu-item-dropdown {
        flex: 1;
        min-width: 100px;
    }
    .dropdown-btn {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    .submenu a {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
    
    .admin-card { padding: 16px; }
    .admin-card h3 { font-size: 0.95rem; }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-row .form-group {
        min-width: unset;
    }
    
    .audit-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .audit-search-box {
        max-width: 100%;
    }
    .audit-date-filters {
        justify-content: stretch;
        flex-wrap: wrap;
    }
    .audit-date-filters label {
        flex: 1;
        min-width: 80px;
    }
    .audit-date-filters input[type="date"] {
        max-width: 100%;
    }
    .audit-bulk-actions {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .audit-bulk-actions .btn-audit-danger,
    .audit-bulk-actions .btn-audit-danger-outline {
        justify-content: center;
    }
}

/* ==========================================
   RESPONSIVE - MÓVILES GRANDES (<= 580px)
   ========================================== */
@media (max-width: 580px) {
    nav {
        padding: 10px 3%;
        flex-direction: column;
        align-items: center;
    }
    .logo img {
        height: 50px;
    }
    .nav-links {
        gap: 6px;
        justify-content: center;
        width: 100%;
    }
    .nav-links a,
    .nav-links button {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }
    .hero { padding: 30px 4% 60px; }
    
    .btn-primary {
        padding: 10px 20px;
        font-size: 0.85rem;
        width: 100%;
    }
    
    .search-box { 
        flex-direction: column; 
    }
    .search-box input {
        min-width: unset;
        width: 100%;
    }
    .btn-track { 
        width: 100%; 
        justify-content: center;
    }
    
    .track-card-container {
        margin: -20px auto 30px;
        padding: 0 10px;
    }
    .track-card {
        padding: 18px 14px;
    }
    
    .stats-glass-card {
        grid-template-columns: 1fr 1fr;
        gap: 12px 8px;
        padding: 16px 12px;
    }
    .stat-item {
        padding: 4px 6px;
    }
    .stat-item::after { display: none !important; }
    .stat-item h2 { font-size: 1.3rem; }
    .stat-item p { font-size: 0.7rem; }
    
    .admin-container {
        padding: 0 6px;
        margin: 10px auto;
    }
    .admin-topbar {
        padding: 8px 12px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .btn-logout {
        justify-content: center;
    }
    
    .admin-sidebar {
        flex-direction: column;
        gap: 2px;
        padding: 8px;
    }
    .admin-sidebar .menu-item-single,
    .admin-sidebar .menu-item-dropdown {
        flex: none;
        min-width: unset;
        width: 100%;
    }
    
    .admin-card {
        padding: 12px;
        border-radius: var(--radius-sm);
    }
    .admin-card h3 {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }
    
    .form-group input,
    .form-group select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    .form-group label {
        font-size: 0.75rem;
    }
    
    .table-responsive table {
        font-size: 0.75rem;
        min-width: 400px;
    }
    .table-responsive table th,
    .table-responsive table td {
        padding: 6px 8px;
    }
    
    .audit-table {
        font-size: 0.75rem;
        min-width: 480px;
    }
    .audit-table thead th,
    .audit-table tbody td {
        padding: 6px 8px;
    }
    .audit-action-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }
    .audit-search-box {
        min-width: unset;
        padding: 4px 10px;
    }
    .audit-search-box input {
        font-size: 0.8rem;
    }
    .audit-date-filters label {
        font-size: 0.6rem;
        min-width: 60px;
    }
    .audit-date-filters input[type="date"] {
        font-size: 0.7rem;
        padding: 4px 6px;
        max-width: 100px;
    }
    .btn-audit-filter,
    .btn-audit-clear {
        font-size: 0.7rem;
        padding: 4px 10px;
        height: 28px;
    }
    .audit-bulk-actions {
        padding: 8px 10px;
        gap: 6px;
    }
    .audit-select-all-label {
        font-size: 0.75rem;
    }
    .btn-audit-danger,
    .btn-audit-danger-outline {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
    .audit-page-btn {
        min-width: 28px;
        height: 28px;
        font-size: 0.7rem;
        padding: 0 6px;
    }
    
    .timeline-step .step-icon {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    .timeline-step .step-content {
        padding: 6px 10px;
    }
    .timeline-step h4 {
        font-size: 0.75rem;
    }
    .timeline-step p {
        font-size: 0.65rem;
    }
    .timeline::before {
        left: 22px;
    }
    
    footer {
        padding: 14px 5%;
        font-size: 0.7rem;
    }
}

/* ==========================================
   RESPONSIVE - MÓVILES MUY PEQUEÑOS (<= 400px)
   ========================================== */
@media (max-width: 400px) {
    .hero h1 { font-size: 1.2rem; }
    .hero p { font-size: 0.8rem; }
    
    .stats-glass-card {
        grid-template-columns: 1fr 1fr;
        gap: 8px 4px;
        padding: 12px 8px;
    }
    .stat-item h2 { font-size: 1rem; }
    .stat-item p { font-size: 0.6rem; }
    
    .admin-card { padding: 10px; }
    .admin-card h3 { font-size: 0.8rem; }
    
    .form-group input,
    .form-group select {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .table-responsive table {
        font-size: 0.65rem;
        min-width: 320px;
    }
    .table-responsive table th,
    .table-responsive table td {
        padding: 4px 6px;
    }
    
    .audit-table {
        font-size: 0.65rem;
        min-width: 380px;
    }
    .audit-table thead th,
    .audit-table tbody td {
        padding: 4px 6px;
    }
    .audit-table .checkbox-cell {
        width: 28px;
    }
    .audit-table .checkbox-cell input[type="checkbox"] {
        width: 12px;
        height: 12px;
    }
    .audit-table tbody td::before {
        min-width: 55px;
        font-size: 0.5rem;
    }
    
    .btn-audit-filter,
    .btn-audit-clear {
        font-size: 0.65rem;
        padding: 3px 8px;
        height: 24px;
    }
    .btn-audit-danger,
    .btn-audit-danger-outline {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
    .audit-page-btn {
        min-width: 24px;
        height: 24px;
        font-size: 0.65rem;
        padding: 0 4px;
    }
    
    .btn-primary {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* ==========================================
   CONFIGURACIÓN PARA IMPRESIÓN - 1 SOLA PÁGINA
   ========================================== */
@media print {
    body * {
        visibility: hidden;
    }
    
    #printable-ticket,
    #printable-ticket * {
        visibility: visible;
    }

    #printable-ticket {
        display: block !important;
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 320px !important;
        max-width: 95% !important;
        border: 2px solid #000 !important;
        border-radius: 10px !important;
        padding: 14px 16px 10px !important;
        background: white !important;
        box-shadow: none !important;
        margin: 0 !important;
        font-size: 12px !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
    }

    #printable-ticket * {
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
    }

    #printable-ticket #qrcode img,
    #printable-ticket #qrcode canvas {
        max-width: 75px !important;
        max-height: 75px !important;
    }

    #printable-ticket .no-print {
        display: none !important;
    }
}