/* /css/calendario.css */

/* --- VARIÁVEIS GLOBAIS --- */
:root {
    --primary-color: #0071e3;
    --primary-hover: #005bb5;
    --secondary-color: #555;
    --text-color: #333;
    --light-bg: #f9f9f9;
    --content-bg: #ffffff;
    --border-color: #e5e5e5;
    
    /* Cores Específicas do Calendário (Tela) */
    --weekend-bg: #f0f0f0;
    --weekend-text: #606060;
    --holiday-bg: #fce8e6;
    --holiday-text: #d93025;
    
    /* Cores do Modal - Contraste Reforçado e Ajustado */
    --modal-week-bg: #e8e8e8;
    --modal-week-text: #555;
    --modal-week-border: #ccc; 
    
    --modal-weekend-bg: #e4e4e4; 
    
    --modal-holiday-bg: #fff0f0;
    --widget-border-color: #d0d0d0; 
}

/* --- HEADER ESTILO APPLE --- */
.calendar-page-header {
    text-align: center;
    padding: 45px 20px 35px;
    background-color: var(--light-bg);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 24px;          
    margin-bottom: 40px;          
    max-width: 100%;              
    box-sizing: border-box;
}

.calendar-page-header h1 {
    margin: 0 auto;
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    max-width: 900px;
    width: 100%;
}

/* --- ESTILOS DO HUB (NOVO) --- */
.hub-cards-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
}

.hub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-color);
    min-width: 160px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    box-sizing: border-box; /* Importante para não estourar width */
}

.hub-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.hub-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-weight: 600;
}

.hub-year {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
}

/* Destaque para o Ano Atual no Hub */
.hub-card.current-year {
    border: 2px solid var(--primary-color);
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0, 113, 227, 0.15);
    padding: 30px;
}

.hub-card.current-year:hover {
    transform: scale(1.08);
    box-shadow: 0 15px 40px rgba(0, 113, 227, 0.25);
}

.hub-card.current-year .hub-year {
    color: var(--primary-color);
}

.hub-cta {
    margin-top: 15px;
    background-color: var(--primary-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Grid de Recursos do Hub */
.feature-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.feature-item .f-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* --- CONTROLES DE NAVEGAÇÃO (Página de Ano) --- */
.nav-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px; 
    flex-wrap: wrap; 
}

/* Correção Mobile: Navegação Ajustada para não vazar */
@media (max-width: 600px) {
    .nav-controls {
        flex-wrap: nowrap; /* Força linha única */
        gap: 8px; /* Reduzido de 10px para 8px */
        padding: 0; /* Remove padding lateral extra que causava estouro */
        width: 100%; 
        max-width: 100%;
        box-sizing: border-box;
        justify-content: space-between;
    }

    .nav-year-btn {
        min-width: 40px; /* Reduzido e fixado */
        width: 40px;
        height: 40px; /* Quadrado perfeito */
        padding: 0 !important; /* Força padding zero */
        font-size: 1.2rem;
        flex-shrink: 0; /* Garante que não esmague */
    }

    /* Oculta o TEXTO (ano) dos botões laterais, mantém só o ícone */
    .nav-year-btn span {
        display: none;
    }

    .year-selector-container {
        flex: 1; /* Ocupa o espaço que sobrar */
        width: auto;
        min-width: 0; /* CRÍTICO: Permite encolher abaixo do conteúdo mínimo se precisar */
        padding: 0 5px; /* Padding interno mínimo */
        margin: 0;
        height: 40px; /* Alinha altura com botões */
    }
    
    .current-year-display {
        font-size: 1.1rem;
        justify-content: center;
        white-space: nowrap;
        width: 100%;
    }
}

.nav-year-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 80px; 
    height: 44px;
    padding: 0 16px;
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nav-year-btn:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.nav-year-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: rgba(0,0,0,0.05);
    color: #999;
}

/* Seletor Central do Ano */
.year-selector-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    height: 44px;
    padding: 0 20px;
    min-width: 120px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.year-selector-container:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.current-year-display {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none; 
}

.dropdown-icon { font-size: 0.9rem; color: var(--secondary-color); }

.year-selector-container select {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
    font-size: 16px; appearance: none; -webkit-appearance: none;
}

/* --- BOTÕES DE AÇÃO --- */
.seo-actions-wrapper {
    text-align: center;
    width: 100%;
    clear: both;
    margin-top: 45px; 
    margin-bottom: 0; 
}

