:root {
  --primary-green: #0e793b;
  --primary-green-dark: #0a5a2d;
  --primary-green-light: #12965c;
  --secondary-dark: #10172b;
  --secondary-darker: #0a0f1f;
  --accent-yellow: rgba(238, 236, 144, 0.3);
  --accent-gold: rgba(255, 215, 0, 0.15);
  --active-yellow: #dcc794; /* Light yellow for active rows */

  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-card: #ffffff;
  --bg-hover: rgba(14, 121, 59, 0.05);

  --text-primary: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --text-inverse: #ffffff;

  --border-light: #e0e0e0;
  --border-medium: #cccccc;

  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.2);

  --suspended: rgba(148, 148, 146, 0.5);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --primary-green: #12965c;
  --primary-green-dark: #0e793b;
  --primary-green-light: #16b870;
  --secondary-dark: #1a2341;
  --secondary-darker: #10172b;
  --accent-yellow: rgba(238, 236, 144, 0.2);
  --accent-gold: rgba(255, 215, 0, 0.1);

  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2e;
  --bg-card: #1a1f2e;
  --bg-hover: rgba(18, 150, 92, 0.1);

  --text-primary: #e1e8ed;
  --text-secondary: #9ca3af;
  --text-light: #6b7280;
  --text-inverse: #ffffff;

  --border-light: #2a3441;
  --border-medium: #3a4451;

  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);

  --suspended: rgba(148, 148, 146, 0.3);
}

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

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
  max-width: 100%;
  overflow-x: hidden;
  background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
}

.header {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  padding: 15px;
  text-align: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.header img {
  width: 45px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.theme-toggle {
  position: absolute;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  padding: 8px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-inverse);
  font-size: 1.2rem;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.title {
  background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary-darker) 100%);
  color: var(--text-inverse);
  padding: 12px 20px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}

.main-content {
  flex: 1;
  padding: 20px 10px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.table-container {
  overflow-x: auto;
  padding: 0 10px;
}

.styled-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.styled-table thead tr {
  background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary-darker) 100%);
  color: var(--text-inverse);
}

.styled-table th {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-inverse);
}

.styled-table td {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.styled-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  background: var(--bg-card);
}

.styled-table tbody tr:hover {
  background: var(--bg-hover);
  transform: scale(1.01);
}

.styled-table tbody tr.active-row {
  /* Emphasize the active row with a dark border around the row, not each column */
  background: var(--bg-hover);
  animation: none;
  border-top: 2px solid var(--secondary-dark);
  border-bottom: 2px solid var(--secondary-dark);
}

/* Only add side borders to the outer cells of the active row */
.styled-table tbody tr.active-row td:first-child,
.styled-table tbody tr.active-row th:first-child {
  border-left: 2px solid var(--secondary-dark);
}
.styled-table tbody tr.active-row td:last-child,
.styled-table tbody tr.active-row th:last-child {
  border-right: 2px solid var(--secondary-dark);
}

/* Day group borders: wrap day header + all result rows as a single bordered block */
.styled-table tbody tr.day-group-start th.day-row {
  border-top: 2px solid var(--border-medium);
  border-left: 2px solid var(--border-medium);
  border-right: 2px solid var(--border-medium);
}
.styled-table tbody tr.day-group-row td {
  /*border-left: 2px solid var(--border-medium);*/
  /*border-right: 2px solid var(--border-medium);*/
}
.styled-table tbody tr.day-group-end td {
  border-bottom: 2px solid var(--border-medium);
}

/* Live badge styling, shown only when match has started and row is active */
.live-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: #dc2626; /* red */
  border-radius: 10px;
  letter-spacing: 0.3px;
}
[data-theme="dark"] .live-badge {
  background: #ef4444;
}

/* Slightly increase spacing between day groups for distinction */
.styled-table tbody tr.day-group-end + tr.day-group-start th.day-row {
  margin-top: 6px;
}

.styled-table tbody tr.suspended-row {
  background-color: var(--suspended);
  opacity: 0.6;
}

.styled-table tbody tr.suspended-row span {
  text-decoration: line-through;
}

.styled-table tbody th.day-row {
  padding: 10px;
  font-style: normal;
  font-weight: 500;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--primary-green-light) 0%, var(--accent-gold) 100%);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.status-collapsable-content td {
  background: var(--bg-hover) !important;
  font-size: 0.75rem;
  font-style: italic;
  padding: 8px !important;
  color: var(--text-secondary);
}

