/* --- 1. Reset e Variáveis de Tema --- */
:root {
    --cor-primaria: #00aaff;
    --cor-secundaria: #0077cc;
    --cor-fundo: #121212;
    --cor-texto: #ffffff;
    --cor-fundo-card: #1e1e1e;
    /* --background-url: url('imagens/backg.png'); */
    --background-url: url('imagens/backg.png');
    
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color-scheme: dark;
}

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

body {
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.6;
}

/* --- 2. Fundo Dinâmico --- */
#background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: var(--background-url);
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    transition: background-image 0.5s ease-in-out;
}

/* --- 3. Layout Principal (Mobile-First) --- */
/* Regras do header foram movidas para a seção 7 para consolidar com o logo */

#week-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
    margin: 1.5rem auto 0; /* Adicionado margem no topo para separar do header */
}

#week-selector button {
    background: var(--cor-secundaria);
    color: var(--cor-texto);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#week-selector button:hover {
    background: var(--cor-primaria);
}

main {
    padding: 0 1rem 2rem 1rem;
}

/* AJUSTE DE TAMANHO (MOBILE) */
#schedule-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    min-height: 50vh;
    
    /* Linhas adicionadas para limitar o tamanho no celular */
    max-width: 400px;
    margin: 0 auto;
}

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.9em;
}

footer a {
    color: var(--cor-secundaria);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--cor-primaria);
}

/* --- 4. Cards de Programação --- */
.day-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.day-header {
    font-weight: bold;
    color: var(--cor-primaria);
    border-bottom: 2px solid var(--cor-secundaria);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.schedule-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--cor-fundo-card);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: flex-end;
}

.schedule-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

/* Cards de dias passados em preto, branco e tons de cinza */
.schedule-item.past-day {
    filter: grayscale(1);
    opacity: 0.85;
}


/* === Cortinas vermelhas controladas pelo admin === */
.schedule-item.curtained {
    transform: none !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}

.schedule-item.curtained::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: auto;
    background-image:
        linear-gradient(to bottom, #b00020 0%, #7b0015 40%, #300000 100%),
        repeating-linear-gradient(
            -45deg,
            rgba(0, 0, 0, 0.2) 0px,
            rgba(0, 0, 0, 0.2) 8px,
            rgba(0, 0, 0, 0.35) 8px,
            rgba(0, 0, 0, 0.35) 16px
        );
    opacity: 0.96;
}

.schedule-item.curtained::after {
    content: "Surpresa";
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 0 6px #000;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.schedule-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.item-info {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    transition: background 0.3s ease;
}

.item-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1em;
}

.item-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--cor-primaria);
    color: var(--cor-texto);
    text-decoration: none;
    border-radius: 5px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.schedule-item:hover .item-link {
    opacity: 1;
    transform: translateY(0);
}

.no-items {
    color: #888;
    text-align: center;
    padding: 2rem;
}

/* --- 5. Loader --- */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader {
    border: 5px solid var(--cor-fundo-card);
    border-top: 5px solid var(--cor-primaria);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 6. Media Queries (Responsividade) --- */
@media (min-width: 768px) {
    main {
        padding: 0 2rem 2rem 2rem;
    }
    
    /* AJUSTE DE TAMANHO (DESKTOP) */
    #schedule-grid {
        /* Layout de 7 colunas com largura máxima */
        grid-template-columns: repeat(7, minmax(0, 180px));
        justify-content: center; /* Centraliza a grade na página */
        max-width: none; /* Remove a largura máxima do mobile */
    }
    .day-header {
        text-align: center;
    }
}

/* --- 7. Estilos do Header e Logotipo (VERSÃO CORRIGIDA) --- */

/* O header principal agora só precisa centralizar seus filhos (que estão empilhados) */
header {
    padding: 2rem 1rem;
    background: linear-gradient(180deg, rgba(18,18,18,0.8) 0%, rgba(18,18,18,0) 100%);
    text-align: center; /* Garante o alinhamento central */
}

/* NOVO: Estilo para o grupo "logo + título" */
.header-main {
    display: flex; /* Alinha o logo e o título lado a lado */
    justify-content: center; /* Centraliza o conjunto na página */
    align-items: center; /* Alinha verticalmente no centro */
    gap: 1rem; /* Espaço entre o logo e o título */
}

/* O estilo do título H1 volta ao original, mas sem a margem inferior */
h1 {
    margin-bottom: 0;
    color: var(--cor-primaria);
}

/* O estilo do logotipo permanece o mesmo */
.site-logo {
    max-height: 80px; 
    transition: transform 0.3s ease;
}

.site-logo:hover {
    transform: scale(1.05);
}


/* --- 8. Barra de Navegação Superior --- */

.top-nav {
    background-color: #0a0a0a; /* Um preto um pouco mais suave que o fundo */
    border-bottom: 2px solid var(--cor-secundaria);
    padding: 0.8rem 1rem;
    width: 100%;
    position: sticky; /* Faz a barra ficar fixa no topo ao rolar a página */
    top: 0;
    z-index: 100; /* Garante que a barra fique acima de outros elementos */
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center; /* Centraliza os links */
    align-items: center;
    gap: 2rem; /* Espaçamento entre os links */
}

.top-nav a {
    /* color: var(--cor-texto); */
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.top-nav a:hover {
    color: var(--cor-primaria);
}

/* Efeito de sublinhado animado no link */
.top-nav a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    
    bottom: 0;
    left: 0;
    transform: scaleX(0); /* Começa invisível */
    transform-origin: center;
    transition: transform 0.3s ease;
}

.top-nav a:hover::after {
    transform: scaleX(1); /* Aparece ao passar o mouse */
}

#fantasias-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 70vh;              /* ocupa a maior parte da tela */
  text-align: center;
}

/* Tamanho e centralização da imagem */
#fantasias-grid .fantasias {
  display: block;
  margin: 0 auto;
  width: clamp(280px, 65vw, 900px);  /* cresce até 900px, mas respeita a tela */
  height: auto;
}

/* === Ajuste Opção A: imagem com wrapper (.poster-wrap) === */
.schedule-item .poster-wrap { position: relative; overflow: hidden; }
.schedule-item .poster-wrap > img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: inherit;
}


.schedule-item { position: relative; }


/* === badge de destaque no card (Opção B) === */
.item-badge{
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #ff2b2b;       /* texto vermelho */
  background: #000000;  /* fundo preto */
  border-radius: 4px;
  z-index: 2;
  pointer-events: none;
}


/* ================== NEVE / CORAÇÕES CAINDO ================== */
.snow {
    pointer-events: none;
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 9999;
}

.snowflake {
    position: absolute;
    top: -10vh;
    will-change: transform;
    animation-name: snow-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes snow-fall {
    0% {
        transform: translate3d(0, -10vh, 0);
    }
    100% {
        transform: translate3d(0, 110vh, 0);
    }
}
