/* ===== LAYOUT ===== */
body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* HEADER */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-6);
}

/* LOGO */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.4rem; }
.logo-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brasil-verde);
  box-shadow: 0 0 10px rgba(0, 156, 59, 0.4);
  flex-shrink: 0;
}
.logo-text { color: var(--text-primary); }
.logo-text strong { color: var(--brasil-amarelo); }

/* NAV */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.nav-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--trans-fast);
  white-space: nowrap;
}
.nav-btn:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}
.nav-btn.active {
  background: var(--brasil-verde);
  color: var(--brasil-amarelo);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 156, 59, 0.4);
}

/* LIVE INDICATOR */
.live-pulse {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--status-live-bg);
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--status-live);
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-live);
  animation: pulse-live 1.4s ease-in-out infinite;
}

/* SYNC BUTTON */
.sync-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--status-live);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.sync-btn:hover:not(:disabled) {
  background: var(--status-live);
  color: var(--brasil-branco);
  box-shadow: var(--shadow-glow-live);
}
.sync-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* HERO SECTION */
.hero {
  padding: var(--space-12) 0 var(--space-8);
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 156, 59, 0.12) 0%, transparent 60%);
  border-bottom: 1px solid var(--border-subtle);
}
.hero-content {
  margin-bottom: var(--space-8);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--status-live);
  margin-bottom: var(--space-5);
  letter-spacing: 0.5px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-live);
  animation: pulse-live 1.2s ease-in-out infinite;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--space-3);
  letter-spacing: -1px;
}
.gradient-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* LEAGUE FILTERS */
.league-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.filter-chip {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  background: transparent;
  transition: all var(--trans-fast);
  cursor: pointer;
}
.filter-chip:hover {
  border-color: var(--brasil-amarelo);
  color: var(--brasil-amarelo);
}
.filter-chip.active {
  background: var(--brasil-verde);
  border-color: var(--brasil-amarelo);
  color: var(--brasil-amarelo);
  font-weight: 600;
  box-shadow: var(--shadow-glow-green);
}

/* MAIN CONTENT */
.main-content {
  padding: var(--space-10) 0 var(--space-16);
  min-height: 60vh;
}

/* SECTION HEADER */
.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}
.section-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.section-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* TAB PANELS */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* GAMES GRID */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-5);
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--text-muted);
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-sub { font-size: 0.875rem; }

/* COMING SOON BANNER */
.coming-soon-banner {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
}
.cs-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.coming-soon-banner h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}
.coming-soon-banner p { font-size: 0.9rem; line-height: 1.6; max-width: 400px; margin: 0 auto; }

/* FOOTER */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-8) 0;
  background: var(--bg-secondary);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}
.footer-copy, .footer-leagues {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* CONFIG OVERLAY */
.config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.config-overlay.hidden { display: none; }
.config-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.config-header {
  text-align: center;
  margin-bottom: var(--space-8);
}
.config-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-green);
  margin-bottom: var(--space-4);
}
.config-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.config-header p { font-size: 0.875rem; color: var(--text-secondary); }

.config-form { display: flex; flex-direction: column; gap: var(--space-5); }
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-group input {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--trans-fast);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.1);
}

.btn-primary {
  padding: var(--space-4) var(--space-6);
  background: var(--accent-green);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--trans-fast);
  box-shadow: var(--shadow-glow-green);
}
.btn-primary:hover {
  background: #00c853;
  transform: translateY(-1px);
}
.btn-secondary {
  padding: var(--space-3) var(--space-6);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: all var(--trans-fast);
}
.btn-secondary:hover {
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.config-note {
  margin-top: var(--space-4);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  max-width: 320px;
}
.toast.success { border-color: var(--accent-green); color: var(--accent-green); }
.toast.error   { border-color: var(--accent-red); color: var(--accent-red); }
.toast.info    { border-color: var(--accent-blue); color: var(--accent-blue); }

/* ==============================
   MOBILE OPTIMIZATION
   ============================== */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }

  /* Header */
  .site-header { height: 56px; }
  .header-inner { gap: var(--space-2); }
  .logo-text { font-size: 1.1rem; }
  .logo-img { width: 32px; height: 32px; }

  /* Nav pills scroll horizontally */
  .main-nav {
    gap: var(--space-1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 1;
    min-width: 0;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-btn { padding: 6px 12px; font-size: 0.78rem; white-space: nowrap; flex-shrink: 0; }

  /* Live indicator — smaller */
  .live-pulse { padding: 3px 8px; }
  .pulse-label { display: none; }

  /* Hero */
  .hero { padding: var(--space-6) 0 var(--space-4); }
  .hero-title { font-size: 1.75rem; letter-spacing: -0.5px; }
  .hero-subtitle { font-size: 0.85rem; }
  .hero-content { margin-bottom: var(--space-5); }

  /* League filter pills scroll horizontally */
  .league-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-2);
  }
  .league-filters::-webkit-scrollbar { display: none; }
  .filter-chip { white-space: nowrap; flex-shrink: 0; }

  /* Games: single column */
  .games-grid { grid-template-columns: 1fr; gap: var(--space-4); }

  /* Cards: compact on mobile */
  .game-card { padding: var(--space-4); }
  .score-display { font-size: 2rem; gap: var(--space-2); }
  .team-crest { width: 44px; height: 44px; }
  .team-crest img { width: 34px; height: 34px; }
  .team-name { font-size: 0.78rem; max-width: 90px; }
  .card-footer { font-size: 0.7rem; }
  .venue-text { max-width: 130px; }

  /* Section headers */
  .section-header { margin-bottom: var(--space-4); }
  .section-title { font-size: 1.2rem; }

  /* Config modal */
  .config-modal { padding: var(--space-6); border-radius: var(--radius-lg); }

  /* Toast smaller */
  .toast-container { bottom: var(--space-4); right: var(--space-4); left: var(--space-4); }
  .toast { max-width: 100%; }

  /* Main content */
  .main-content { padding: var(--space-6) 0 var(--space-12); }
}

@media (max-width: 380px) {
  .hero-title { font-size: 1.5rem; }
  .nav-btn { padding: 5px 10px; font-size: 0.72rem; }
  .score-display { font-size: 1.75rem; }
  .logo-text { display: none; } /* só mostra a logo imagem em telas muito pequenas */
}

/* Safe area para notch/bottom bar do iPhone */
@supports (padding: env(safe-area-inset-bottom)) {
  .site-footer { padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom)); }
  .toast-container { bottom: calc(var(--space-6) + env(safe-area-inset-bottom)); }
}

