/* =================================================================== */
/* === APP SIC - HOJA DE ESTILOS PRINCIPAL (REFACTORIZADA) === */
/* =================================================================== */

/* --- 1. VARIABLES GLOBALES Y RESET --- */
:root {
    --color-sidebar-bg: #2c3e50;
    /* Gris Corporativo "Midnight Blue" */
    --color-sidebar-text: #ecf0f1;
    --color-sidebar-border: #34495e;
    --color-sidebar-hover-bg: #34495e;
    /* "Wet Asphalt" */
    --color-sidebar-active-text: #ffffff;
    --color-sidebar-active-border: #f1c40f;
    /* Amarillo "Sun Flower" */

    --color-primary: #387E32;
    /* Verde Institucional */
    --color-accent: #FACD3C;
    /* Amarillo Institucional */
    --color-dark: #3C3C3B;
    /* Gris Institucional */

    --body-bg: #f4f6f9;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-color: #e9ecef;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- 2. LAYOUT PRINCIPAL (Grid y Contenedores) --- */
body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--body-bg);
    color: var(--color-dark);
}

/* Se aplica a todas las páginas EXCEPTO al login */
body.grid-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    /* Sidebar | Main Content */
    grid-template-rows: 100vh;
    height: 100vh;
    overflow: hidden;
    /* Previene el scroll en el body */
}

.sidebar {
    /* Este elemento es un item de la grid. Su tamaño y posición son controlados por body.grid-container */
    background-color: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    /* Permite scroll en el sidebar si tiene muchos elementos */
}

.main-container {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Habilita el scroll SOLO para el área de contenido principal */
}

.content-area {
    padding: 2rem;
    flex-grow: 1;
    /* Asegura que ocupe todo el espacio vertical disponible */
}


/* --- 3. COMPONENTES DEL SIDEBAR --- */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-header a {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
}

.sidebar-header .logo {
    max-width: 45px;
    height: auto;
    margin-right: 12px;
}

.sidebar-header .logo-text {
    font-size: 24px;
    font-weight: bold;
}

/* ESTILOS DEL NUEVO SIDEBAR (ACORDEÓN) */
.nav-group,
.nav-group-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Cabecera del grupo (Acordeón) */
.nav-group-header {
    padding: 15px 25px;
    color: var(--color-sidebar-text);
    font-weight: 500;
    /* Lighter font weight */
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid transparent;
    /* Para mantener alineación */
    transition: all 0.2s ease;
}

.nav-group-header:hover {
    background-color: var(--color-sidebar-hover-bg);
    color: var(--color-sidebar-active-text);
}

/* Flecha rotatoria */
.arrow-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.arrow-icon.rotated {
    transform: rotate(-180deg);
}

/* Submenús */
.nav-group-submenu {
    background-color: rgba(0, 0, 0, 0.15);
    /* Fondo ligeramente más oscuro */
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05);
}

/* Enlaces (tanto nivel superior como submenús) */
.nav-group li a,
.nav-group-submenu li a {
    display: flex;
    align-items: center;
    padding: 12px 25px 12px 45px;
    /* Más padding izquierdo para subitems */
    color: var(--color-sidebar-text);
    text-decoration: none;
    font-weight: 400;
    transition: all 0.2s ease-in-out;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

/* Nivel superior (fuera de collapse) - Ajuste de padding */
.nav-group>li>a {
    padding-left: 25px;
    font-weight: 400;
}

.nav-group li a:hover,
.nav-group-submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-sidebar-active-text);
}

.nav-group li a.active,
.nav-group-submenu li a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-sidebar-active-text);
    font-weight: 600;
    border-left-color: var(--color-sidebar-active-border);
}

.nav-group a i.fa-fw {
    margin-right: 15px;
}


/* --- 4. COMPONENTES DEL HEADER SUPERIOR --- */
.main-header {
    background-color: #ffffff;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    /* Fija el header al hacer scroll en .main-container */
    top: 0;
    z-index: 999;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-content .page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* Espacio entre elementos */
}

.notification-bell-container {
    position: relative;
}

#notification-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #e74c3c;
    /* Rojo */
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 2px;
    display: none;
    /* JS lo mostrará cuando sea necesario */
}


/* --- 5. COMPONENTES GENERALES (Tarjetas, Botones, Tablas) --- */
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.card h3 {
    margin-top: 0;
    color: var(--color-primary);
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
}

.styled-table th,
.styled-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.styled-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--color-dark);
}

.styled-table tbody tr:hover {
    background-color: #f1f1f1;
}

.styled-table td:last-child {
    text-align: right;
    white-space: nowrap;
}


/* --- 6. ESTILOS ESPECÍFICOS DE PÁGINAS --- */

/* Estilos para el Login */
body.login-page {
    display: block;
    /* Anula la grid para la página de login */
}

.login-container {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    height: 100vh;
    background-image: url('../img/login-background.jpg');
    background-size: cover;
    background-position: center;
    padding: 15vh 10vw 0 0;
}

.login-form-container {
    padding: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    backdrop-filter: blur(4px);
}

.login-form-container h2 {
    color: var(--color-primary);
    margin-bottom: 10px;
}

.login-form-container p {
    margin-bottom: 30px;
    color: #666;
}

.login-form-container .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.login-form-container input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.login-form-container input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.login-form-container button {
    width: 100%;
    padding: 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-form-container button:hover {
    background-color: #2a6a24;
    /* Un verde más oscuro para el hover */
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-top: 20px;
}

.login-footer {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Estilos para las tarjetas de los CRUDs (Indicadores e Informes) */
.card-button {
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
    /* Oculto por defecto */
    text-align: center;
}

.card-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--color-primary);
}

/* Estilos para mejorar los campos de formulario */
.form-select,
.form-control {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    height: calc(2.25rem + 2px);
}

/* === ESTILOS MODERNOS PARA EL DASHBOARD === */

/* Título principal del dashboard */
.card-header h3 {
    font-weight: 600;
    color: var(--color-dark);
}

/* Etiquetas de los filtros */
.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

/* Estilo de los selects */
.form-select {
    border-radius: 6px;
    border-color: #ced4da;
    transition: all 0.2s ease-in-out;
}

.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(56, 126, 50, 0.2);
}

.form-select:disabled {
    background-color: #e9ecef;
}

/* Botón "Ver" */
.btn-primary {
    font-weight: 600;
}

/* Contenedor del gráfico con un fondo sutil y borde */
.bg-light.border.rounded-3 {
    background-color: #f8f9fa !important;
}

/* Estilos para el semáforo */
#semaphore-container h5 {
    color: var(--color-dark);
    font-weight: 500;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}