.calendar-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px; 
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: none;
    text-decoration: none;
    background-color: var(--primary-color);
    color: #fff !important; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.06); 
}

.btn-action:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}

.btn-action .icon { font-size: 1.2em; }
.btn-print { background-color: #333; }
.btn-print:hover { background-color: #000; }
.btn-share { background-color: #28a745; }
.btn-share:hover { background-color: #218838; }
.btn-custom-pdf { background-color: #dc3545; }
.btn-custom-pdf:hover { background-color: #c82333; }

/* --- GRID ANUAL DO CALENDÁRIO (HOME) --- */
#annual-calendar-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 1024px) {
    #annual-calendar-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.month-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    background-color: var(--content-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer; 
    position: relative;
    outline: none; /* Gerenciado via focus-visible */
}

/* Acessibilidade: Hover e Foco compartilham estilos de destaque */
.month-container:hover,
.month-container:focus {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: var(--primary-color);
}

/* Indicador visual específico para navegação por teclado */
.month-container:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.4);
    outline-offset: 2px;
}

.month-container:hover::after {
    content: "Ver detalhes 🔍";
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    pointer-events: none;
}

@keyframes fadeIn { to { opacity: 1; } }

.month-title {
    text-align: center;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-size: 1em;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 8px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.9em;
    gap: 3px;
    margin-bottom: 10px;
}

.calendar-header-day {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 0.75em;
    text-transform: uppercase;
    padding-bottom: 6px;
}

.calendar-day {
    padding: 5px 0;
    border-radius: 6px;
    font-size: 0.95em;
}

/* Cores Padrão (Tela Principal) */
.calendar-day.weekend {
    background-color: var(--weekend-bg);
    color: var(--weekend-text);
}

.calendar-day.holiday {
    color: var(--holiday-text);
    font-weight: 700;
    background-color: var(--holiday-bg);
    cursor: help;
}

.calendar-day.weekend.holiday {
    background-color: var(--holiday-bg);
    color: var(--holiday-text);
}

/* Lista de Feriados dentro do mês (Tela Principal) */
.month-holiday-list-screen {
    list-style: none;
    padding: 0;
    margin: auto 0 0 0;
    font-size: 0.8em;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
    color: var(--secondary-color);
}

.month-holiday-list-screen li {
    margin-bottom: 4px;
    line-height: 1.3;
}

.month-holiday-list-screen strong {
    color: var(--primary-color);
}

/* --- CONTEÚDO DINÂMICO E CARDS --- */
.dynamic-facts-box {
    background-color: var(--light-bg);
    border-left: 4px solid var(--primary-color);
    padding: 20px 25px;
    border-radius: 8px;
    margin: 30px 0;
}

.dynamic-facts-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.2em;
}

/* NOVOS LINKS INTERATIVOS (Bonitos) */
.holiday-click-link {
    text-decoration: none;
    color: inherit;
    font-weight: inherit;
    border-bottom: 1px dashed rgba(0,0,0,0.3); /* Borda sutil */
    transition: all 0.2s ease;
    cursor: pointer;
}

.holiday-click-link:hover {
    color: var(--primary-color) !important;
    background-color: rgba(0, 113, 227, 0.08); /* Fundo leve azul */
    border-bottom-style: solid;
    border-bottom-color: transparent; /* Remove borda inferior no hover */
    border-radius: 4px;
    padding: 1px 4px;
    margin: 0 -4px; /* Compensa o padding */
    box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.1);
}

/* --- CARDS LUNARES (Resumo) --- */
.lunar-year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.lunar-month-card {
    background-color: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.lunar-month-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.lunar-month-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 8px;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.lunar-phase-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.05);
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.lunar-phase-row:last-child { border-bottom: none; }
.lunar-icon { font-size: 1.2rem; margin-right: 8px; width: 25px; text-align: center; }
.lunar-info { display: flex; flex-direction: column; line-height: 1.2; }
.lunar-name { font-weight: 600; color: #444; }
.lunar-date { font-size: 0.8em; color: #888; }
.lunar-phase-row.is-full-moon .lunar-name { color: var(--holiday-text); }

/* Lista de Feriados (Grid Style) */
.holiday-grid-style ul {
    display: flex; flex-direction: column; gap: 10px;
    list-style: none; padding: 0;
}

.holiday-grid-style li {
    border-bottom: 1px dotted var(--border-color);
    padding: 8px 0;
    display: flex; align-items: baseline;
    font-size: 1em;
}

.holiday-grid-style li:last-child { border-bottom: none; }

.holiday-date {
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 12px;
    min-width: 55px;
}

/* Ferramentas Relacionadas */
.related-tools-section {
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
}

.related-tools-section h3 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-color);
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.tool-card.featured-card {
    border-color: var(--primary-color);
    background: linear-gradient(to right, var(--content-bg), var(--light-bg));
}

.tool-icon { font-size: 2.2em; }
.tool-info { display: flex; flex-direction: column; }
.tool-title { font-weight: 700; font-size: 1.1em; margin-bottom: 4px; color: var(--primary-color); }
.tool-desc { font-size: 0.9em; color: var(--secondary-color); line-height: 1.4; }

/* --- NAVEGAÇÃO ENTRE ANOS (Rodapé) --- */
.years-navigation-section {
    margin-top: 40px;
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
}

.years-navigation-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.years-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.year-grid-item {
    display: inline-block;
    padding: 10px 20px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 60px;
}

.year-grid-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    color: var(--primary-color);
}

.year-grid-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.year-grid-item.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    pointer-events: none; /* Desabilita clique no ano atual */
}

