/* =========================================================
   CALENDAR.CSS — específico de calendar.html
   ========================================================= */

body { display: flex; flex-direction: column; min-height: 100vh; }

/* 1. Afastar do topo/lados e deixar espaço em baixo para o footer */
.page.cal-page { 
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 40px 100px 40px; 
    flex: 1;
}

/* 2. Espaçamento e tipografia do Breadcrumb */
.breadcrumb {
    display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
    margin-bottom: 32px; 
    font-family: 'Barlow Condensed', sans-serif;
    letter-spacing: 0.08em; text-transform: uppercase;
}

.breadcrumb a { color: var(--muted); text-decoration: none; transition: color .2s; }
.breadcrumb a:hover { color: var(--white); }
.breadcrumb svg { width: 12px; height: 12px; }

.breadcrumb .current-page {
    color: var(--red);
    font-weight: 900;
}

.page-header { margin-bottom: 24px; }
.page-tag {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--red); margin-bottom: 8px;
}
.page-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 36px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.03em; line-height: 1; margin-bottom: 8px;
}
.page-sub { font-size: 14px; color: var(--muted); font-weight: 500; }

.cal-layout {
  display: flex; align-items: flex-start; gap: 20px;
}

/* ================= SIDEBAR ================= */
.cal-sidebar {
  width: 260px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 20px;
}

.mini-cal, .upcoming {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px;
}

.mini-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mini-cal-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--white);
}
.mini-cal-nav { display: flex; gap: 4px; }
.mini-nav-btn {
  width: 22px; height: 22px; border-radius: 50%; background: transparent; border: none;
  color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s, color .15s;
}
.mini-nav-btn:hover { background: var(--card2); color: var(--white); }
.mini-nav-btn svg { width: 13px; height: 13px; }

.mini-cal-weekdays, .mini-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.mini-cal-weekdays {
  margin-bottom: 4px;
}
.mini-cal-weekdays span {
  text-align: center; font-size: 10px; font-weight: 700; color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.05em;
}
.mini-cal-grid { row-gap: 2px; }

.mini-cal-day {
  position: relative; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; color: var(--light); border-radius: 50%; cursor: pointer;
  transition: background .15s, color .15s;
}
.mini-cal-day:hover { background: var(--card2); color: var(--white); }
.mini-cal-day.other-month { color: #3a3a3a; }
.mini-cal-day.today { background: var(--red); color: var(--white); font-weight: 800; }
.mini-cal-day.selected:not(.today) { border: 1px solid var(--red); color: var(--white); }
.mini-cal-day .evt-dot {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--red);
}
.mini-cal-day.today .evt-dot { background: var(--white); }

/* ---------- UPCOMING ---------- */
.upcoming-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px;
}
.upcoming-list { display: flex; flex-direction: column; gap: 14px; max-height: 480px; overflow-y: auto; }
.upcoming-item { display: block; }
.upcoming-head { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.upcoming-head .upcoming-text { flex: 1; }
.upcoming-chevron {
  width: 14px; height: 14px; margin-top: 3px; flex-shrink: 0; color: var(--muted);
  transition: transform .2s ease, color .15s;
}
.upcoming-head:hover .upcoming-chevron { color: var(--white); }
.upcoming-item.open .upcoming-chevron { transform: rotate(180deg); }
.upcoming-flag { margin-left: 6px; font-size: 16px; border-radius: 2px; vertical-align: -2px; }

/* Dropdown de sessões */
.upcoming-sessions {
  display: none; flex-direction: column; gap: 6px;
  margin: 8px 0 2px 4px; padding-left: 15px; border-left: 2px solid var(--border);
}
.upcoming-item.open .upcoming-sessions { display: flex; }
.upcoming-session-day {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800;
  color: var(--white); letter-spacing: 0.02em;
}
.upcoming-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.upcoming-text { min-width: 0; }
.upcoming-date {
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800;
  color: var(--white); text-transform: uppercase; letter-spacing: 0.02em;
}
.upcoming-name { font-size: 12px; font-weight: 600; color: var(--light); line-height: 1.35; margin-top: 1px; }

.upcoming-list::-webkit-scrollbar { width: 5px; }
.upcoming-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ================= MAIN CALENDAR ================= */
.cal-main {
  flex: 1; min-width: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}

.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.cal-toolbar-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--white);
}
.cal-toolbar-actions { display: flex; align-items: center; gap: 10px; }
.cal-today-btn {
  background: var(--card2); border: 1px solid var(--border); color: var(--white);
  padding: 7px 14px; border-radius: 5px; font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
  transition: border-color .15s;
}
.cal-today-btn:hover { border-color: var(--red); }
.cal-nav { display: flex; gap: 4px; }
.cal-nav-btn {
  width: 30px; height: 30px; border-radius: 5px; background: var(--card2); border: 1px solid var(--border);
  color: var(--light); display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.cal-nav-btn:hover { border-color: var(--red); color: var(--white); }
.cal-nav-btn svg { width: 15px; height: 15px; }

.cal-weekday-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}
.cal-weekday-header span {
  text-align: center; padding: 10px 0; font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted);
}

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
}

/* ---------- EVENTOS NO CALENDÁRIO (DESIGN CELULA INTEIRA COLORIDA) ---------- */

.cal-cell {
  min-height: 130px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px; display: flex; flex-direction: column; gap: 3px;
  transition: all .2s ease-in-out;
  position: relative; 
  z-index: 1;
}

