/* ========================================
   BASE STYLES - Global styles, resets, typography
   Clean platform aesthetic
   ======================================== */

/* Animated gradient background */
body {
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(
    135deg,
    #1a1c1e 0%,
    #1e2024 25%,
    #1f2228 50%,
    #1a1c1e 75%,
    #1e2024 100%
  );
  background-size: 400% 400%;
  animation: backgroundShift 20s ease infinite;
  min-height: 100vh;
  color: var(--color-text-primary);
}

/* Glow overlay for depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(
      ellipse 80% 50% at 20% 10%,
      rgba(0, 168, 255, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 60% 40% at 80% 90%,
      rgba(0, 168, 255, 0.06) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: -1;
  animation: glowShift 15s ease-in-out infinite;
}

@keyframes backgroundShift {
  0% {
    background-position: 0% 0%;
  }
  25% {
    background-position: 100% 0%;
  }
  50% {
    background-position: 100% 100%;
  }
  75% {
    background-position: 0% 100%;
  }
  100% {
    background-position: 0% 0%;
  }
}

@keyframes glowShift {
  0%, 100% {
    opacity: 0.6;
    transform: translateX(0) translateY(0);
  }
  33% {
    opacity: 1;
    transform: translateX(5%) translateY(-3%);
  }
  66% {
    opacity: 0.8;
    transform: translateX(-3%) translateY(5%);
  }
}

/* ========================================
   LIGHT MODE - Complete Theme Overrides
   ======================================== */

/* Background */
:root.light-mode body {
  background: linear-gradient(
    135deg,
    #fafafa 0%,
    #f5f5f5 25%,
    #f7f7f7 50%,
    #f5f5f5 75%,
    #fafafa 100%
  );
  background-size: 300% 300%;
  background-attachment: fixed;
  animation: backgroundShiftLight 25s ease infinite;
}

