/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Dark theme variables - Mobile App Style */
:root {
  --bg-primary: #000000; /* Pure black background */
  --bg-secondary: #121212;
  --bg-card: #1e1e1e; /* Dark charcoal grey cards */
  --bg-hover: #2c2c2c; /* Slightly lighter for hover in dark mode */
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --accent-primary: #ff6d00; /* Orange accent for live timers */
  --accent-secondary: #ff6d00;
  --live-color: #ff6d00; /* Orange for live matches */
  --finished-color: #4caf50;
  --scheduled-color: #2196f3;
  --postponed-color: #9e9e9e;
  --border-color: #333333;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Light theme variables - Desktop Professional Style */
[data-theme="light"] {
  --bg-primary: #f8f9fa; /* Clean light background */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff; /* White cards */
  --bg-hover: #f1f3f5; /* Slightly darker for hover in light mode */
  --text-primary: #212529; /* Dark text for readability */
  --text-secondary: #6c757d; /* Muted secondary text */
  --accent-primary: #0d6efd; /* Light blue accent */
  --accent-secondary: #0dcaf0; /* Light blue secondary */
  --live-color: #fd7e14; /* Orange for live matches */
  --finished-color: #198754; /* Green for finished */
  --scheduled-color: #0d6efd; /* Blue for scheduled */
  --postponed-color: #6c757d; /* Gray for postponed */
  --border-color: #dee2e6; /* Light gray borders */
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.4;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
}

/* Header styles */
header {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  padding: 10px 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 8px;
  font-weight: 600;
}

nav {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

nav a {
  padding: 6px 12px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
  border-radius: 20px;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 500;
}

nav a:hover, nav a.active {
  background-color: rgba(255, 109, 0, 0.4);
}

.theme-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 15px; /* Match left spacing of menu toggle */
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 102;
  padding: 0;
  line-height: 1;
}

/* Hamburger Menu Styles - FORCED VISIBLE */
.menu-toggle {
  display: none; /* Hidden on desktop */
  position: absolute;
  top: 50%; /* Center vertically */
  transform: translateY(-50%);
  left: 15px;
  background: transparent;
  border: none;
  color: white !important; /* Force white color */
  font-size: 1.3rem; /* Slightly smaller to match theme icon weight */
  cursor: pointer;
  z-index: 2000; /* Extremely high z-index to stay on top */
  padding: 0;
  line-height: 1;
}

/* Mobile responsive menu */
@media (max-width: 768px) {
  .menu-toggle {
    display: block !important; /* Force show on mobile */
  }

  header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
  }

  header h1 {
    text-align: center;
    padding: 0 50px; /* Space for buttons */
    font-size: 1.1rem;
    margin: 0;
    width: 100%;
  }

  /* Ensure nav container is positioned correctly relative to header */
  .container > header {
    position: relative; 
  }

  nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%; /* Directly below header */
    left: 0;
    right: 0;
    width: 100vw;
    margin-left: -15px; /* Counteract container padding */
    background-color: var(--bg-card); /* Match card background */
    border-bottom: 1px solid var(--border-color);
    padding: 5px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 1999;
  }

  nav.active {
    display: flex; /* Show when active class is added */
    animation: slideDown 0.2s ease forwards;
  }

  nav a {
    display: block;
    width: 100%;
    margin: 0;
    text-align: left;
    padding: 10px 20px; /* Comfortable touch target but compact */
    background-color: transparent;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
  }

  nav a:last-child {
    border-bottom: none;
  }

  nav a:hover, nav a.active {
    background-color: rgba(255, 109, 0, 0.1); /* Subtle highlight */
    color: var(--accent-primary);
    transform: none; /* Disable desktop hover transform */
    box-shadow: none;
  }
  
  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Compact Mobile Layout */
  .match { 
    padding: 5px 2px; /* Minimal horizontal padding */
    gap: 2px; /* Minimal gap */
  }
  
  /* Shrink side columns to maximize center space */
  .match-time { 
    width: 45px; 
    font-size: 0.65rem; 
    padding: 2px 0;
  }
  
  .match-details { 
    width: 45px; 
    font-size: 0.6rem; 
    gap: 2px;
  }
  
  /* Center area */
  .match-center {
    padding: 0 2px;
  }
  
  .team-home, .team-away {
    gap: 3px;
  }

  .team-name { 
    font-size: 0.75rem; 
    line-height: 1.1;
    /* Allow wrapping but constrain height */
    max-height: 2.2em;
    overflow: hidden;
  }
  
  .team-score { 
    font-size: 0.95rem; 
    min-width: 20px; 
    padding: 1px 3px;
  }
  
  .vs { 
    width: 15px; 
    font-size: 0.6rem; 
    margin: 0 1px;
  }
}

/* Extra small devices (very old phones) */
@media (max-width: 360px) {
  .match-time, .match-details {
    width: 35px; /* Even smaller side columns */
    font-size: 0.6rem;
  }
  
  .team-name {
    font-size: 0.7rem;
  }
  
  .team-score {
    font-size: 0.85rem;
    min-width: 18px;
  }
}

