/* Variables CSS inspiradas en el diseño de referencia */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --success-color: #4cc9f0;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --light-text: #6c757d;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition-speed: 0.3s;
}

/* General Body Styles - Fondo celeste como la referencia */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: #76c4f8;
    color: var(--dark-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Container Styles - Actualizado con el diseño de referencia */
.container {
    background-color: #ffffff;
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    max-width: 700px;
    margin: 0 auto;
    /* Cambiado de '1.5rem auto' a '0 auto' */
}

.container:hover {
    /*transform: translateY(-2px);*/
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Login Specific Container */
.login-container {
    max-width: 400px;
    margin-top: 5vh;
    margin: auto;
}

/* Header actualizado con gradiente de la referencia */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 1em;
}

.header h1 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1em;
}

.header-actions>* {
    margin-top: 0;
    margin-bottom: 0;
}

.header-link {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 0.9em;
    white-space: nowrap;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.header-link:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.logout-btn {
    background-color: #dc3545;
    color: white;
    padding: 0.5em 1em;
    font-size: 0.9em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: auto;
    transition: all var(--transition-speed);
}

.logout-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.header-actions form {
    display: inline;
    margin: 0;
}

h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8em;
    margin-bottom: 1.5em;
    font-weight: 600;
}

h2 {
    color: var(--dark-text);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-size: 1.4em;
    font-weight: 500;
}

/* Form Element Styles */
label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 500;
    color: var(--dark-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.8em;
    margin-bottom: 1.2em;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1em;
    background-color: white;
    transition: all var(--transition-speed);
}

input[type="text"],
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    outline: none;
}

select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all var(--transition-speed);
    width: 100%;
    margin-top: 0.5em;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

/* Logout Button Specifics */
.logout-btn {
    background-color: #dc3545;
    padding: 0.5em 1em;
    font-size: 0.9em;
    width: auto;
    margin-top: 0;
}

.logout-btn:hover {
    background-color: #c82333;
}

/* Flash Message Styles */
.flash-messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5em 0;
}

.flash-messages li {
    padding: 1em;
    margin-bottom: 1em;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.95em;
}

.flash-messages .error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.flash-messages .success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5em;
    box-shadow: var(--card-shadow);
    border-radius: 8px;
    overflow: hidden;
    /* Asegura que los bordes redondeados se apliquen a la tabla */
}

th,
td {
    border: 1px solid #e2e8f0;
    padding: 0.9em 1em;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #e9ecef;
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all var(--transition-speed);
}

a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.back-link {
    display: inline-block;
    margin-top: 2em;
    padding: 0.6em 1.2em;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    transition: all var(--transition-speed);
}

.back-link:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Responsive design adjustments */
@media (max-width: 650px) {
    body {
        margin: 0;
        padding: 0;
    }

    .container {
        padding: 1.5em;
        margin: 0.5rem;
    }

    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.2em;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    /* <-- AÑADIDO AQUÍ */
    select {
        width: 100%;
        padding: 0.8em;
        margin-bottom: 1.2em;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-sizing: border-box;
        font-size: 1em;
        background-color: white;
        transition: all var(--transition-speed);
    }

    input[type="text"],
    input[type="email"]:focus,
    input[type="password"]:focus,
    input[type="date"]:focus,
    /* <-- AÑADIDO AQUÍ */
    select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
        outline: none;
    }

    th,
    td {
        padding: 0.6em 0.8em;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1em;
    }

    .form-actions>* {
        width: 100%;
        margin: 0;
        text-align: center;
    }
}

/* Action selector styles */
.action-selector {
    margin-bottom: 1.5em;
    padding: 1em;
    background-color: var(--light-bg);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.action-selector label {
    display: inline-block;
    margin-right: 1.5em;
    font-weight: normal;
    cursor: pointer;
}

.action-selector input[type="radio"] {
    margin-right: 0.4em;
    vertical-align: middle;
    width: auto;
    margin-bottom: 0;
}

.action-selector label:first-of-type {
    display: block;
    font-weight: 600;
    margin-bottom: 0.7em;
    margin-right: 0;
}

/* Save button styles */
.save-btn {
    background-color: #28a745;
    color: white;
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    width: auto;
    margin-top: 0;
    transition: all var(--transition-speed);
}

.save-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
}
.temp-btn{
    background-color: #ffc107; 
    color: #212529; 
    border-color: #ffc107;
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    width: auto;
    margin-top: 0;
    transition: all var(--transition-speed);
}




