/* ============================================================================
   ESTILOS GENERALES Y ARQUITECTURA VISUAL - AGGENDA.ES
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. RESET Y CONFIGURACIÓN BÁSICA Y VARIABLES GLOBALES
   ---------------------------------------------------------------------------- */
:root {
    /* Modifica este color en un solo sitio para cambiar el día actual en toda la App */
    --color-hoy: #FAF394; 
}

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
    line-height: 1.5;
    padding-bottom: 20px;
}

/* Enlaces de texto estandarizados en #0000FF para mejorar la experiencia de usuario */
a {
    color: #0000FF;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ----------------------------------------------------------------------------
   2. PANTALLA DE AUTENTICACIÓN (LOGIN / REGISTRO / RECUPERAR)
   ---------------------------------------------------------------------------- */
.logo-titulo {
    display: block;
    text-align: center;
    font-size: 2.2em;
    font-weight: 800;
    color: #1d72f3;
    margin: 30px auto 20px auto;
    text-decoration: none;
    letter-spacing: -1px;
}

.card-auth {
    background: #ffffff;
    max-width: 450px;
    margin: 0 auto;
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #cbd5e1;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 5px;
    font-size: 0.9em;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: #1d72f3;
    border-bottom: 2px solid #1d72f3;
}

.form-auth {
    display: none;
}

.form-auth.active {
    display: block;
}

.grupo-field {
    margin-bottom: 15px;
}

.grupo-field label {
    display: block;
    font-size: 0.88em;
    font-weight: bold;
    margin-bottom: 5px;
    color: #475569;
}

.grupo-field input[type="text"],
.grupo-field input[type="email"],
.grupo-field input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95em;
    outline: none;
}

.grupo-field input:focus {
    border-color: #1d72f3;
}

.btn-submit {
    width: 100%;
    background-color: #1d72f3;
    color: #ffffff;
    border: none;
    padding: 12px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s;
}

.btn-submit:hover {
    background-color: #155cb4;
}

