/* ===================================================================
    1. ESTILOS GENERALES Y DISEÑOS DE PÁGINA
    =================================================================== */

body {
    background-color: #f8f9fa;
}

.login-page-body {
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem;
}

.admin-body {
    display: flex;
    position: relative;
    overflow-x: hidden;
}

.operador-page-body-gradient {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem;
}

/* ===================================================================
    2. COMPONENTES ESPECÍFICOS
    =================================================================== */

/* --- Login --- */
.login-container-wrapper {
    display: flex; width: 100%; max-width: 900px; min-height: 550px;
    background-color: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); overflow: hidden;
}
.login-form-section { flex-basis: 50%; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.login-image-section { flex-basis: 50%; background: linear-gradient(to top, #accbee 0%, #e7f0fd 100%); display: flex; align-items: center; justify-content: center; }
#login-lottie { width: 90%; max-width: 400px; }
#login-lottiee { width: 70%; max-width: 170px;  margin: 0 auto; }
.login-logo { max-height: 40px; margin-bottom: 1rem; }

/* --- Panel de Administración --- */
.sidebar { width: 250px; background-color: #212529; color: white; height: 100vh; position: fixed; display: flex; flex-direction: column; z-index: 1000; transition: transform 0.3s ease-in-out; }
.sidebar-header { padding: 1.5rem 1rem; text-align: center; background-color: rgba(0,0,0,0.2); }
.user-info .user-name { font-size: 1rem; color: #fff; }
.sidebar .nav { overflow-y: auto; flex-grow: 1; }
.sidebar .nav-item { width: 100%; }
.sidebar .nav-link { padding: 0.75rem 1rem; color: #adb5bd; transition: all 0.3s; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { background-color: #495057; color: white; }
.main-content { margin-left: 250px; padding: 0; /* PADDING SE MUEVE A CONTENT-SECTION */ width: calc(100% - 250px); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.3s ease-in-out; }
.content-section { flex-grow: 1; padding: 2rem; /* PADDING AÑADIDO AQUÍ */ }
.logo-preview { max-width: 150px; border: 1px solid #dee2e6; padding: 5px; margin-top: 10px; border-radius: .25rem; }
.actions .btn { margin-right: 5px; }
.main-footer { padding: 15px; color: #6c757d; border-top: 1px solid #dee2e6; background-color: #fff; margin-top: 2rem; flex-shrink: 0; }
.main-footer a { color: #0d6efd; text-decoration: none; }

/* --- Estilos para la nueva barra de encabezado --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Espacio entre los dos botones */
}

.header-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

/* Por defecto, el toggler está oculto en escritorio */
.sidebar-toggler {
    display: none;
    background: none;
    border: none;
    color: #212529;
    font-size: 24px;
}


/* --- Componentes del menú móvil --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* --- Panel de Operador --- */
.operador-wrapper { display: flex; flex-direction: column; min-height: 100vh; margin: -2rem; }
.operador-wrapper .main-footer { background-color: #fff; border-top: 1px solid #dee2e6; flex-shrink: 0; }
.operador-page-body-gradient .card { border: none; }
.operador-card-body { display: grid; grid-template-rows: 1fr auto; gap: 1rem; }
.ticket-display-box { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: .5rem; padding: 2rem; display: flex; flex-direction: column; justify-content: center; }
.action-buttons-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 1rem; }
.action-buttons-grid button { font-size: 1.25rem; padding: 1rem; }

/* --- Pantalla Pública --- */
.pantalla-container { display: flex; flex-direction: column; height: 100vh; }
#start-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.start-box { text-align: center; color: white; background-color: rgba(0, 0, 0, 0.2); padding: 3rem 4rem; border-radius: 15px; }
.llamadas-area { background: #f0f0f0; overflow-y: auto; }
.llamadas-header { display: flex; justify-content: space-between; padding: 0.75rem 1.25rem; background-color: #0d6efd; color: white; font-weight: bold; font-size: 1.5em; border-radius: .25rem .25rem 0 0; }
#lista-llamadas { column-count: 2; column-gap: 1.5rem; }
#lista-llamadas .list-group-item { display: flex; justify-content: space-between; align-items: center; border-right: 0; border-left: 0; -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid; }
.ticket-code { font-size: 3em; font-weight: 700; }
.client-name { display: block; font-size: 0.9em; color: #6c757d; }
.puesto-info-wrapper { text-align: right; font-size: 1.9em; }
.ticket-info-wrapper { text-align: left; }
.estado-atendido { opacity: 0.65; }
.estado-en_espera { background-color: #fff; border-color: #dee2e6; font-size: 0.9em;}
.estado-en_espera .sector-name, .estado-en_espera .puesto-info-wrapper .sector-name { color: #6c757d; }
.no-tickets { color: #6c757d; }

/* --- Kiosko --- */
#dni-display { background-color: #e9ecef; border: 1px solid #ced4da; height: 80px; font-weight: 500; letter-spacing: 0.2em; }
.keypad-btn { height: 80px; font-size: 2rem; font-weight: 500; }
.connector-icon { font-size: 2.5rem; color: #adb5bd; font-weight: bold; }

/* ===================================================================
    3. ANIMACIONES Y EFECTOS
    =================================================================== */

.blinking { animation: blink-animation 1.5s infinite; }
@keyframes blink-animation {
    0% { background-color: #ffffff; }
    50% { background-color: #ffc107; }
    100% { background-color: #ffffff; }
}

.glowing-btn { animation: glow 1.5s infinite alternate; }
@keyframes glow {
    from { box-shadow: 0 0 5px #28a745, 0 0 20px #28a745; }
    to { box-shadow: 0 0 20px #28a745, 0 0 40px #28a745; }
}

.btn-priority-alert { animation: priority-glow 1.5s infinite alternate; }
@keyframes priority-glow {
    from { box-shadow: 0 0 5px #ffc107, 0 0 10px #ffc107, 0 0 15px #ffc107; transform: scale(1); }
    to { box-shadow: 0 0 20px #ffc107, 0 0 30px #ffc107, 0 0 40px #ffc107; transform: scale(1.05); }
}

/* ===================================================================
    4. ESTILOS DE IMPRESIÓN
    =================================================================== */
@media print {
    .sidebar, .main-footer, #form-reporte, #btn-imprimir-reporte, 
    .operador-wrapper .col-lg-5, .operador-wrapper .main-footer {
        display: none !important;
    }
    .main-content, .operador-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        min-height: auto;
    }
    #reportes, #reporte-resultado {
        display: block !important;
    }
    #reporte-resultado { width: 100%; padding: 20px; }
    .table { font-size: 9pt; width: 100%; border: 1px solid #ccc; }
    .table th, .table td { border: 1px solid #ccc; }
    #reporte-titulo { font-size: 16pt; text-align: center; margin-bottom: 20px; }
    #ticket-imprimible, #ticket-imprimible * { visibility: visible; }
    #ticket-imprimible { position: absolute; left: 0; top: 0; width: 100%; }
    .ticket-header, .ticket-footer { text-align: center; font-size: 12px; color: #000; }
    .ticket-code-print { font-size: 32px; font-weight: bold; text-align: center; color: #000; margin: 5px 0; }
    .ticket-client-name-print { font-size: 14px; text-align: center; color: #000; }
    .ticket-datetime { font-size: 10px; text-align: center; color: #000; }
    .card { border: none !important; box-shadow: none !important; }
}

/* ===================================================================
    5. RESPONSIVE DESIGN
    =================================================================== */
@media (max-width: 768px) {
    .login-container-wrapper { flex-direction: column; min-height: auto; }
    .login-image-section { display: none; }

    /* ===== CÓDIGO ACTUALIZADO PARA EL PANEL RESPONSIVO ===== */
    .sidebar {
        transform: translateX(-100%); /* Oculta el sidebar fuera de la pantalla */
        position: fixed;
    }

    .main-content {
        margin-left: 0; /* El contenido principal ocupa todo el ancho */
        width: 100%;
    }
    
    .content-section {
        padding: 1rem; /* Reducimos el padding a las secciones internas */
    }

    /* Mostrar el botón de menú y ajustar la barra en móvil */
    .sidebar-toggler {
        display: block; /* Hacemos visible el botón de menú */
    }

    .main-header {
        padding: 0.5rem 1rem; /* Un poco menos de padding en móvil */
        position: sticky; /* Hacemos que la barra se quede fija arriba */
        top: 0;
        z-index: 998;
    }
    
    .admin-body.sidebar-visible .sidebar {
        transform: translateX(0); /* Muestra el sidebar cuando el body tiene la clase */
    }

    .admin-body.sidebar-visible .sidebar-overlay {
        display: block; /* Muestra el fondo oscuro */
    }

    /* ===== NUEVOS ESTILOS PARA OPTIMIZAR ESPACIO VERTICAL ===== */
    .sidebar-header {
        padding: 1rem; /* Reduce el padding del header del sidebar */
    }
    .sidebar #lottie-animation {
        width: 80px !important; /* Reduce el tamaño de la animación */
        height: 80px !important;
        margin-top: 0;
        margin-bottom: 0;
    }
    .sidebar .user-info {
        margin-bottom: 0.5rem !important; /* Reduce el margen debajo del nombre de usuario */
    }
    .sidebar .nav-link {
        padding-top: 0.6rem; /* Reduce el espaciado vertical de los enlaces */
        padding-bottom: 0.6rem;
    }
}

/* =================================== */
/* ESTILOS COMPLETOS DEL PRELOADER    */
/* =================================== */

/* Contenedor principal que ocupa toda la pantalla */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

/* Clase para ocultar el preloader con JavaScript */
#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Contenedor del contenido centrado */
.loader-content {
    text-align: center;
}

/* Estilos para el título animado (clase específica para evitar conflictos) */
.loader-content .preloader-title {
    font-weight: 900;
    color: #007bff;
    font-size: 2.8rem;
    margin-bottom: 40px;
}

/* Estilos para cada letra del título para la animación */
.loader-content .preloader-title span {
    position: relative;
    display: inline-block;
    animation: wave-effect 2s infinite;
    animation-delay: calc(0.1s * var(--i));
}

/* Animación de los puntos de carga */
.loader-animation {
    display: flex;
    justify-content: center;
}

.loader-animation .dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-color: #007bff;
    border-radius: 50%;
    margin: 0 6px;
    animation: bounce 1.4s infinite ease-in-out both;
}

/* Retrasos en la animación de los puntos para efecto escalonado */
.loader-animation .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-animation .dot:nth-child(2) {
    animation-delay: -0.16s;
}


/* =================================== */
/* DEFINICIÓN DE ANIMACIONES      */
/* =================================== */

/* Keyframes para la animación de la ola en el título */
@keyframes wave-effect {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Keyframes para la animación de rebote de los puntos */
@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}