/* ==========================================================================
   MANUAL DE ESTILOS Y COMPONENTES - SISTEMA CITFSA v1.0
   ========================================================================== */

/* ----------------------------------------------
   1. VARIABLES GLOBALES Y RESET
   ---------------------------------------------- */
:root {
    --color-primary: #005A9C;         /* Azul corporativo, profesional y confiable */
    --color-primary-dark: #003F6B;    /* Para hovers y estados activos */
    --color-accent: #00BFFF;          /* Azul cielo para acentos y llamadas a la acción */
    --color-bg-light: #F8F9FA;        /* Fondo general, un gris muy claro */
    --color-bg-white: #FFFFFF;        /* Para tarjetas y cabeceras */
    --color-text-dark: #212529;       /* Texto principal, oscuro y legible */
    --color-text-light: #6C757D;      /* Texto secundario y etiquetas */
    --color-border: #DEE2E6;          /* Bordes sutiles y separadores */
    --color-success: #28a745;          /* Verde para mensajes de éxito */
    --color-danger: #dc3545;           /* Rojo para errores */
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-strong: 0 8px 16px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition-speed: 0.2s;
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    font-size: 16px;
    line-height: 1.6;
}

/* ----------------------------------------------
   2. CONTENEDORES PRINCIPALES
   ---------------------------------------------- */
/* Usado en home.html */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Usado en crm.html y otras páginas de módulo */
.module-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.content-area {
    flex-grow: 1;
    padding: 2rem;
}

/* ----------------------------------------------
   3. CABECERA Y NAVEGACIÓN (Reutilizable)
   ---------------------------------------------- */
.main-header, .module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--color-bg-white);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.header-logo, .back-to-panel {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-dark);
    text-decoration: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-message {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.logout-button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed) ease;
}

.logout-button:hover {
    background-color: var(--color-primary-dark);
}

.module-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.module-nav a {
    text-decoration: none;
    color: var(--color-text-light);
    font-weight: 500;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-speed) ease;
}

.module-nav a:hover {
    color: var(--color-primary);
}

.module-nav a.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ----------------------------------------------
   4. PANTALLA DE LOGIN Y SELECCIÓN DE PERFIL
   ---------------------------------------------- */
.centered-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-box {
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    background: var(--color-bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong);
    text-align: center;
}

.auth-box h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.auth-box p {
    color: var(--color-text-light);
    margin-bottom: 2rem;
}

#profiles-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-button, #google-login-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-white);
    color: var(--color-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.profile-button:hover, #google-login-btn:hover {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ----------------------------------------------
   5. MODAL DE CONTRASEÑA
   ---------------------------------------------- */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--color-bg-white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-strong);
    width: 90%;
    max-width: 400px;
}

#password-input {
    width: 100%;
    padding: 0.8rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
}

.modal-content button {
    padding: 0.7rem 1.2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 1px solid transparent;
}

#password-submit-btn {
    background-color: var(--color-primary);
    color: white;
}

/* ----------------------------------------------
   6. PANEL DE MÓDULOS (HOME)
   ---------------------------------------------- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-dark);
    background-color: var(--color-bg-white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-speed) ease;
    text-align: center;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-strong);
    color: var(--color-primary);
}

.app-card img {
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
    object-fit: contain;
}

/* ----------------------------------------------
   7. PÁGINA DE MÓDULO (IFRAME)
   ---------------------------------------------- */
.content-area iframe {
    flex-grow: 1; /* Ocupa el espacio disponible en el contenedor flex */
}

/* ----------------------------------------------
   8. UTILIDADES
   ---------------------------------------------- */
.error-text {
    color: var(--color-danger);
    font-size: 0.9rem;
    margin-top: 1rem;
    min-height: 1.2em;
}

.main-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
    background-color: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}