/* ======================================================= */
/* AURA ADMIN - CSS DEPURADO Y OPTIMIZADO          */
/* ======================================================= */

/* --- 1. Variables Globales y Reseteo Base --- */
:root {
    --accent-color: #007bff;
    --sidebar-bg: #2c3e50;
    --main-bg: #f4f7f9;
    --sidebar-text-color: #ecf0f1;
    --sidebar-border-color: #34495e;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
    --text-primary: #212529;
    --text-secondary: #6c757d;
}

body, html {
    margin: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--main-bg);
}

* {
    box-sizing: border-box;
}

/* --- 2. Layout Principal (Mobile-First) --- */


/* CONTENEDOR GENERAL */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background-color: #f4f6f9;
    font-family: 'Segoe UI', sans-serif;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: linear-gradient(to bottom, #0d6efd, #084298);
    color: #fff;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

/* CONTENIDO PRINCIPAL */
.main-content {
    margin-left: 240px;
    flex-grow: 1;
    padding: 20px;
    box-sizing: border-box;
}

/* HEADER CON RELOJ */
.header-with-clock {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-with-clock h1 {
    font-size: 24px;
    color: #333;
}

#live-clock {
    font-size: 16px;
    color: #555;
}

/* TARJETAS DEL DASHBOARD */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background-color: #fff;
    border-left: 6px solid #007bff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.dashboard-card:hover {
    transform: scale(1.02);
}

.dashboard-card h3 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

.dashboard-card .value {
    font-size: 20px;
    font-weight: bold;
    color: #007bff;
}

/* GRÁFICOS */
.chart-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* BOTÓN HAMBURGUESA */
#hamburger-menu {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    font-size: 24px;
    background: none;
    border: none;
    color: #fff;
    z-index: 101;
}

/* RESPONSIVO PARA MÓVILES */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -260px;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    #hamburger-menu {
        display: block;
    }
}



/* --- 3. Componentes Principales --- */

/* Cabecera */
.header-with-clock {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Para que se ajuste en pantallas pequeñas */
    gap: 15px;
    margin-bottom: 25px;
}

.header-with-clock h1 {
    margin: 0;
    color: var(--text-primary);
}

#live-clock {
    font-weight: 500;
    color: var(--text-secondary);
    background-color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Sidebar */
.sidebar-user-info {
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--sidebar-border-color);
}

.sidebar-user-info span {
    display: block;
    line-height: 1.5;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-nav li a {
    display: block;
    padding: 12px 15px;
    color: var(--sidebar-text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sidebar-nav li a:hover {
    background-color: var(--sidebar-border-color);
}

.sidebar-nav li.active a {
    background-color: var(--accent-color);
    font-weight: bold;
}

.logout-button {
    display: block;
    padding: 12px 15px;
    background: var(--danger-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    margin-top: auto; /* Empuja el botón hacia abajo */
    transition: background-color 0.2s ease;
}

.logout-button:hover {
    background-color: #c0392b; /* Tono más oscuro de rojo */
}

/* Menú hamburguesa (para móviles) */
#hamburger-menu {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
}


/* --- 4. Componentes Reutilizables (Botones, Formularios, Tablas) --- */

/* Botones Genéricos */
.btn-login, .btn-cancelar {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-login {
    background-color: var(--accent-color);
    color: white;
}
.btn-login:hover { background-color: #0056b3; }
.btn-login:active { transform: scale(0.98); }

.btn-cancelar {
    background-color: #6c757d;
    color: white;
}
.btn-cancelar:hover { background-color: #5a6268; }

/* Formularios y Filtros */
.filters-container, .filter-container { /* Unificamos clases similares */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.form-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Permite que los campos crezcan */
    min-width: 150px; /* Ancho mínimo para evitar que se aplasten */
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
}

/* Contenedor de Tablas */
.table-container {
    overflow-x: auto; /* Permite scroll horizontal en tablas grandes */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-primary);
}

tbody tr:hover {
    background-color: #f1f3f5;
}

/* --- 5. Componentes Específicos --- */

/* Gestión de Usuarios */
.user-management-layout {
    display: flex;
    flex-direction: column; /* Apilado en móviles */
    gap: 20px;
}

.tree-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background-color: #fff;
    height: 60vh;
    overflow: auto;
}

.details-panel {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background-color: #fff;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal.is-active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px; /* Ancho máximo por defecto */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}
.modal-content.ticket-details-modal-content { max-width: 800px; } /* Modal más ancho */

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-button:hover, .close-button:focus { color: #000; }

/* Menú Contextual */
.context-menu {
    display: none;
    position: absolute;
    z-index: 1060;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    padding: 5px 0;
}
.context-menu ul { list-style: none; margin: 0; padding: 0; }
.context-menu ul li { padding: 8px 15px; cursor: pointer; }
.context-menu ul li:hover { background-color: #f2f2f2; }

/* --- 6. Media Queries (Desktop) --- */
@media (min-width: 768px) {
    #hamburger-menu {
        display: none; /* Ocultar en pantallas grandes */
    }

    .sidebar {
        position: relative; /* Restaura el flujo normal */
        left: 0;
    }

    
    .user-management-layout {
        flex-direction: row; /* Lado a lado en escritorio */
    }

    .tree-container {
        flex: 0 0 300px; /* Ancho fijo para el árbol */
    }

    .details-panel {
        flex-grow: 1; /* El panel de detalles ocupa el resto del espacio */
    }
    /* Dentro del Contenido Principal de los usuarios */
}
.user-management-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* espacio entre paneles */
    justify-content: center; /* centra horizontalmente */
    padding: 20px;
    box-sizing: border-box;
}

/* Panel izquierdo: árbol de usuarios */
#user-tree-container {
    flex: 1 1 400px; /* base de 400px, crece si hay espacio */
    max-width: 500px;
    min-height: 80vh;
    overflow-y: auto;
    background-color: #f9f9f9;
    border-right: 1px solid #ddd;
    padding: 15px;
    box-sizing: border-box;
}

/* Panel derecho: detalles del usuario */
#user-details-panel {
    flex: 1 1 400px;
    max-width: 500px;
    min-height: 80vh;
    padding: 20px;
    background-color: #fff;
    box-sizing: border-box;
    overflow-y: auto;
    transition: all 0.3s ease;
}

/***DENTRO DEL CONTRENEDOR PRINCIPAL DE USUARIOS */

/* CONTENEDOR PRINCIPAL DE DETALLES */
#user-details-panel {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px 10px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* Scroll para navegadores WebKit */
#user-details-panel::-webkit-scrollbar {
    width: 6px;
}

#user-details-panel::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

/* CONTENIDO INTERNO DEL PANEL */
#user-details-panel .details-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    font-family: 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: #333;
    max-width: 600px;
    margin: 0 auto;
}

/* TÍTULO DEL PANEL */
.details-content h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #007bff;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    text-align: center;
}