.collapsable {
  cursor: pointer;
  position: relative;
  padding: 10px 30px 10px 10px !important;
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  color: var(--text-inverse) !important;
  font-weight: 500;
  transition: var(--transition);
  width: 100%;
  text-align: center;
}

.collapsable:hover {
  background: linear-gradient(135deg, var(--primary-green-dark) 0%, var(--primary-green) 100%);
}

.collapsable::after {
  content: "+";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: bold;
  transition: transform 0.3s ease;
  color: var(--text-inverse);
}

.collapsable.active-collapsable::after {
  content: "−";
  transform: translateY(-50%) rotate(180deg);
}

.team-logo {
  width: 35px;
  height: 25px;
  object-fit: contain;
  margin: 0 5px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

[data-theme="dark"] .team-logo {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) brightness(1.1);
}

.home-team {
  text-align: right;
  font-weight: 500;
  color: var(--text-primary);
}

.away-team {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
}

.standings {
  border-collapse: collapse;
  width: 100%;
  max-width: 600px;
  margin: 20px auto;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.standings th {
  background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary-darker) 100%);
  color: var(--text-inverse);
  padding: 12px 8px;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
}

.standings td {
  padding: 10px 8px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  background: var(--bg-card);
}

.standings tbody tr {
  transition: var(--transition);
}

.standings tbody tr:hover {
  background: var(--bg-hover);
  transform: scale(1.02);
}

.standings tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

[data-theme="dark"] .standings tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.standings tbody tr:first-child {
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}

.menu {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-card);
  padding: 8px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 -2px 10px var(--shadow-sm);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);
}

.menu button {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--border-radius);
  transition: var(--transition);
  position: relative;
}

.menu button:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.menu button:active {
  transform: translateY(0);
}

.menu button.active {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.menu button img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  transition: var(--transition);
}

[data-theme="dark"] .menu button img {
  filter: brightness(0.9);
}

.menu button.active img {
  filter: brightness(0) invert(1);
}

.menu button:hover img {
  transform: scale(1.1);
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-light);
  border-radius: 50%;
  border-top-color: var(--primary-green);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-message {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  padding: 10px;
  border-radius: var(--border-radius);
  margin: 10px;
  text-align: center;
  font-size: 0.875rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] .error-message {
  background: rgba(220, 38, 38, 0.15);
  color: #ef4444;
  border-color: rgba(220, 38, 38, 0.3);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state img {
  width: 100px;
  opacity: 0.3;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .styled-table th,
  .styled-table td {
    padding: 8px 4px;
    font-size: 0.75rem;
  }

  .team-logo {
    width: 25px;
    height: 20px;
  }

  .title {
    font-size: 1.1rem;
  }

  .standings th,
  .standings td {
    padding: 8px 4px;
    font-size: 0.75rem;
  }

  .menu button {
    padding: 8px 15px;
    font-size: 0.75rem;
  }

  .menu button img {
    width: 24px;
    height: 24px;
  }

  .theme-toggle {
    padding: 6px 10px;
    font-size: 1rem;
  }
}

@media (min-width: 768px) {
  .main-content {
    padding: 30px 20px;
  }

  .styled-table,
  .standings {
    max-width: 700px;
  }
}
/* --- overrides to improve day row and active row styling --- */
/* Day row: lighter, theme-fitting background and readable text */
.styled-table tbody th.day-row {
  padding: 6px 8px;
  font-style: normal;
  font-weight: 500;
  color: var(--text-primary);
  background-color: #eef2f7; /* soft slate to fit navy header */
  border: 1px solid #3c7fe1; /* subtle border */
}

[data-theme="dark"] .styled-table tbody th.day-row {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
  color: var(--text-inverse);
}

/* Active row: soft yellow background and a clearer border just around the row */
.styled-table tbody tr.active-row {
  background-color: #FFFBEB !important; /* amber-50 */
  color: var(--text-primary) !important; /* dark text for readability */
}

[data-theme="dark"] .styled-table tbody tr.active-row {
  background-color: #451a03 !important; /* dark amber for dark theme */
  color: var(--text-inverse) !important; /* light text for dark theme */
}

/* create a rectangular border around only the row edges */
.styled-table tbody tr.active-row td {
  border-top: 2px solid #f59e0b; /* amber-500 */
  border-bottom: 2px solid #f59e0b;
}
.styled-table tbody tr.active-row td:first-child {
  border-left: 2px solid #f59e0b;
}
.styled-table tbody tr.active-row td:last-child {
  border-right: 2px solid #f59e0b;
}