/* --- MODAL DE DETALHES DO MÊS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    /* Z-Index Supremo para garantir que cubra qualquer header/menu */
    z-index: 2147483647;
    display: flex; align-items: center; justify-content: center;
    padding: 10px; box-sizing: border-box;
    opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-backdrop {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
}

/* CONTAINER DO MODAL: RESTAURADO PARA 900PX (Widgets Soltos) */
.modal-container {
    position: relative; background: #fff; width: 100%; 
    max-width: 900px; /* Restaurado para dar espaço aos widgets */
    max-height: 95vh;
    border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); overflow-y: auto;
    transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 2;
    display: flex; flex-direction: column;
}

.modal-overlay.open .modal-container { transform: scale(1); }

/* BOTÃO FECHAR (X) - Posicionamento Absoluto na Direita */
.modal-close-btn {
    position: absolute; 
    top: 50%; /* Centraliza Verticalmente no Header */
    transform: translateY(-50%);
    right: 20px; 
    background: none; border: none;
    font-size: 2.5rem; line-height: 1; color: #666; cursor: pointer; z-index: 20;
    transition: color 0.2s;
    padding: 0;
    height: auto;
}
.modal-close-btn:hover { color: #000; }
.modal-close-btn:focus {
    outline: 2px solid var(--primary-color);
    border-radius: 4px;
    color: #000;
}

/* MODAL HEADER: Navegação Centralizada */
.modal-header-content {
    padding: 20px 30px; 
    border-bottom: 1px solid #eee; 
    background: #f9f9f9; 
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center; /* Centraliza o bloco de navegação */
    gap: 20px; /* Espaço entre setas e título */
    position: relative; /* Referência para o botão X */
}

.modal-month-title {
    font-size: 1.8rem; color: var(--primary-color); margin: 0; text-transform: uppercase; font-weight: 700;
    text-align: center;
    flex-grow: 0; /* Não estica, fica no tamanho do texto */
    line-height: 1;
    min-width: 220px; /* Largura mínima para evitar pulo na troca de mês */
}

.modal-nav-btn {
    background: none; border: none; color: var(--primary-color); font-size: 2.5rem;
    cursor: pointer; padding: 0 10px; transition: transform 0.2s, color 0.2s; user-select: none;
    height: 40px; 
    display: flex; align-items: center; justify-content: center; /* Centraliza a seta verticalmente */
    line-height: 1;
    border-radius: 4px;
}
.modal-nav-btn:hover { color: var(--primary-hover); transform: scale(1.2); }
.modal-nav-btn:focus { outline: 2px solid var(--primary-color); }

.modal-body-grid {
    display: flex; flex-direction: column; 
    width: 100%;
    /* Ocupa o restante do espaço */
    flex-grow: 1; 
}

/* NOVO RODAPÉ FIXO (Faixa "Fechar") */
.modal-footer-bar {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    text-align: center;
    flex-shrink: 0; /* Não encolhe */
}

.btn-close-modal-action {
    display: inline-block;
    width: 100%;
    max-width: 300px;
    background: transparent; 
    border: 2px solid #666; 
    color: #444;
    padding: 10px 30px; 
    border-radius: 30px; 
    font-weight: 700; 
    cursor: pointer;
    transition: all 0.2s; 
    font-size: 0.95em;
}

.btn-close-modal-action:hover {
    background: #333; 
    color: #fff; 
    border-color: #333;
}

/* ÁREA DO MÊS (AJUSTADA: CONTORNO E LARGURA PROPORCIONAL AO CENTRO) */
.modal-calendar-section {
    padding: 25px; 
    margin: 20px auto 0; /* Centralizado Horizontalmente */
    max-width: 580px; /* Mantém calendário compacto */
    width: 95%; /* Garante que não estoure em telas pequenas */
    border: 1px solid var(--widget-border-color); 
    border-radius: 12px; 
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    box-sizing: border-box;
}

/* Grid do Modal (Desktop Padrão) */
.modal-cal-grid {
    display: grid;
    /* Coluna 1: Semana (Larga) | Gap | Colunas 2-8: Dias */
    grid-template-columns: 70px 15px repeat(7, 1fr);
    gap: 5px 0; text-align: center; align-items: stretch;
}

.modal-cal-header {
    font-weight: bold; color: #666; padding-bottom: 8px;
    text-transform: uppercase; font-size: 0.8rem;
    display: flex; align-items: flex-end; justify-content: center;
}

/* Coluna SEMANA (Destaque Físico + Linha) */
.modal-week-num {
    background-color: var(--modal-week-bg); color: var(--modal-week-text);
    font-size: 0.75rem; font-weight: 600;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 4px; height: 100%; text-align: center; line-height: 1.2;
    border: 1px solid rgba(0,0,0,0.05);
    border-right: 2px solid var(--modal-week-border); /* Linha Separadora */
}

.modal-week-label { font-size: 0.6em; text-transform: uppercase; margin-bottom: 2px; }

/* Dia no Modal */
.modal-day {
    min-height: 50px; 
    border: 1px solid #eee; border-radius: 6px;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 4px 6px; font-size: 1rem; position: relative;
    background: #fff; margin: 0 3px;
    transition: transform 0.1s;
}

.modal-day:hover { transform: scale(1.05); z-index: 2; border-color: var(--primary-color); }

/* CORREÇÃO MOBILE PARA O MODAL (REMOÇÃO DA SEMANA + AJUSTE DE LARGURA) */
@media (max-width: 768px) {
    .modal-header-content {
        padding: 15px 10px;
        gap: 10px; /* Gap menor no mobile */
    }
    
    .modal-month-title {
        font-size: 1.3rem;
        min-width: auto; /* Título flexível no mobile */
    }
    
    .modal-nav-btn {
        font-size: 2rem;
        padding: 0 5px;
    }
    
    .modal-close-btn {
        font-size: 2rem;
        right: 10px;
    }
    
    .modal-calendar-section {
        padding: 10px; /* Reduz padding lateral */
        margin: 10px auto 0; /* Centraliza no mobile também */
        max-width: 90%; /* Largura confortável, estilo card */
        border-radius: 8px;
    }

    /* Redefine grid para apenas 7 colunas (Dias da semana) */
    .modal-cal-grid {
        grid-template-columns: repeat(7, 1fr) !important; 
        gap: 2px;
    }

    /* ESCONDE COMPLETAMENTE A COLUNA DE SEMANA */
    .modal-week-num, 
    .modal-week-label,
    .modal-grid-spacer {
        display: none !important;
    }

    /* Esconde os cabeçalhos específicos da coluna semana e do espaçador */
    /* Assumindo que são os dois primeiros elementos diretos */
    .modal-cal-grid > .modal-cal-header:first-child,
    .modal-cal-grid > .modal-grid-spacer:nth-child(2) {
        display: none !important;
    }

    .modal-day {
        min-height: 45px;
        font-size: 0.85rem;
        padding: 2px 0; /* Remove padding lateral */
    }
    
    .day-moon-icon {
        font-size: 0.7rem;
    }
}

/* CONTRASTE NO MODAL (FORTE) */
.modal-day.weekend { 
    background-color: var(--modal-weekend-bg) !important; 
    color: var(--weekend-text) !important; 
    border-color: #dcdcdc;
}
.modal-day.holiday {
    background-color: var(--modal-holiday-bg) !important; 
    color: var(--holiday-text) !important;
    font-weight: bold;
    border-color: #ffcccc;
}
.modal-day.today { border: 2px solid var(--primary-color); }

.day-moon-icon { font-size: 0.8rem; align-self: flex-end; line-height: 1; }

/* Widgets Embaixo */
.modal-widgets-section {
    padding: 25px 30px; background-color: #fafafa;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .modal-widgets-section {
        padding: 15px; /* Reduz padding no mobile */
    }
}