main {
  padding: 10px 0;
}

/* League section styles - Compact */
.league-section {
  margin-bottom: 8px;
}

.league-section h2 {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  padding: 5px 12px;
  border-radius: 4px 4px 0 0;
  font-size: 0.9rem;
  margin-bottom: 0;
  font-weight: 600;
}

.matches-container {
  background-color: var(--bg-card);
  border-radius: 0 0 4px 4px;
  border: 1px solid var(--border-color);
  padding: 4px;
}

.matches {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Match Card - Compact */
.match {
  display: flex;
  flex-direction: row;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 12px;
  background-color: var(--bg-card);
  transition: all 0.2s ease;
  border-left: 3px solid;
  min-height: 40px;
  justify-content: space-between;
  gap: 8px;
}

.match:hover {
  background-color: var(--bg-hover);
}

.match.live { border-left-color: var(--live-color); }
.match.finished { border-left-color: var(--finished-color); }
.match.scheduled { border-left-color: var(--scheduled-color); }
.match.postponed { border-left-color: var(--postponed-color); }

.match-time {
  font-weight: bold;
  color: var(--accent-primary);
  font-size: 0.8rem;
  width: 80px;
  text-align: center;
  background-color: rgba(13, 110, 253, 0.1);
  padding: 3px 0;
  border-radius: 3px;
  flex-shrink: 0;
}

.match-center {
  display: flex;
  flex: 1;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.team {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.team-home { justify-content: flex-end; text-align: right; gap: 8px; }
.team-away { justify-content: flex-start; text-align: left; gap: 8px; }

.team-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: normal;
  line-height: 1.1;
}

.team-score {
  font-size: 1.1rem;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  flex-shrink: 0;
}

.vs {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.match-details {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  width: 80px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.red-card { color: #f44336; font-weight: bold; }
.half-score { color: var(--text-secondary); font-style: italic; }

/* Scrollable Matches Container */
.matches-scroll-container {
  max-height: 60vh; /* Adjust height as needed, 60% of viewport height */
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 20px;
  scrollbar-width: thin; /* For Firefox */
  scrollbar-color: var(--accent-primary) var(--bg-card); /* For Firefox */
}

/* Webkit Scrollbar Styling */
.matches-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.matches-scroll-container::-webkit-scrollbar-track {
  background: var(--bg-card);
}

.matches-scroll-container::-webkit-scrollbar-thumb {
  background-color: var(--accent-primary);
  border-radius: 4px;
}

/* News Carousel Section */
.news-section { 
  margin-top: 20px; 
  position: relative;
}

.news-section h2 {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 15px;
  display: inline-block; /* Agar background mengikuti panjang teks */
  width: 100%;
}

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

.news-track {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 5px;
  
  /* Enable Scroll Snap */
  scroll-snap-type: x mandatory;
  
  /* Hide Scrollbar */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.news-track::-webkit-scrollbar {
  display: none;
}

.news-link {
  text-decoration: none;
  color: inherit;
  display: block;
  flex: 0 0 300px;
  max-width: 80vw;
  
  /* Snap alignment */
  scroll-snap-align: center; /* Center aligns better on mobile */
  scroll-snap-stop: always;
}

.news-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-card);
  padding: 15px;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Garis aksen di atas kartu */
.news-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left;
}

.news-card:hover::before {
  transform: scaleX(1);
}

.news-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--accent-primary);
  box-shadow: 0 8px 20px rgba(255, 109, 0, 0.4);
}

[data-theme="light"] .news-card:hover {
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.25);
}

.news-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Ubah warna judul jadi oranye hanya saat hover dengan animasi */
.news-card:hover .news-title {
  color: var(--accent-primary);
  transform: translateX(2px);
}

.news-excerpt {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
  font-weight: 400;
  opacity: 0.9;
}

.news-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: auto;
}

.news-category {
  display: inline-block;
  background: linear-gradient(135deg, #ff6d00, #ff9100);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(255, 109, 0, 0.4);
  animation: pulse-badge 2s ease-in-out infinite;
  text-transform: uppercase;
}

[data-theme="light"] .news-category {
  background: linear-gradient(135deg, #0d6efd, #0dcaf0);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.4);
  color: white;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.95;
  }
}

/* Navigation Buttons */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.nav-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev { left: -20px; }
.nav-btn.next { right: -20px; }

@media (max-width: 768px) {
  .news-link { flex: 0 0 260px; } /* Sedikit lebih kecil di tablet/HP */
  .nav-btn { display: none; } /* Sembunyikan tombol di HP, pakai swipe aja */
}

/* Responsive */
@media (max-width: 768px) {
  .match { padding: 5px 6px; gap: 4px; }
  .match-time { width: 45px; font-size: 0.65rem; }
  .match-details { width: 45px; font-size: 0.6rem; }
  .team-name { font-size: 0.75rem; }
  .team-score { font-size: 0.95rem; min-width: 22px; }
  .vs { width: 18px; font-size: 0.6rem; }
}
