/* ========================================================================== */
/* CALENDARIO EMPLEADOS - Vista Anual para Control de Empleados              */
/* ========================================================================== */

/* ========================================================================== */
/* CONTENEDOR PRINCIPAL DEL CALENDARIO                                        */
/* ========================================================================== */

.calendario-empleados {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Header del calendario con navegación de año */
.calendario-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.calendario-year-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.calendario-year-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.calendario-year-btn:hover {
    background: linear-gradient(135deg, #F07400, #00b4ff);
    border-color: transparent;
    color: white;
    transform: scale(1.05);
}

.calendario-year-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.calendario-year-btn:disabled:hover {
    background: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
    transform: none;
}

.calendario-year-btn svg {
    width: 16px;
    height: 16px;
}

.calendario-year-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
    text-align: center;
}

/* Display de período laboral */
.calendario-periodo-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

.calendario-periodo-display .periodo-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: linear-gradient(135deg, #F07400, #00b4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calendario-periodo-display .periodo-rango {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Leyenda del calendario */
.calendario-leyenda {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.leyenda-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.leyenda-color.vacacion {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.leyenda-color.ausencia {
    background: linear-gradient(135deg, #eab308, #ca8a04);
}

.leyenda-color.retardo {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.leyenda-color.festivo {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 4px #00ff88;
}

/* ========================================================================== */
/* GRID DE MESES                                                              */
/* ========================================================================== */

.calendario-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 0;
}

.calendario-meses-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    height: fit-content;
}

/* ========================================================================== */
/* CARD DE MES                                                                */
/* ========================================================================== */

.calendario-mes-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.calendario-mes-header {
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.15), rgba(0, 180, 255, 0.15));
    padding: 0.35rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.calendario-mes-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendario-mes-body {
    padding: 0.5rem;
    flex: 1;
    overflow: visible;
}

/* Días de la semana */
.calendario-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.calendario-weekdays span {
    text-align: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 2px;
}

.calendario-weekdays span:last-child {
    color: var(--primary-color);
}

/* Grid de días */
.calendario-dias-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    overflow: visible;
}

/* ========================================================================== */
/* DÍAS DEL CALENDARIO                                                        */
/* ========================================================================== */

.calendario-dia {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 6px;
    position: relative;
    transition: all 0.15s ease;
    cursor: pointer;
    color: var(--text-primary);
    background: transparent;
}

.calendario-dia:hover:not(.dia-empty):not(.dia-disabled):not(.dia-vacacion):not(.dia-ausencia):not(.dia-retardo) {
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.15), rgba(0, 180, 255, 0.15));
    transform: scale(1.1);
    z-index: 5;
}

/* Tooltip personalizado para días festivos */
.calendario-dia.dia-festivo-tooltip {
    position: relative;
}

.calendario-dia .tooltip-festivo {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    pointer-events: none;
}

.calendario-dia .tooltip-festivo::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    border-radius: 50%;
    opacity: 0.3;
    filter: blur(6px);
}

.calendario-dia .tooltip-festivo::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #16213e;
}

.calendario-dia .tooltip-festivo .tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    border-radius: 50%;
    margin-right: 0.4rem;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.calendario-dia .tooltip-festivo .tooltip-icon svg {
    width: 10px;
    height: 10px;
    stroke: #0f3460;
    stroke-width: 3;
}

.calendario-dia .tooltip-festivo .tooltip-text {
    background: linear-gradient(90deg, #00ff88, #00cc6a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.calendario-dia:hover .tooltip-festivo {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* Efecto glow en hover del tooltip */
.calendario-dia:hover .tooltip-festivo::before {
    animation: tooltipGlow 1.5s ease-in-out infinite;
}

@keyframes tooltipGlow {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateX(-50%) scale(1.2); }
}

/* Modo claro para tooltip */
:root.light-mode .calendario-dia .tooltip-festivo,
.light-mode .calendario-dia .tooltip-festivo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.5);
}

:root.light-mode .calendario-dia .tooltip-festivo::after,
.light-mode .calendario-dia .tooltip-festivo::after {
    border-top-color: #764ba2;
}

/* ========================================================================== */
/* AJUSTE DE TOOLTIP EN BORDES IZQUIERDO Y DERECHO                            */
/* ========================================================================== */

