/* Variáveis de Cor e Configurações Globais */
:root {
    /* Tema Claro (Padrão) */
    --primary-color: #007bff;
    --primary-color-dark: #0056b3;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --medium-gray: #dee2e6;
    --dark-gray: #343a40;
    --text-color: #212529;
    --text-color-muted: #6c757d;
    --white: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --focus-ring-color: rgba(0, 123, 255, 0.5);
    --highlight-background-color: #e6f7ff;
    --highlight-shadow-color: rgba(0, 86, 179, 0.5);
}

/* Tema Escuro (ativado via classe .dark-mode no <html>) */
:root.dark-mode {
    --primary-color: #3eadff;
    --primary-color-dark: #007bff;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-color-muted: #888;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --focus-ring-color: rgba(62, 173, 255, 0.6);
    --highlight-background-color: rgba(62, 173, 255, 0.1);
    --highlight-shadow-color: rgba(62, 173, 255, 0.4);
}

/* Estilos Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Cabeçalho */
.main-header {
    background-color: var(--surface-color);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--medium-gray);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.main-header h1 {
    margin: 0;
    margin-top: 1rem;
    color: var(--text-color);
    text-align: center;
}

.back-link {
    text-align: left;
    margin: 0;
}

.back-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* Melhoria de Acessibilidade: Estilo de Foco */
.back-link a:focus-visible,
.button:focus-visible,
#theme-toggle:focus-visible {
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    outline: none;
}

/* Conteúdo Principal */
.main-container {
    max-width: 1600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.columns-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.button-column {
    flex: 1;
    min-width: 300px;
    max-width: 350px;
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px var(--shadow-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Animação de entrada */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out,
                box-shadow 0.3s ease, filter 0.3s ease;
}

.column-title {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 2px solid var(--background-color);
    padding-bottom: 0.75rem;
}

/* Classe para ativar a animação quando o elemento está visível */
.button-column.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Estilos dos Botões de Cardápio */
.button {
    display: block;
    text-decoration: none;
    color: var(--white);
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease;
    border: 1px solid transparent;
}

.button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Cores específicas dos botões */
.creche-m-verde { background-color: #28a745; }
.creches { background-color: #17a2b8; }
.fundamental-braga { background-color: #ffc107; color: var(--text-color); }
.fundamental-anna { background-color: #fd7e14; }
.fundamental-aaugusto { background-color: #dc3545; }
.fundamental-esther { background-color: #6f42c1; }
.fundamental-gtl { background-color: #6610f2; }
.etec { background-color: #343a40; }

/* Destaque de Semanas */
.current-week {
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 12px var(--highlight-shadow-color);
  transform: scale(1.02);
  background-color: var(--highlight-background-color);
}

.past-week {
  opacity: 0.65;
  filter: grayscale(80%);
}

.past-week:hover {
  opacity: 1;
  filter: grayscale(0%);
}

/* Adiciona um ícone na semana atual */
.current-week .column-title::before {
    content: '🗓️ ';
    margin-right: 8px;
}

.past-week .column-title::before {
    content: '✅ ';
    margin-right: 5px;
}

/* Rodapé */
.main-footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    background-color: var(--surface-color);
    color: var(--text-color-muted);
    font-size: 0.9rem;
}

/* Botão "Voltar ao Topo" */
#back-to-top {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 99;
  border: none;
  outline: none;
  background-color: var(--primary-color);
  color: var(--white);
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  line-height: 50px;
  text-align: center;
  box-shadow: 0 4px 8px var(--shadow-color);
  transition: opacity 0.3s, visibility 0.3s;
}

#back-to-top:hover {
  background-color: var(--primary-color-dark);
}

#back-to-top.show {
  display: block;
}

/* Media Queries para Responsividade */
@media (max-width: 768px) {
    .main-header {
        padding: 1rem;
    }

    .main-container {
        margin: 1rem auto;
    }

    .button-column {
        max-width: 100%;
    }

    #back-to-top {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        line-height: 45px;
        font-size: 20px;
    }
}

/* Estilos do Seletor de Tema */
#theme-toggle {
    background: none;
    border: 1px solid var(--medium-gray);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, border-color 0.2s;
}

#theme-toggle:hover {
    background-color: var(--background-color);
}