:root.light-mode body::before {
  background: 
    radial-gradient(
      ellipse 80% 50% at 20% 10%,
      rgba(31, 111, 235, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 60% 40% at 80% 90%,
      rgba(31, 111, 235, 0.02) 0%,
      transparent 50%
    );
}

@keyframes backgroundShiftLight {
  0% { background-position: 0% 0%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

/* Top Navigation */
:root.light-mode .top-nav-bar {
  border-bottom: 1px solid #e4e4e4;
}

:root.light-mode .top-nav-link {
  color: #333333;
  font-weight: 500;
}

:root.light-mode .top-nav-link:hover {
  color: #1F6FEB;
  background: rgba(31, 111, 235, 0.08);
}

:root.light-mode .top-nav-link.active {
  color: #1F6FEB;
  background: rgba(31, 111, 235, 0.1);
  font-weight: 600;
}

/* Footer */
:root.light-mode .site-footer {
  background: #f5f5f5;
  border-top: 1px solid #e4e4e4;
}

:root.light-mode .footer-logo {
  color: #1F6FEB;
}

:root.light-mode .footer-tagline,
:root.light-mode .footer-links a {
  color: #666666;
}

:root.light-mode .footer-heading {
  color: #333333;
}

:root.light-mode .footer-links a:hover {
  color: #1F6FEB;
}

:root.light-mode .footer-bottom {
  border-top-color: #ebebeb;
}

:root.light-mode .footer-copyright,
:root.light-mode .footer-disclaimer {
  color: #999999;
}

:root.light-mode .social-link {
  background: #ffffff;
  border-color: #e4e4e4;
  color: #666666;
}

:root.light-mode .social-link:hover {
  background: rgba(31, 111, 235, 0.1);
  border-color: rgba(31, 111, 235, 0.3);
  color: #1F6FEB;
}

/* Search */
:root.light-mode .prominent-search-input {
  background: #ffffff;
  border-color: #e4e4e4;
  color: #333333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

:root.light-mode .prominent-search-input::placeholder {
  color: #999999;
}

:root.light-mode .prominent-search-input:hover {
  border-color: #d0d0d0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

:root.light-mode .prominent-search-input:focus {
  border-color: #1F6FEB;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

:root.light-mode .prominent-search-results {
  background: #ffffff;
  border-color: #e4e4e4;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Hero Title */
:root.light-mode .explore-hero-link {
  color: #1F6FEB;
  text-shadow: none;
}

:root.light-mode .explore-hero-link:hover {
  text-shadow: 0 0 20px rgba(31, 111, 235, 0.3);
}

:root.light-mode .explore-hero-subtitle {
  color: #666666;
}

:root.light-mode .rotating-text {
  color: #1F6FEB;
}

/* Dropdown menus */
:root.light-mode .nav-dropdown-menu {
  background: #ffffff !important;
  border-color: #e4e4e4 !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */

.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--color-shadow-secondary);
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 20px var(--color-shadow-primary);
}

.theme-toggle-icon {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-toggle-icon {
  transform: rotate(15deg);
}

.theme-toggle-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Hide label on mobile */
@media (max-width: 480px) {
  .theme-toggle-label {
    display: none;
  }
  
  .theme-toggle {
    padding: 0.6rem;
  }
}

/* Global Scrollbar Styling - Override Pico.css defaults */
/* Pico.css sets scrollbar styles on :root, we must override with higher specificity */
:root,
html {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(0, 168, 255, 0.5) transparent !important;
  scrollbar-gutter: stable;
}

/* WebKit browsers - main page scrollbar */
:root::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 10px !important;
  background: transparent !important;
  background-color: transparent !important;
}

:root::-webkit-scrollbar-track,
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

:root::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: rgba(0, 168, 255, 0.5) !important;
  border-radius: 5px !important;
  border: none !important;
}

:root::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 168, 255, 0.7) !important;
}

/* Scrollbar corner (where horizontal and vertical meet) */
:root::-webkit-scrollbar-corner,
html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner {
  background: transparent !important;
}

/* Default scrollbar for other scrollable elements */
::-webkit-scrollbar {
  width: 8px;
  background: transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 168, 255, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 168, 255, 0.7);
}

/* Header and Main Container Structure */
/* Header contains fixed-position nav buttons, so it shouldn't take up document flow space */
header.container {
  height: 0;
  padding: 0;
  margin: 0;
  overflow: visible;
  max-width: 100%;
}

header.container nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  position: relative;
}

header.container nav ul {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header.container nav ul:first-child {
  flex: 0 0 auto;
}

header.container nav ul:last-child {
  flex: 1;
  justify-content: flex-end;
  margin-left: auto;
  margin-right: 0;
}

/* Main container - content starts right after stats bar */
main.container {
  padding-top: 0;
}

/* ========================================
   HERO BRAND TITLE COMPONENT - HIDDEN BY DEFAULT
   The big Sports Index title is now hidden globally
   ======================================== */

/* Hide hero brand sections globally */
.hero-brand-section,
.hero-brand-title,
.hero-brand-tagline,
.hero-brand-link,
.brand-dash,
.explore-hero {
  display: none !important;
}

/* ========================================
   PROMINENT SEARCH BAR
   Full-width centered search bar replacing the hero title
   ======================================== */

/* Explore Hero Section - Title */
.explore-hero-section {
  text-align: center;
  padding: 2.5rem 0 0;
}

.explore-hero-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
}

.explore-hero-link {
  color: var(--color-primary);
  text-decoration: none;
  text-shadow: 0 0 20px rgba(0, 168, 255, 0.35);
  transition: text-shadow 0.3s ease, color 0.3s ease;
}

.explore-hero-link:hover {
  text-shadow: 0 0 28px rgba(0, 168, 255, 0.55), 0 0 40px rgba(0, 168, 255, 0.25);
}

/* Hero Subtitle with Rotating Text */
.explore-hero-subtitle {
  margin: 0.75rem auto 0;
  max-width: 600px;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  line-height: 1.5;
  padding: 0 1rem;
}

.rotating-text-wrapper {
  display: inline-block;
  position: relative;
  min-width: 80px;
  text-align: left;
}

.rotating-text {
  display: inline-block;
  color: var(--color-primary);
  font-weight: 600;
  animation: rotateTextFade 0.4s ease;
}

@keyframes rotateTextFade {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .explore-hero-section {
    padding: 1.25rem 0 0;
  }
  
  .explore-hero-title {
    font-size: 2rem;
  }
  
  .explore-hero-subtitle {
    font-size: 0.9rem;
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .explore-hero-section {
    padding: 1rem 0 0;
  }
  
  .explore-hero-title {
    font-size: 1.75rem;
  }
  
  .explore-hero-subtitle {
    font-size: 0.85rem;
  }
}

.prominent-search-section {
  /* Position below hero */
  padding: 0.5rem 0 0.5rem;
  text-align: center;
}

.prominent-search-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
}

.prominent-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}


.prominent-search-input {
  width: 100%;
  height: 40px;
  padding: 0 2.5rem 0 1.25rem;
  background: var(--color-bg-base-mid);
  border: 1px solid rgba(0, 168, 255, 0.35);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.prominent-search-input:hover {
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 168, 255, 0.2);
}

.prominent-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 16px rgba(0, 168, 255, 0.35), 0 0 0 2px rgba(0, 168, 255, 0.15);
}

.prominent-search-input::placeholder {
  color: var(--color-text-muted);
}

.prominent-clear-search {
  position: absolute;
  right: 1rem;
  top: 10px;
  background: none;
  border: none;
  color: var(--color-text-disabled);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s ease;
  display: none;
}