/* Primera columna (Lunes) - mover tooltip a la derecha */
.calendario-dias-grid > .calendario-dia:nth-child(7n+1) .tooltip-festivo {
    left: 0;
    transform: translateX(0) scale(0.8);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n+1):hover .tooltip-festivo {
    transform: translateX(0) scale(1);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n+1) .tooltip-festivo::after {
    left: 12px;
    transform: translateX(0);
}

/* Segunda columna (Martes) - ajuste parcial */
.calendario-dias-grid > .calendario-dia:nth-child(7n+2) .tooltip-festivo {
    left: -10px;
    transform: translateX(0) scale(0.8);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n+2):hover .tooltip-festivo {
    transform: translateX(0) scale(1);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n+2) .tooltip-festivo::after {
    left: 22px;
    transform: translateX(0);
}

/* Última columna (Domingo) - mover tooltip a la izquierda */
.calendario-dias-grid > .calendario-dia:nth-child(7n) .tooltip-festivo {
    left: auto;
    right: 0;
    transform: translateX(0) scale(0.8);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n):hover .tooltip-festivo {
    transform: translateX(0) scale(1);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n) .tooltip-festivo::after {
    left: auto;
    right: 12px;
    transform: translateX(0);
}

/* Penúltima columna (Sábado) - ajuste parcial */
.calendario-dias-grid > .calendario-dia:nth-child(7n-1) .tooltip-festivo {
    left: auto;
    right: -10px;
    transform: translateX(0) scale(0.8);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n-1):hover .tooltip-festivo {
    transform: translateX(0) scale(1);
}

.calendario-dias-grid > .calendario-dia:nth-child(7n-1) .tooltip-festivo::after {
    left: auto;
    right: 22px;
    transform: translateX(0);
}

.calendario-dia.dia-empty {
    cursor: default;
}

.calendario-dia.dia-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Días fuera del período laboral */
.calendario-dia.dia-fuera-periodo {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.calendario-dia.dia-fuera-periodo:hover {
    transform: none;
    background: transparent;
}

/* Domingo */
.calendario-dia.dia-domingo {
    color: var(--primary-color);
    font-weight: 600;
}

/* Hoy */
.calendario-dia.dia-hoy {
    border: 2px solid var(--primary-color);
    font-weight: 700;
}

/* ========================================================================== */
/* TIPOS DE EVENTOS - COLORES                                                 */
/* ========================================================================== */

/* Vacaciones - Verde */
.calendario-dia.dia-vacacion {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    font-weight: 600;
}

/* Ausencia - Amarillo/Ámbar */
.calendario-dia.dia-ausencia {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: white;
    font-weight: 600;
}

/* Retardo - Rojo */
.calendario-dia.dia-retardo {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-weight: 600;
}

/* Indicador verde circular de día festivo - posicionado absoluto */
.indicador-festivo {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 5px #00ff88;
}

/* Selección activa */
.calendario-dia.dia-seleccionado {
    background: linear-gradient(135deg, #F07400, #00b4ff) !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(240, 116, 0, 0.4);
}

/* Rango de selección */
.calendario-dia.dia-en-rango {
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.3), rgba(0, 180, 255, 0.3));
    color: var(--text-primary);
}

/* ========================================================================== */
/* MODO CLARO                                                                  */
/* ========================================================================== */

:root.light-mode .calendario-mes-card,
.light-mode .calendario-mes-card {
    background: #ffffff;
}

:root.light-mode .calendario-body,
.light-mode .calendario-body {
    background: #e8e8e8;
}

/* ========================================================================== */
/* RESPONSIVE                                                                  */
/* ========================================================================== */

@media (max-width: 1200px) {
    .calendario-meses-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .calendario-meses-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .calendario-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .calendario-leyenda {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .calendario-meses-grid {
        grid-template-columns: 1fr;
    }

    .calendario-mes-card {
        min-height: 160px;
    }

    .calendario-dia {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .calendario-header {
        padding: 0.4rem 0.5rem;
    }

    .calendario-body {
        padding: 0.5rem;
    }

    .calendario-meses-grid {
        gap: 0.5rem;
    }

    .leyenda-item {
        font-size: 0.65rem;
    }

    .leyenda-color {
        width: 10px;
        height: 10px;
    }

    .calendario-year-display {
        font-size: 0.9rem;
    }
}
