/* ===== CALENDÁRIO MODERNO ===== */
.calendar-container {
    padding: 0 10px;
    margin-bottom: 10px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
    /* background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%); */
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: radial-gradient(1200px 900px at 20% 10%, rgba(124,58,237,.35), transparent 55%),
              radial-gradient(1000px 700px at 80% 20%, rgba(6,182,212,.28), transparent 50%),
              linear-gradient(180deg, var(--bg1), var(--bg2));

    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* HEADERS ESTÁTICOS - VERSÃO FINAL CORRIGIDA */
.day-header {
    font-weight: 700;
    background: linear-gradient(135deg, var(--gray-600) 0%, var(--gray-500) 100%) !important;
    color: var(--white) !important;
    text-align: center;
    min-height: 30px !important; /* Reduzido de 45px para 30px */
    padding: 8px 4px !important; /* Reduzido de 12px 5px */
    border-radius: 10px; /* Ligeiramente menor */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); /* Sombra mais suave */
    font-size: 0.8rem; /* Texto um pouco menor */
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.3px; /* Reduzido */
    cursor: default;
    user-select: none;
    pointer-events: none;
}

/* DIAS NORMAIS */
.day {
    border: none;
    padding: 12px 8px;
    min-height: 100px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.day::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-900));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.day:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.12),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.day:hover::before {
    opacity: 1;
}

.day:active {
    transform: translateY(-1px);
    transition: transform 0.1s;
}

/* TEXTO DENTRO DOS DIAS */
.day strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--gray-800);
}

.day p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--gray-600);
}

.day p strong {
    display: inline;
    font-size: 0.75rem;
    font-weight: 600;
}

/* CORES DE STATUS */
.calendar .day.disponivel { 
    /* background: linear-gradient(135deg, #f2fdfb 40%, #caf7ef 100%, #f2fdfb 40%); */
    
background: -webkit-linear-gradient(90deg, #fbf8cc,#98f5e1);
background: linear-gradient(90deg, #fbf8cc,#98f5e1);  

border: 2px solid var(--success-100);
}

/* .calendar .day.disponivel::before {
    background: linear-gradient(90deg, #38b2ac, #319795);
    opacity: 1;
} */

.calendar .day.indisponivel { 
    /* background: linear-gradient(135deg, #fff5f5 40%, #f8d0d0 100%, #fff5f5 40%); */
background: -webkit-linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
background: linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
    
}

.calendar .day.empty { 
    background: rgba(237, 242, 247, 0.5);
    cursor: default;
    border: 2px dashed #cbd5e0;
    box-shadow: none;
}

.calendar .day.empty:hover {
    transform: none;
    box-shadow: none;
}

/* DIAS COM MARCAÇÕES DO UTILIZADOR */
.day[data-date] {
    position: relative;
}

.day.has-bookings::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--success-500);
    border-radius: 50%;
    box-shadow: 0 0 0 2px white;
}