.prominent-clear-search:hover {
  color: var(--color-primary);
}

.prominent-search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--color-bg-base-mid);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
  .prominent-search-section {
    padding: 2rem 0 1.5rem;
  }
  
  .prominent-search-input {
    height: 50px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .prominent-search-input {
    height: 36px;
    font-size: 0.85rem;
  }
}

/* ========================================
   SITE FOOTER - Clean minimal style
   ======================================== */

.site-footer {
  margin-top: 4rem;
  padding: 3rem 0 1.5rem;
  background: var(--color-bg-base-mid);
  border-top: 1px solid var(--color-border-light);
  position: relative;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

/* Brand Column */
.footer-brand {
  max-width: 280px;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 0.75rem 0;
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0 0 1.25rem 0;
}

.footer-social {
  display: flex;
  gap: 0.75rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-bg-base-light);
  color: var(--color-text-muted);
  transition: all 0.2s ease;
  border: 1px solid var(--color-border-light);
}

.social-link:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-border-primary);
}

/* Footer Columns */
.footer-column {
  min-width: 120px;
}

.footer-heading {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 0.6rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* Footer Bottom */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-muted);
}

.footer-copyright {
  font-size: 0.8rem;
  color: var(--color-text-disabled);
  margin: 0;
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-disabled);
  margin: 0;
}

/* Footer Responsive */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  
  .footer-brand {
    grid-column: span 2;
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .site-footer {
    padding: 2rem 0 1rem;
  }
  
  .footer-container {
    padding: 0 1rem;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .footer-brand {
    grid-column: span 1;
    text-align: center;
    max-width: 100%;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .footer-column {
    text-align: center;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* ============================================================================
   Top Navigation Bar (Sticky - replaces carousel)
   ============================================================================ */

.top-nav-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 0;
}

.top-nav-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 1.25rem;
}

.top-nav-left,
.top-nav-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.top-nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.top-nav-link:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.top-nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* Responsive: Adjust link padding on smaller screens */
@media (max-width: 1024px) {
  .top-nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .top-nav-center {
    gap: 0.25rem;
  }
}

/* Responsive: Hide center links on mobile, show in hamburger */
@media (max-width: 768px) {
  .top-nav-center {
    display: none;
  }
  
  .top-nav-container {
    padding: 0 1rem;
  }
}

/* ============================================================================
   Topic Carousel (Global - appears on all pages) - HIDDEN
   ============================================================================ */

.topic-carousel-section {
  /* Hidden visually but code remains functional */
  display: none !important;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.5rem 0;
  overflow: hidden;
  background: transparent !important;
  background-color: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Fade effect on left and right - uses transparent gradients since bar is transparent */
.topic-carousel-section::before,
.topic-carousel-section::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 10;
  pointer-events: none;
}

.topic-carousel-section::before {
  left: 0;
  background: linear-gradient(to right, rgba(35, 37, 40, 0.9) 0%, transparent 100%);
}

.topic-carousel-section::after {
  right: 0;
  background: linear-gradient(to left, rgba(35, 37, 40, 0.9) 0%, transparent 100%);
}

.topic-carousel-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.35rem 0;
}

.topic-carousel-viewport::-webkit-scrollbar {
  display: none;
}

.topic-carousel-track {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem;
  min-width: min-content;
  will-change: transform;
}

.topic-carousel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 200px;
  height: 60px;
}

/* Topic carousel cards - compact style */
.topic-carousel-card {
  flex-shrink: 0;
  width: 110px;
  height: 65px;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  display: block;
  border: 1px solid var(--color-border-secondary);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-carousel-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-border-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.topic-carousel-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.topic-carousel-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 60%, transparent 100%);
  z-index: 1;
}

.topic-carousel-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.35rem 0.5rem;
  z-index: 2;
}

.topic-carousel-card-name {
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fallback for topics without media */
.topic-carousel-card-no-media {
  background: linear-gradient(135deg, var(--color-bg-base-light) 0%, var(--color-bg-base-mid) 100%);
}

.topic-carousel-card-no-media .topic-carousel-card-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.topic-carousel-card-no-media .topic-carousel-card-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0.5rem;
}

.topic-carousel-card-no-media .topic-carousel-card-name {
  text-align: center;
  white-space: normal;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive carousel */
@media (max-width: 768px) {
  .topic-carousel-section::before,
  .topic-carousel-section::after {
    width: 30px;
  }
  
  .topic-carousel-track {
    padding: 0 1rem;
    gap: 0.4rem;
  }
  
  .topic-carousel-card {
    width: 95px;
    height: 55px;
  }
  
  .topic-carousel-card-name {
    font-size: 0.6rem;
  }
}