.modal-widget {
    background: #fff; border-radius: 12px;
    padding: 15px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    border: 1px solid var(--widget-border-color); 
}

/* Bordas Coloridas Laterais */
.widget-summary { border-left: 4px solid var(--primary-color); }
.widget-moons { border-left: 4px solid #6f42c1; }
.widget-holidays { border-left: 4px solid #d93025; }
.widget-seasons { border-left: 4px solid #fd7e14; }

.widget-title {
    font-size: 0.95rem; font-weight: 700; color: var(--secondary-color);
    margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
    border-bottom: 2px solid #f0f0f0; padding-bottom: 6px;
}

.widget-fact-row {
    display: flex; justify-content: space-between; padding: 6px 0;
    border-bottom: 1px dashed #eee; font-size: 0.9rem;
}
.widget-fact-row:last-child { border: none; }
.wf-label { color: #555; }
.wf-value { font-weight: bold; color: var(--primary-color); }

.widget-moon-list { list-style: none; padding: 0; margin: 0; }
.widget-moon-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px dashed #eee; font-size: 0.85rem;
}
.widget-moon-item:last-child { border: none; }
.w-moon-icon { font-size: 1rem; margin-right: 8px; }

.widget-holiday-item {
    padding: 6px 0; font-size: 0.85rem; color: #444; border-bottom: 1px solid #eee;
}
.w-holiday-date { color: var(--holiday-text); font-weight: bold; margin-right: 5px; }

/* --- IMPRESSÃO (ALTO CONTRASTE) --- */
@media print {
    /* Esconde elementos indesejados */
    .no-print, header, footer, .cookie-consent-banner, .theme-toggle-button, .back-to-top, .modal-overlay { 
        display: none !important; 
    }
    
    /* REFORÇA: Exibe o cabeçalho (título H1) que tem .no-print */
    .calendar-page-header.no-print {
        display: block !important;
        background: transparent !important;
        border: none !important;
        padding: 0 0 20px 0 !important;
        margin: 0 !important;
    }
    
    /* Esconde controles dentro do cabeçalho */
    .calendar-page-header .nav-controls,
    .calendar-page-header .seo-actions-wrapper,
    .calendar-page-header p {
        display: none !important;
    }

    /* Garante H1 visível */
    .calendar-page-header h1 {
        display: block !important;
        font-size: 24pt !important;
        color: #000 !important;
        text-align: center;
        margin: 0 !important;
    }

    /* Corpo principal */
    body { 
        background: white; 
        margin: 0; 
        padding: 1cm; 
        color: #000;
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
    }

    /* Garante o GRID de 3 colunas para os meses */
    #annual-calendar-container {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
        margin-bottom: 20px !important;
    }

    /* Cores de impressão */
    .calendar-day.weekend { 
        background-color: #e0e0e0 !important; 
        color: #000000 !important; 
        border-radius: 4px !important; 
    }
    .calendar-day.holiday { 
        background-color: #e0e0e0 !important; 
        color: #d93025 !important; 
        font-weight: bold !important; 
        border-radius: 4px !important; 
    }
    
    /* Remove estilos dos novos links na impressão */
    .holiday-click-link {
        text-decoration: none !important;
        border-bottom: none !important;
        color: inherit !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
    
    .month-container { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
    .calendar-grid { gap: 1px !important; }
}

/* --- ESTILOS DO PLANEJAMENTO MENSAL (NOVO) --- */
.monthly-planning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.monthly-planning-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e1e1e6);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.monthly-planning-month-title {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color, #f0f0f5);
    padding-bottom: 8px;
    margin-bottom: 2px;
}

.planning-btn {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.planning-btn.business-days {
    background: rgba(0, 113, 227, 0.05);
    color: var(--primary-color, #0071e3);
    border: 1px solid rgba(0, 113, 227, 0.1);
}

.planning-btn.fifth-day {
    background: rgba(52, 199, 89, 0.05);
    color: #34c759;
    border: 1px solid rgba(52, 199, 89, 0.1);
}

.planning-btn:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

/* --- DARK MODE --- */
body.dark-mode .calendar-page-header { background-color: #1c1c1e; border-color: #333; }
body.dark-mode .nav-year-btn, body.dark-mode .year-selector-container { background-color: #2c2c2e; border-color: #444; color: #fff; }
body.dark-mode .nav-year-btn:hover, body.dark-mode .year-selector-container:hover { border-color: var(--primary-color); }
body.dark-mode .current-year-display { color: #fff; }
body.dark-mode .year-select-wrapper select option { background-color: #2c2c2e; color: #fff; }
body.dark-mode .calendar-day.weekend { background-color: #2c2c2e; color: #aaa; }
body.dark-mode .calendar-day.holiday { color: #ff6b6b; background-color: #3e1f1f; }
body.dark-mode .calendar-day.weekend.holiday { background-color: #3e1f1f; color: #ff6b6b; }
body.dark-mode .dynamic-facts-box { background-color: #2c2c2e; border-left-color: #0a84ff; }
body.dark-mode .tool-card { background: #2c2c2e; border-color: #444; }
body.dark-mode .tool-card:hover { border-color: #7abaff; }
body.dark-mode .tool-card.featured-card { background: linear-gradient(to right, #2c2c2e, #3a3a3c); border-color: #0a84ff; }

/* Dark Mode - Links Interativos */
body.dark-mode .holiday-click-link { border-bottom-color: rgba(255,255,255,0.3); }
body.dark-mode .holiday-click-link:hover { background-color: rgba(10, 132, 255, 0.15); color: #fff !important; }

/* Dark Mode - Modal */
body.dark-mode .lunar-month-card { background-color: #2c2c2e; border-color: #444; }
body.dark-mode .lunar-name { color: #ddd; }
body.dark-mode .lunar-phase-row { border-bottom-color: #444; }
body.dark-mode .lunar-month-title { border-bottom-color: #444; color: #fff; }
body.dark-mode .modal-container { background: #1c1c1e; }
body.dark-mode .modal-header-content { background: #2c2c2e; border-color: #333; }
body.dark-mode .modal-calendar-section { border-color: #333; background-color: #2c2c2e; }
body.dark-mode .modal-widgets-section { background: #242426; border-top-color: #333; }
body.dark-mode .modal-widget { background: #2c2c2e; border-color: #333; }
body.dark-mode .modal-day { background: #2c2c2e; border-color: #333; color: #fff; }
body.dark-mode .modal-day.weekend { background: #3a3a3c; color: #aaa; border-color: #444; }
body.dark-mode .modal-day.holiday { background: #3e1f1f; color: #ff6b6b; border-color: #662222; }
body.dark-mode .modal-week-num { background: #333; color: #777; border-color: #444; }
body.dark-mode .widget-title { color: #bbb; border-color: #333; }
body.dark-mode .widget-moon-item { color: #ddd; border-color: #333; }
body.dark-mode .widget-fact-row { border-color: #333; }
body.dark-mode .wf-label { color: #aaa; }

/* Dark Mode - Planejamento Mensal */
body.dark-mode .monthly-planning-card { background-color: #2c2c2e; border-color: #444; }
body.dark-mode .monthly-planning-month-title { color: #fff; border-bottom-color: #444; }
body.dark-mode .planning-btn.business-days { background: rgba(10, 132, 255, 0.15); color: #64d2ff; border-color: rgba(10, 132, 255, 0.3); }
body.dark-mode .planning-btn.fifth-day { background: rgba(48, 209, 88, 0.15); color: #30d158; border-color: rgba(48, 209, 88, 0.3); }
body.dark-mode .planning-btn:hover { filter: brightness(1.2); }

/* Correção para o X ficar visível no Dark Mode */
body.dark-mode .modal-close-btn { color: #fff !important; }
body.dark-mode .modal-nav-btn { color: #fff; }

/* Dark Mode - Novo Rodapé "Fechar" */
body.dark-mode .modal-footer-bar {
    background: #252525;
    border-top-color: #333;
}
body.dark-mode .btn-close-modal-action {
    color: #ccc;
    border-color: #666;
}
body.dark-mode .btn-close-modal-action:hover {
    background: #eee;
    color: #000;
}

/* Dark Mode - Navegação de Anos */
body.dark-mode .years-navigation-section { background-color: #2c2c2e; border-color: #444; }
body.dark-mode .year-grid-item { background-color: #1c1c1e; border-color: #444; color: #ddd; }
body.dark-mode .year-grid-item:hover { border-color: var(--primary-color); color: #fff; }
body.dark-mode .year-grid-item.active { background-color: var(--primary-color); color: #fff; }

/* Dark Mode - Novo Hub */
body.dark-mode .hub-card { background-color: #2c2c2e; border-color: #444; color: #ddd; }
body.dark-mode .hub-card:hover { border-color: var(--primary-color); color: #fff; }
body.dark-mode .hub-year { color: #fff; }
body.dark-mode .hub-label { color: #aaa; }
body.dark-mode .hub-card.current-year { border-color: var(--primary-color); background-color: #333; }
body.dark-mode .feature-item { background-color: #2c2c2e; border-color: #444; color: #ccc; }

/* --- CORREÇÕES ESTRUTURAIS MODAL (Jan/2026) --- */

/* 1. Modal com Rodapé Fixo (Scroll Interno) */
/* Define o container como Flex Column e remove o scroll global dele */
.modal-container {
    overflow: hidden !important; 
    display: flex !important;
    flex-direction: column !important;
    max-height: 95vh !important; /* Garante margem segura */
    height: 95vh; /* Força altura em telas grandes também para manter padrão */
}

/* Faz com que APENAS o corpo (calendário + widgets) tenha rolagem */
.modal-body-grid {
    overflow-y: auto !important;
    flex-grow: 1 !important; /* Ocupa todo o espaço sobrando */
    -webkit-overflow-scrolling: touch; /* Rolagem suave no iOS */
    height: auto !important;
    display: block !important; /* Garante block para scroll funcionar bem */
}

/* Garante que o Header não encolha */
.modal-header-content {
    flex-shrink: 0 !important;
}

/* Garante que o Rodapé fique fixo no fundo do container Flex */
.modal-footer-bar {
    flex-shrink: 0 !important; /* Não deixa o rodapé sumir */
    position: relative !important;
    z-index: 10;
    width: 100%;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05); /* Sombra para destacar do conteúdo */
}

/* Ajuste visual para Mobile */
@media (max-width: 768px) {
    .modal-container {
        height: 90vh !important; /* Ocupa 90% da altura da tela */
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important; /* Arredonda só em cima (estilo bottom sheet) */
        position: absolute;
        bottom: 0;
    }
    
    .modal-overlay {
        align-items: flex-end !important; /* Alinha modal no rodapé da tela */
        padding: 0 !important;
    }

    .modal-footer-bar {
        padding-bottom: max(15px, env(safe-area-inset-bottom)); /* Proteção para iPhone X+ */
    }

    /* --- REORDENAÇÃO MOBILE INTELIGENTE DO HUB (Jan/2026) --- */
    
    /* 1. Transformar o container em Flexbox Vertical */
    .hub-cards-container {
        flex-direction: column !important; /* Força coluna */
        align-items: center !important;
    }
    
    .hub-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box; /* CRUCIAL para não estourar width */
    }

    /* 2. REORDENAÇÃO VIA ORDER (Flexbox) */
    
    /* MODO PADRÃO (Jan a Nov): Destaque (Atual) no Topo, Futuro depois */
    .hub-cards-container.hub-standard .hub-card.current-year { 
        order: 1; 
        transform: scale(1); /* Remove zoom no mobile para não cortar */
        margin: 0; /* Remove margem extra de zoom */
    }
    .hub-cards-container.hub-standard .hub-card.next-year    { order: 2; }
    .hub-cards-container.hub-standard .hub-card.prev-year    { order: 3; }

    /* MODO DEZEMBRO: Futuro no Topo, Atual depois */
    .hub-cards-container.hub-december .hub-card.next-year    { order: 1; }
    .hub-cards-container.hub-december .hub-card.current-year { 
        order: 2; 
        transform: scale(1);
        margin: 0;
    }
    .hub-cards-container.hub-december .hub-card.prev-year    { order: 3; }

    /* Destaque visual para o primeiro item (independente de qual seja) */
    .hub-cards-container .hub-card:first-child {
        border-color: var(--primary-color);
        background-color: var(--light-bg); /* Use variável para consistência */
    }
}

/* Reforço Dark Mode para a sombra do rodapé fixo */
body.dark-mode .modal-footer-bar {
    box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
}