.cancel-link,
.back-link {
    display: inline-block;
    padding: 0.7em 1.2em;
    border: 1px solid #6c757d;
    color: #6c757d;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95em;
    transition: all var(--transition-speed);
}

.cancel-link:hover,
.back-link:hover {
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Modify form table styles */
#modify-form table td:last-child {
    width: 150px;
}

/* Disabled label styles */
.action-selector label.disabled-label {
    color: #999;
    cursor: not-allowed;
}

.action-selector input[type="radio"]:disabled {
    cursor: not-allowed;
}

.action-selector input[type="radio"]:disabled+span {
    color: #999;
}

/* Form actions styles */
.form-actions {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-actions>* {
    margin: 0;
    flex-shrink: 0;
}

.form-actions .save-btn {
    background-color: #28a745;
    color: white;
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    width: auto;
}

.form-actions .save-btn:hover {
    background-color: #218838;
}

.form-actions .action-btn,
.form-actions .cancel-link,
.form-actions .back-link,
.form-actions .edit-link {
    display: inline-block;
    padding: 0.7em 1.2em;
    border: 1px solid #6c757d;
    color: #6c757d;
    background-color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95em;
    text-align: center;
    line-height: 1.2;
    transition: all var(--transition-speed);
}

.form-actions .action-btn:hover,
.form-actions .cancel-link:hover,
.form-actions .back-link:hover,
.form-actions .edit-link:hover {
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.form-actions .edit-link {
    border-color: #ffc107;
    background-color: #ffc107;
    color: #212529;
}

.form-actions .edit-link:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

/* User table styles */
.user-table th,
.user-table td {
    padding: 0.7em 1em;
}

.user-table .actions a,
.user-table .actions form button {
    margin-right: 0.5em;
    font-size: 0.9em;
    padding: 3px 7px;
}

.user-table .actions form {
    display: inline;
}

.delete-btn {
    background-color: #dc3545;
    border: none;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.delete-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.edit-link {
    color: var(--primary-color);
}

.edit-link:hover {
    color: var(--secondary-color);
}

.add-user-link {
    display: inline-block;
    margin-bottom: 1.5em;
    background-color: #28a745;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition-speed);
}

.add-user-link:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* Log container styles */
.log-container {
    background-color: #282c34;
    color: #abb2bf;
    font-family: Consolas, Menlo, Monaco, monospace;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
    white-space: pre;
    font-size: 0.9em;
    border: 1px solid #444;
    box-shadow: var(--card-shadow);
}

.log-container h2 {
    color: #61afef;
}

.back-link-audit {
    margin-top: 1em;
    display: inline-block;
}

/* ==================================
    NAVBAR ACTUALIZADA CON DISEÑO DE REFERENCIA
    ================================== */

.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1.5rem 0;
    border-bottom: none;
    margin-bottom: 2rem;
    border-radius: 0 0 15px 15px;
    box-shadow: var(--card-shadow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    /* Añadido padding horizontal para el contenido */
}

.navbar-brand {
    color: var(--primary-color);
    font-size: 3em;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.5px;
    margin: auto;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5em;
}

.nav-link {
    color: rgba(3, 247, 104, 0.9);
    text-decoration: none;
    font-size: 1em;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all var(--transition-speed);
}

.nav-link:hover {
    color: rgba(2, 122, 38, 0.9);
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-form {
    margin: 0;
}

.logout-btn-nav {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgb(247, 2, 2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-speed);
    backdrop-filter: blur(10px);
    margin: 0;
}

.logout-btn-nav:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Main content */
.main-content {
    flex: 1 0 auto;
    padding: 1.5rem 0;
}

/* ==================================
    FOOTER ACTUALIZADO CON DISEÑO DE REFERENCIA
    ================================== */

.footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 0;
    margin-top: auto;
    flex-shrink: 0;
}

.footer .container {
    background: transparent;
    box-shadow: none;
    padding: 0 1.5em 0 1.5em;
    margin: 0 auto;
    max-width: 1200px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.footer-info {
    flex: 1;
}

.footer-logo {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.footer-info p {
    margin: 0;
    opacity: 0.8;
    font-weight: 300;
}

.footer-contact {
    display: flex;
    align-items: center;
}

.footer-contact-item {
    display: flex;
    align-items: center;
    margin-left: 1.5rem;
}

.footer-contact-item i {
    margin-right: 8px;
    font-size: 1.1rem;
}

.footer-contact-item a {
    color: white;
    text-decoration: none;
    transition: all var(--transition-speed);
}

.footer-contact-item a:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}

.footer-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1.5rem 0 1rem;
}

.footer-bottom {
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    opacity: 0.7;
}

.footer-bottom a:link,
.footer-bottom a:visited,
.footer-bottom a:hover,
.footer-bottom a:active {
    color: white;
    text-decoration: none; /* Quita subrayado */
}
/* Flash wrapper */
.flash-wrapper {
    margin-bottom: 1.5em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem 0;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-actions {
        gap: 1rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .footer-contact {
        margin-top: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-contact-item {
        margin: 0;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .user-dropdown {
        width: 100%;
    }

    .user-dropdown-btn {
        width: 50%;
        text-align: center;
        margin: auto;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.25rem;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .logout-btn-nav {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .user-dropdown {
        width: 100%;
        margin: auto;
    }

    .user-dropdown-btn {
        width: 50%;
        text-align: center;
        margin: auto;
    }
}

/* Estilos para el botón desplegable del usuario */
.dropdown-btn {
    /*background-color:var(--secondary-color);*/
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed);
    backdrop-filter: blur(10px);
    margin-bottom: .3rem;
}

.dropdown-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.dropdown-btn .me-2 {
    margin-right: 0.5rem;
}

.dropdown-btn .ml-2 {
    margin-left: 0.5rem;
}

/* Contenedor relativo para el desplegable */
.relative {
    position: relative;
}

/* Estilos para el menú desplegable - Centrado */
.dropdown-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    width: 12rem;
    background-color: #ffffff;
    border-radius: 0.375rem;
    box-shadow: var(--card-shadow);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    z-index: 50;
    border: 1px solid rgba(0, 0, 0, 0.05);
    outline: 2px solid transparent;
    outline-offset: 2px;
    display: none;
}

/* IMPORTANTE: Añadido !important para depuración. Considera quitarlo si no es necesario una vez que funcione. */
.dropdown-menu.show {
    display: block !important;
}

/* Estilos para los ítems del desplegable */
.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--dark-text);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: background-color 0.3s ease-in-out;
}

.dropdown-item:hover {
    background-color: var(--light-bg);
}

.dropdown-item.w-full {
    width: 100%;
}

.dropdown-item.text-left {
    text-align: left;
}

/* Clases de margen para íconos */
.me-1 {
    margin-right: 0.25rem;
}

/* Estilos para el botón de salir dentro del desplegable */
.dropdown-item.logout-item {
    color: #dc3545;
    font-weight: 500;
    background-color: #fff;
}

.dropdown-item.logout-item:hover {
    background-color: #f8d7da;
}

/* ==================================
    ESTILOS PARA TABLAS RESPONSIVAS
    ================================== */
.table-responsive {
    overflow-x: auto;
    /* Permite el desplazamiento horizontal */
    -webkit-overflow-scrolling: touch;
    /* Mejora el desplazamiento en iOS */
    margin-top: 1.5em;
    /* Mantener el margen superior de la tabla */
    border-radius: 8px;
    /* Aplicar el border-radius al contenedor */
    box-shadow: var(--card-shadow);
    /* Aplicar la sombra al contenedor */
}

/* Asegurarse de que la tabla dentro del contenedor no tenga overflow: hidden,
   ya que el contenedor lo manejará. También quitar la sombra y el border-radius
   directamente de la tabla si se aplican al contenedor. */
.table-responsive table {
    width: 100%;
    /* Asegura que la tabla ocupe el 100% del contenedor */
    min-width: 600px;
    /* Opcional: Establece un ancho mínimo para la tabla para evitar que se comprima demasiado */
    border-collapse: collapse;
    margin-top: 0;
    /* Eliminar el margen superior si ya está en el contenedor */
    box-shadow: none;
    /* Eliminar la sombra de la tabla si ya está en el contenedor */
    border-radius: 0;
    /* Eliminar el border-radius de la tabla si ya está en el contenedor */
}

.form-text {
    color: #dc3545;
    font: 0.8em sans-serif;
}

/* --- Estilos para el botón de mostrar/ocultar contraseña (Versión Mejorada) --- */
.password-wrapper {
    position: relative;
    display: flex;
    /* Usamos Flexbox para alinear */
    align-items: center;
    /* Esto centra verticalmente el icono */
    margin-bottom: 1.2em;
    /* Movemos el margen aquí */
}

.password-wrapper input {
    width: 100%;
    padding-right: 2.5em;
    /* Espacio para el icono */
    margin-bottom: 0;
    /* Quitamos el margen del input individual */
}

.toggle-password {
    position: absolute;
    right: 0.8em;
    /* Posicionamos el icono a la derecha */
    cursor: pointer;
    color: #aaa;
}

.toggle-password:hover {
    color: #333;
}


/* --- Estilos para el Modal de Bienvenida --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background-color: white;
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--primary-color);
}


/*estilo para el boton de cerrar*/
.modal-action {
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

.modal-action-btn {
    background-color: var(--success-color);
    color: white;
    padding: 0.6em 1.2em;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}

.modal-action-btn:hover {
    color: white;
}

/* Contenedor más ancho para las gráficas */
.container-fluid {
    width: 95%;
    /* Ocupa casi todo el ancho */
    max-width: 1400px;
    /* Pero con un límite máximo en pantallas muy grandes */
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin: 1.5rem auto;
}

.loading-overlay {
    position: fixed;
    /* Se queda fijo en la pantalla */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    /* Fondo blanco semitransparente */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* Se asegura de que esté por encima de todo */
    backdrop-filter: blur(5px);
}

.loading-overlay p {
    margin-top: 1.5em;
    font-size: 1.2em;
    font-weight: 500;
    color: var(--dark-text);
}

.spinner {
    border: 8px solid #f3f3f3;
    /* Gris claro */
    border-top: 8px solid var(--primary-color);
    /* Azul principal */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.chart-container {
    position: relative;
    height: 450px;
    width: 100%;
}

.container-analytics {
    margin: 1rem;
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

/* --- REEMPLAZAR ESTE BLOQUE COMPLETO para mejorar los controles de analíticas --- */
.analytics-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end; /* Alinea todos los elementos en la parte inferior */
}

.control-group {
    flex: 1;
    min-width: 180px;
}

.control-group label {
    font-size: 0.9em;
    margin-bottom: 0.3em;
}

/* Regla clave: Unifica la altura de todos los tipos de controles */
.control-group .form-control,
.control-group .btn {
    height: 45px;       /* Altura fija y consistente */
    padding: 0.5em 0.8em; /* Relleno consistente */
    margin-bottom: 0;   /* Quita márgenes que desalinean */
    box-sizing: border-box; /* Asegura que padding y borde no afecten la altura */
    width: 100%;
}

/* Asegura que los botones tengan el mismo estilo de borde que los inputs */
.control-group .btn {
    border: 1px solid transparent;
}

.container-analytics {
    margin: 1rem;
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.analytics-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
}

.control-group {
    flex: 1;
    min-width: 180px;
}

.control-group label {
    font-size: 0.9em;
    margin-bottom: 0.3em;
}

.control-group .form-control,
.control-group .btn {
    height: 45px;
    padding: 0.5em 0.8em;
    margin-bottom: 0;
    box-sizing: border-box;
    width: 100%;
}

.control-group .btn {
    border: 1px solid transparent;
}

/* --- NUEVO: Estilos para las Tarjetas de Resumen (KPIs) --- */
.kpi-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    flex: 1;
    min-width: 180px;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.kpi-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--light-text);
}

.kpi-card p {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary-color);
}

.main-chart-container {
    margin-bottom: 2rem;
}

.secondary-charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.chart-card {
    flex: 1;
    min-width: 300px;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.chart-card h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1em;
    font-weight: 500;
    color: var(--dark-text);
}

.chart-card canvas {
    max-height: 250px;
}

/* --- REEMPLAZAR ESTE BLOQUE COMPLETO para actualizar los estilos de análisis --- */
.analysis-container {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-card {
    background-color: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--card-shadow);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.analysis-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
}

.analysis-header h3 i {
    margin-right: 0.75em;
    color: var(--accent-color);
}

.event-count {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--light-text);
    margin-left: 0.5em;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--light-text);
    padding: 0.25rem 0.5rem;
}

.toggle-btn:hover {
    color: var(--dark-text);
}

.analysis-card .table-responsive {
    box-shadow: none;
    margin-top: 0;
}

.multi-select-container {
    position: relative;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
}

.multi-select-dropdown.show {
    display: block;
}

.multi-select-dropdown label {
    display: block;
    padding: 0.5rem;
    cursor: pointer;
}

.multi-select-dropdown label:hover {
    background-color: #f8f9fa;
}

.multi-select-dropdown label input {
    margin-right: 0.5rem;
    width: auto;
    margin-bottom: 0;
}

/* --- INICIO: Estilos para la Ventana Modal de Ajustes Temporales --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background-color: white;
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 500px;
}

.modal-content h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.modal-actions {
    margin-top: 1.5em;
    padding-top: 1em;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1em;
}

.modal-actions .btn {
    width: auto;
    margin-top: 0;
}