.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other-month { background: rgba(0,0,0,0.2); }
.cal-cell.other-month .cal-cell-num { color: #3a3a3a; }

/* O NÚMERO "NORMAL" DO DIA */
.cal-cell-num {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; color: var(--light);
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  align-self: flex-end;
  margin-bottom: 4px;
}

/* O DIA DE HOJE (Sem evento) */
.cal-cell.is-today:not(.has-events) { box-shadow: inset 0 0 0 2px var(--red); }
.cal-cell.is-today:not(.has-events) .cal-cell-num { background: var(--red); color: var(--white); }

/* --- DIAS COM EVENTO --- */
.cal-cell.has-events {
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* O hover ilumina a célula inteira com a cor base definida no JS */
.cal-cell.has-events:hover {
    transform: scale(1.02);
    z-index: 20; 
    border-radius: 4px; /* Apenas no hover fica com os cantos macios para o pop-up */
    box-shadow: 0 0 15px var(--event-color), inset 0 0 20px var(--event-color);
}

/* A BOLHA DO DIA (Totalmente contida DENTRO do quadrado) */
.cal-event-day-bubble {
    position: absolute;
    top: 8px;   /* Margem interna do topo */
    right: 8px; /* Margem interna da direita */
    background: var(--bubble-color, var(--red));
    color: var(--white);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 14px;
    font-weight: 900;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4); 
    z-index: 30;
}

/* A BANDEIRA (Totalmente contida DENTRO do quadrado) */
.cal-event-flag {
    position: absolute;
    top: 10px;  /* Alinhado elegantemente ao topo esquerdo */
    left: 10px;
    font-size: 16px; 
    border-radius: 2px; 
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
    z-index: 10;
}

/* O LOGÓTIPO DO CAMPEONATO (No meio da célula) */
.cal-event-logo {
  height: 65px; /* Logótipo consideravelmente MAIOR (antes era 28px) */
  width: 100%; /* Permite esticar a toda a largura disponível */
  display: flex; align-items: center; justify-content: center;
  margin-top: 16px; /* Empurrão para não bater no número do dia/bandeira */
}
.cal-event-logo img {
  height: 100%; width: 100%; /* Faz com que ocupe o espaço e preserve o aspeto */
  object-fit: contain; object-position: center;
}
.cal-event-fallback-text {
  font-size: 16px; font-weight: 900; font-family: 'Barlow Condensed', sans-serif;
}



.cal-event-more {
  font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 6px;
  text-align: center; margin-top: auto; /* Empurra para o fundo da célula */
}

@media (max-width: 900px) {
  .cal-layout { flex-direction: column; }
  .cal-sidebar { width: 100%; flex-direction: row; }
  .mini-cal, .upcoming { flex: 1; }
}
@media (max-width: 640px) {
  .page.cal-page { padding: 20px 16px 80px 16px; }
  /* Breadcrumb + aviso dos favoritos: empilha em vez de apertar lado a lado */
  .page.cal-page .breadcrumb { flex-wrap: wrap; gap: 8px; }
  .cal-sidebar { flex-direction: column; }
  .cal-weekday-header span { font-size: 9px; }
  .cal-cell { min-height: 70px; padding: 4px; }
  .cal-event-day-bubble { width: 18px; height: 18px; font-size: 11px; top: -2px; right: -2px; }
  .cal-event-flag { font-size: 12px; top: 0px; left: 0px;}
  .cal-event-logo { height: 38px; margin-top: 10px; }
}

/* --- FUNDO DESTACADO PARA DIAS COM EVENTO --- */

/* Quando a célula tem eventos, damos um fundo subtil e um pouco de relevo */
.cal-cell.has-events {
    background: rgba(255, 255, 255, 0.04); /* Cinza translúcido */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5); /* Sombra interna para dar profundidade */
}

/* Efeito de brilho quando passas o rato por cima de um dia com corrida! */
.cal-cell.has-events:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8), 0 0 8px rgba(255, 255, 255, 0.05);
    cursor: pointer; /* Muda o cursor para a mãozinha */
}

/* Garante que o dia de "Hoje" (is-today) não perde a sua linha vermelha! */
.cal-cell.has-events.is-today {
    background: rgba(224, 4, 27, 0.05); /* Fundo avermelhado para o dia de hoje com evento */
    box-shadow: inset 0 0 0 2px var(--red); /* Mantém a borda vermelha sólida */
}

/* =========================================================
   VÁRIOS CAMPEONATOS NO MESMO DIA (máx. 4 logos)
   Os logos ocupam todo o espaço livre da célula.
   ========================================================= */
.cal-event-flags {
  position: absolute; top: 10px; left: 10px; z-index: 10;
  display: flex; gap: 4px;
}
.cal-event-flags .fi { font-size: 14px; border-radius: 2px; box-shadow: 0 0 2px rgba(0,0,0,0.5); }

.cal-event-logos {
  flex: 1 1 auto; align-self: stretch; min-width: 0; min-height: 90px;
  margin-top: 26px;               /* deixa livre a zona da bandeira e da bolha do dia */
  display: grid; gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.cal-event-logos[data-count="1"] { grid-template-columns: minmax(0, 1fr); }

.cal-event-logo-item { position: relative; min-width: 0; min-height: 0; }
/* a imagem não influencia o tamanho da grelha: ocupa sempre a área toda */
.cal-event-logo-item img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center;
}
.cal-event-logo-item .cal-event-fallback-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
/* 3 logos: o terceiro fica centrado por baixo */
.cal-event-logos[data-count="3"] .cal-event-logo-item:nth-child(3) {
  grid-column: 1 / -1; width: 50%; justify-self: center;
}

@media (max-width: 640px) {
  .cal-event-flags { top: 2px; left: 2px; gap: 2px; }
  .cal-event-flags .fi { font-size: 10px; }
  .cal-event-logos { margin-top: 16px; min-height: 34px; gap: 2px; }
}