/* LISTA DE DETALLES */
.details-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* CADA ITEM DE LA LISTA */
.details-list li {
    background-color: #f8f9fa;
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* ETIQUETA DEL CAMPO */
.details-list span {
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

/* VALOR DEL CAMPO */
.details-list strong {
    color: #222;
    font-weight: 500;
    word-break: break-word;
}

/* ESTADO ACTIVO */
.status-activo {
    color: green;
    font-weight: bold;
}

/* LISTA DE SALDOS */
.details-saldos-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ITEM DE SALDO */
.details-saldos-list li {
    background-color: #e9ecef;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 500;
    color: #333;
    border-top: 1px dashed #ccc;
    display: flex;
    justify-content: space-between;
}

/* RESPONSIVO PARA MÓVILES */
@media (max-width: 768px) {
    #user-details-panel .details-content {
        padding: 16px;
        font-size: 14px;
    }

    .details-content h3 {
        font-size: 18px;
    }

    .details-list li {
        padding: 8px 10px;
    }

    .details-saldos-list li {
        flex-direction: column;
        align-items: flex-start;
    }
}

.details-saldos-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column; /* fuerza orientación vertical */
    gap: 8px;
}

.details-saldos-list li {
    background-color: #f1f1f1;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* permite que el contenido se acomode si es largo */
    word-break: break-word; /* evita desbordes por textos largos */
}

/**Boton DE Cerrar seccion */
.logout-link {
    display: inline-block;
    background-color: #dc3545; /* rojo intenso */
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.logout-link:hover {
    background-color: #c82333;
    transform: scale(1.03);
}

.logout-link:active {
    background-color: #bd2130;
    transform: scale(0.98);
}
/* Barras de desplazamiento personalizadas */
/* Scroll para navegadores WebKit */
.sidebar {
    width: 260px;
    height: 100vh;
    background: linear-gradient(to bottom, #0d6efd, #084298); /* azul degradado */
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    box-sizing: border-box;
}
/* --- ESTILOS PARA EL SIDEBAR RESPONSIVO --- */

/* Por defecto, el botón de hamburguesa está oculto en pantallas grandes */
#hamburger-menu {
    display: none;
    position: fixed; /* O fixed, dependiendo de tu layout */
    top: 15px;
    left: 15px;
    z-index: 1001; /* Debe estar por encima del contenido */
    background: #2c3e50; /* Un color que combine con el sidebar */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
}

/* Media Query: Estilos que se aplican solo en pantallas de 768px de ancho o menos */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; /* Lo sacamos del flujo normal del documento */
        left: -260px; /* Lo ocultamos fuera de la pantalla (su ancho es 260px) */
        transition: left 0.3s ease-in-out; /* Animación suave */
    }

    .sidebar.active {
        left: 0; /* Cuando tenga la clase 'active', lo mostramos */
    }

    .main-content {
        margin-left: 0; /* El contenido principal ya no necesita margen */
    }

    #hamburger-menu {
        display: block; /* Mostramos el botón de hamburguesa */
    }
}

/* PARCHE PARA EL MODAL */
.modal {
    z-index: 10000 !important; /* Encima de todo */
}
.modal-backdrop {
    z-index: 9999 !important; /* Fondo oscuro justo debajo del modal */
}
/* Asegurar que el contenido sea seleccionable */
.modal-dialog {
    z-index: 10001 !important; 
}