.alert-msg {
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9em;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.alert-error {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.alert-exito {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

/* ----------------------------------------------------------------------------
   3. PANEL DE BLOQUEO DE SUSCRIPCIÓN
   ---------------------------------------------------------------------------- */
.panel-suscripcion {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.suscripcion-contenido {
    background: #ffffff;
    padding: 35px 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 480px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.btn-pago-directo {
    display: inline-block;
    background-color: #16a34a;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    font-size: 1.1em;
}

/* ----------------------------------------------------------------------------
   4. CABECERA Y BOTONES DE ALTURA HOMOGÉNEA (34PX)
   ---------------------------------------------------------------------------- */
/* Botones de vistas con sombreado y aspecto de botón tridimensional */
.btn-vista {
    text-decoration: none;
    color: #334155;
    background-color: #e2e8f0;
    border: 1px solid #94a3b8;
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.btn-vista:hover {
    background-color: #f1f5f9;
    color: #0000FF;
    border-color: #64748b;
}

.btn-vista.activo {
    background-color: #1d72f3;
    color: #ffffff;
    border-color: #155cb4;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-nav {
    background-color: #34495e;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
}

.btn-salir {
    background-color: #dc2626;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
}

.btn-gestion {
    background-color: #16a34a;
    color: #ffffff;
    border: none;
    cursor: pointer;
}

/* ----------------------------------------------------------------------------
   5. VISTA 1: MENSUAL (ADAPTADA A LA ALTURA DE LA PANTALLA)
   ---------------------------------------------------------------------------- */
table.tabla-mensual {
    border-collapse: collapse;
    width: 96%;
    max-width: 1400px;
    background-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
    height: calc(100vh - 175px);
}

table.tabla-mensual th, table.tabla-mensual td {
    border: 1px solid #cbd5e1;
    padding: 6px;
    text-align: left;
    vertical-align: top;
    width: 14.28%;
}

table.tabla-mensual th {
    background-color: #34495e;
    color: #ffffff;
    text-align: center;
    padding: 8px;
    height: 35px;
    box-sizing: border-box;
}

table.tabla-mensual td {
    height: auto;
    cursor: pointer;
    transition: background-color 0.2s;
    box-sizing: border-box;
    overflow-y: auto;
    background-color: #f8fafc; /* Gris muy clarito (más claro que el sábado #f1f5f9) para resaltar tareas blancas */
}

table.tabla-mensual td:hover {
    background-color: #f1f5f9;
}

table.tabla-mensual td.sabado {
    background-color: #f1f5f9;
}

table.tabla-mensual td.domingo {
    background-color: #e2e8f0;
}

/* Día actual (HOY) unificado mediante Variable CSS para todas las vistas */
.dia-hoy, 
table.tabla-mensual td.dia-hoy,
.bloque-dia-agenda.dia-hoy {
    background-color: var(--color-hoy) !important; /* Consume la variable global */
    border: 2px solid #facc15 !important;           /* Borde fino amarillo/dorado */
}

.resaltado-temporal {
    outline: 3px solid #1d72f3;
    animation: pulsoResalte 2s infinite;
}

/* Compensación de desplazamiento para la cabecera fija sticky */
.bloque-dia-agenda {
    scroll-margin-top: 130px;
}

@keyframes pulsoResalte {
    0% { background-color: #eff6ff; }
    50% { background-color: #bfdbfe; }
    100% { background-color: #eff6ff; }
}

/* Números de día clickables en color azul #0000FF */
.dia-numero {
    font-weight: bold;
    font-size: 1.1em;
    color: #0000FF;
    display: inline-block;
    margin-bottom: 4px;
    text-decoration: none;
    transition: color 0.2s, transform 0.1s;
}

.dia-numero:hover {
    color: #0000CC;
    text-decoration: underline;
    transform: scale(1.1);
}

.badge-festivo {
    display: block;
    font-size: 0.75em;
    background-color: #fee2e2;
    color: #dc2626;
    padding: 2px 4px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-weight: bold;
}

.badge-santo {
    display: block;
    font-size: 0.72em;
    color: #64748b;
    margin-bottom: 4px;
    font-style: italic;
}

/* ----------------------------------------------------------------------------
   6. TARJETAS DE TAREAS Y BADGES INFORMATIVOS
   ---------------------------------------------------------------------------- */
.nota {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #1d72f3;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 0.85em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.etiqueta-categoria {
    font-size: 0.75em;
    font-weight: bold;
    color: #475569;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 4px;
}

.estado-badge {
    font-size: 0.75em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    color: #ffffff;
    display: inline-block;
}

.estado-Pendiente { background-color: #f97316; }
.estado-Iniciada  { background-color: #3b82f6; }
.estado-Terminada { background-color: #22c55e; }

.badge-recurrente {
    font-size: 0.75em;
    font-weight: bold;
    background-color: #f3e8ff;
    color: #7e22ce;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
}

.hora-tarea {
    font-size: 0.8em;
    color: #0284c7;
    font-weight: bold;
    display: block;
    margin-top: 2px;
}

/* ----------------------------------------------------------------------------
   7. VISTA 2: SEMANAL
   ---------------------------------------------------------------------------- */
.contenedor-semanal-filas {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fila-semanal-dia {
    display: flex;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    min-height: 80px;
    overflow: hidden;
}

.header-dia-fila {
    width: 130px;
    background: #f8fafc;
    border-right: 1px solid #cbd5e1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-weight: bold;
}

.contenido-dia-fila {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

/* ----------------------------------------------------------------------------
   8. VISTA 4: ANUAL (DÍAS MÁS GRANDES Y ENLACES EN #0000FF)
   ---------------------------------------------------------------------------- */
.grid-anual {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.mes-anual-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Destacado sutil en cian muy clarito para la tarjeta del Mes Actual en Vista Anual */
.mes-actual-anual {
    background-color: #e0f2fe !important; /* Cian muy, muy clarito */
    border: 2px solid #38bdf8 !important;  /* Borde fino en tono azul cian */
}

.mes-anual-titulo {
    display: block;
    text-align: center;
    font-weight: bold;
    color: #0000FF;
    margin-bottom: 8px;
    text-decoration: none;
    font-size: 1.05em;
}

.mes-anual-titulo:hover {
    text-decoration: underline;
}

.tabla-minicalendario {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em; /* Tamaño de letra aumentado para los días de la vista anual */
    text-align: center;
}

.tabla-minicalendario th, .tabla-minicalendario td {
    padding: 4px 2px; /* Mayor espacio de clic por día */
}

/* Enlaces de los días del mes en color #0000FF */
.tabla-minicalendario td a {
    color: #0000FF;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
}

.tabla-minicalendario td a:hover {
    text-decoration: underline;
    color: #0000CC;
}

/* Columna de semanas con enlaces en color #0000FF */
.col-semana-anual {
    background-color: #f1f5f9;
    font-weight: bold;
    border-right: 1px solid #cbd5e1;
}

.col-semana-anual a {
    color: #0000FF;
    font-weight: bold;
    text-decoration: none;
    display: block;
}

.col-semana-anual a:hover {
    color: #0000CC;
    text-decoration: underline;
}

/* Indicador destacado de HOY en Vista Anual (Vinculado a Variable CSS) */
.dia-hoy-minicalendario {
    background: var(--color-hoy) !important; /* Consume la variable global */
    border-radius: 6px;  
    display: inline-block;
    width: 26px;       
    height: 26px;      
    line-height: 26px; 
    font-weight: 800;
    color: #0000FF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); 
}

/* Círculo cian claro para días con tareas pendientes/registradas */
.dia-con-tarea-anual {
    background: #a5f3fc; /* Tono cian claro suave */
    border-radius: 50%;
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    font-weight: bold;
    color: #0000FF;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ----------------------------------------------------------------------------
   9. VENTANAS MODALES FLOTANTES (MODAL TAREA CENTRADA CON FLEXBOX Y FONDO CONTRASTADO)
   ---------------------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    /* Propiedades Flexbox para el centrado vertical y horizontal absoluto */
    align-items: center;
    justify-content: center;
}

.modal-contenido {
    background-color: #e2e8f0; /* Fondo gris para resaltar las cajas de datos blancas */
    margin: auto; /* Absorbe el espacio libre sobrante vertical y horizontalmente */
    padding: 22px 28px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid #94a3b8;
    position: relative;
    box-sizing: border-box;
}

.form-grupo {
    display: flex;
    flex-direction: column;
}

.form-grupo label {
    font-size: 0.82em;
    font-weight: bold;
    color: #475569;
    margin-bottom: 4px;
}

.form-grupo input[type="text"],
.form-grupo input[type="number"],
.form-grupo input[type="time"],
.form-grupo input[type="date"],
.form-grupo input[type="url"],
.form-grupo select,
.form-grupo textarea {
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.9em;
    outline: none;
    font-family: inherit;
}

/* Limitación de altura máxima a 8 líneas aproximadamente con scroll interno para Observaciones */
#observaciones {
    min-height: 50px;
    max-height: 160px; /* Equivale a unas 8 líneas de texto */
    overflow-y: auto;
    resize: vertical;
}

.form-grupo input:focus,
.form-grupo select:focus,
.form-grupo textarea:focus {
    border-color: #1d72f3;
}

.btn-cancelar {
    background: #cbd5e1;
    color: #334155;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-guardar {
    background: #1d72f3;
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.item-mantenimiento {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
}

.item-mantenimiento a {
    color: #ef4444;
    font-weight: bold;
    font-size: 0.85em;
}

/* Visor ampliado para imágenes capturadas */
#modal-visor-captura {
    z-index: 3000; /* Asegura posicionarse por encima del modal de tarea */
}

#vista-previa-captura:hover {
    opacity: 0.85;
    outline: 2px solid #1d72f3;
}

/* ==========================================
   FONDO GLOBAL DEL CONTENEDOR PRINCIPAL
   ========================================== */
/* Este color oscuro resalta el contenido blanco de todas las vistas */
body {
    background-color: #cbd5e1 !important; 
}

/* ==========================================
   TOOLTIP / VISTA PREVIA FLOTANTE DE TAREA (1 SEGUNDO HOVER)
   ========================================== */
#tooltip-tarea-previa {
    display: none;
    position: fixed;
    z-index: 2500;
    width: 380px;
    max-width: 90vw;
    background: #ffffff;
    border: 2px solid #1d72f3;
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    font-size: 0.9em;
    pointer-events: none; /* Permite que el ratón no se trabe con la tarjeta */
}