/* ANIMAÇÃO DE DESTAQUE */
@keyframes pulse-gentle {
    0%, 100% { 
        box-shadow: 
            0 4px 15px rgba(0, 0, 0, 0.08),
            0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% { 
        box-shadow: 
            0 4px 15px rgba(0, 0, 0, 0.08),
            0 0 0 8px rgba(102, 126, 234, 0);
    }
}

.highlight-day {
    animation: pulse-gentle 2s ease-in-out infinite;
    border: 2px solid var(--primary-500) !important;
}

/* LEGENDA MODERNA */
.legend-modern {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-color.disponivel { 
    /* background: linear-gradient(135deg, #f2fdfb 0%, #caf7ef 100%); */
background: -webkit-linear-gradient(90deg, #fbf8cc,#98f5e1);
background: linear-gradient(90deg, #fbf8cc,#98f5e1);

    border: 1px solid var(--success-100);
}
.legend-color.indisponivel { 
background: -webkit-linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
background: linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
}
.legend-color.nao-aplicavel { 
    background: rgba(237, 242, 247, 0.8);
    border: 1px dashed #cbd5e0;
}

/* ===== RESPONSIVE MOBILE FIRST ===== */
@media (max-width: 768px) {
    .calendar {
        gap: 4px;
        padding: 10px;
        border-radius: 16px;
    }
    
    .day {
        min-height: 80px;
        padding: 8px 4px;
        border-radius: 12px;
    }
    
    .day-header {
        min-height: 25px !important; /* Ainda mais compacto em mobile */
        padding: 6px 3px !important; /* Menos padding */
        font-size: 0.75rem; /* Texto menor */
        border-radius: 8px; /* Cantos mais suaves */
        letter-spacing: 0.2px;
    }
    
    .day strong {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    
    .day p {
        font-size: 0.7rem;
    }
.calendar .day.disponivel p {
 font-size: 0.5rem;
}

.calendar .day.indisponivel p {
 font-size: 0.5rem;
}
    
    .legend-modern {
        gap: 10px;
    }
    
    .legend-item {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .calendar {
        grid-template-columns: repeat(6, 1fr);
        gap: 3px;
        padding: 8px;
    }
    .day-header {
        min-height: 20px !important; /* Mínimo possível */
        padding: 5px 2px !important; /* Mínimo padding */
        font-size: 0.7rem; /* Texto muito compacto */
    }    
    .day {
        min-height: 70px;
        padding: 6px 2px;
    }
    
    .day strong {
        font-size: 0.9rem;
    }
    
    .day p {
        font-size: 0.65rem;
    }
}

/* ESTADO DE CARREGAMENTO */
.calendar.loading {
    opacity: 0.9;
    pointer-events: none;
}

.calendar.loading::after {
    content: 'A carregar...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-500);
    font-weight: 600;
}

/* ===== CALENDAR STATUS COLORS transitado do my_shedules.php ===== */
/* .calendar .day.disponivel {
    background: linear-gradient(135deg, #f2fdfb 0%, #caf7ef 100%);
    border: 2px solid var(--success-100);
} */

.calendar .day.ferias {
    /* background: linear-gradient(135deg, #f5f5e3 40%, #f8f7cc 100%, #f5f5e3 40%); */

background: -webkit-linear-gradient(90deg, #d3b791,#ffffff);
background: linear-gradient(90deg, #d3b791,#ffffff);

    border: 1px solid #f8f7cc;
}

.calendar .day.ausencia {
    /* background: linear-gradient(135deg, #faf5ff 40%, #e9d8fd 100%, #faf5ff 40%); */

background: -webkit-linear-gradient(90deg, #8ca3cc,#a893bc,#8ca3cc);
background: linear-gradient(90deg, #8ca3cc,#a893bc,#8ca3cc);

    border: 1px solid #d6bcfa;
}

/* .calendar .day.indisponivel {
    background: linear-gradient(135deg, #fff5f5 0%, #f8d0d0 100%);
    border: 1px solid var(--danger-100);
} */

.calendar .day.indisponivel.past {
background: -webkit-linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
background: linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);


}

/* Legend Colors */
.legend-color.disponivel {
    /* background: linear-gradient(135deg, #f2fdfb 0%, #caf7ef 100%); */

background: -webkit-linear-gradient(90deg, #fbf8cc,#98f5e1);
background: linear-gradient(90deg, #fbf8cc,#98f5e1);

    border: 1px solid var(--success-100);
}

.legend-color.ferias {
    /* background: linear-gradient(135deg, #f5f5e3 0%, #f8f7cc 100%); */
background: -webkit-linear-gradient(90deg, #d3b791,#ffffff);
background: linear-gradient(90deg, #d3b791,#ffffff);
    border: 1px solid var(--success-100);
}

.legend-color.ausencia {
    /* background: linear-gradient(135deg, #faf5ff 0%, #e9d8fd 100%); */
background: -webkit-linear-gradient(90deg, #8ca3cc,#a893bc,#8ca3cc);
background: linear-gradient(90deg, #8ca3cc,#a893bc,#8ca3cc);

    border: 1px solid var(--success-100);
}

.legend-color.indisponivel {
background: -webkit-linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
background: linear-gradient(90deg, #a2a49f,#e0d0c4,#f1dac4);
}

.legend-color.nao-aplicavel {
    background: rgba(237, 242, 247, 0.8);
    border: 1px solid var(--success-100);
}