/* --- Variables Globales --- */
:root {
    --primary-color: #005A9C;  /* Azul corporativo */
    --secondary-color: #00A9E0; /* Azul claro */
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --white-color: #ffffff;
    --gray-color: #95a5a6;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* --- Reseteo Básico --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    background-color: var(--light-color);
    color: var(--dark-color);
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

ul {
    list-style: none;
}

/* --- Estilos del Login --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.login-container {
    background: var(--white-color);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    max-width: 120px;
    margin-bottom: 1rem;
}

.login-form h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 1rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* --- Estilos para el icono del ojo en el campo de contraseña --- */
.password-wrapper {
    position: relative;
}

.password-wrapper i {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gray-color);
}


.btn {
    display: inline-block;
    width: 100%;
    background: var(--primary-color);
    color: var(--white-color);
    padding: 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #004a80; /* Tono más oscuro de azul */
}

.error {
    background: var(--danger-color);
    color: var(--white-color);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* --- Estructura Principal (Dashboard) --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--dark-color);
    color: var(--light-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-header h3 {
    color: var(--white-color);
}

.sidebar-menu {
    flex-grow: 1;
}

.sidebar-menu li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--light-color);
    transition: background 0.3s ease, padding-left 0.3s ease;
}

.sidebar-menu li a:hover {
    background: var(--primary-color);
    padding-left: 2rem;
}

.sidebar-menu li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background: var(--danger-color);
    color: var(--white-color);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.btn-logout:hover {
    background: #c0392b; /* Tono más oscuro de rojo */
}

.main-content {
    flex-grow: 1;
    background: var(--light-color);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--white-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.menu-toggle {
    display: none; /* Oculto en escritorio */
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
}

.header-right span {
    font-weight: 700;
}

.content-wrapper {
    padding: 2rem;
}

/* --- Componentes (Cards) --- */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--white-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 2rem;
    font-weight: 700;
}

/* --- Responsividad y Menú Móvil (CORREGIDO) --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        height: 100%;
        /* Z-index muy alto para asegurar que esté por encima de todo */
        z-index: 1001; 
        transition: transform 0.3s ease-in-out;
        /* Oculto por defecto moviéndolo a la izquierda su propio ancho */
        transform: translateX(-250px); 
    }

    /* Cuando el BODY tiene la clase, el menú se muestra */
    body.sidebar-is-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        flex-grow: 0; 
        margin-left: 0;
    }

    .main-header {
        position: sticky;
        top: 0;
        z-index: 900;
    }
}

/* Estilos para el overlay del menú móvil */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999; /* Debe estar debajo del sidebar pero encima del contenido */
    display: none; /* Oculto por defecto */
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
}

/* Cuando el BODY tiene la clase, el overlay se muestra */
body.sidebar-is-open .sidebar-overlay {
    display: block; /* Se muestra cuando el menú está visible */
    opacity: 1;
}
