:root {
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(148, 163, 184, 0.1);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --error: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Outfit", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  background-image:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
  padding-bottom: 50px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* HEADER */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  margin: -20px -20px 30px -20px;
  border-bottom: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(to right, #3b82f6, #10b981);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* NAVIGATION */
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-link:hover {
  color: white;
}

.nav-link.active {
  color: var(--primary);
}

.back-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* GRID LAYOUT */
.grid-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
}

@media (max-width: 900px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 10px;
}

.sidebar {
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 10px;
}

/* Custom Scrollbar */
/* Custom Scrollbar Global */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* CARDS */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin-bottom: 30px;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ACTIONS BAR (Matches Page) */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

/* FORMS */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: white;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.file-input {
  padding: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.3);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: white;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  width: auto;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* TEAMS LIST SIDEBAR */
.team-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid var(--card-border);
}

.team-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-logo-sm {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.team-logo-md {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

/* MATCH RESULTS DISPLAY */
.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 30px;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

.team-side {
  display: flex;
  align-items: center;
  gap: 15px;
}

.team-side.home {
  justify-content: flex-end;
  text-align: right;
}

.team-side.away {
  justify-content: flex-start;
  text-align: left;
}

.team-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
  min-width: 120px;
}

.team-side.home .team-name {
  text-align: right;
}

.team-side.away .team-name {
  text-align: left;
}

.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 120px;
}

.score-val {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  text-align: center;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* STANDINGS TABLE */
.table-container {
  overflow-x: auto;
  scrollbar-color: var(--primary) transparent;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th {
  text-align: left;
  padding: 15px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

td {
  padding: 15px;
  border-bottom: 1px solid var(--card-border);
}

/* SCHEDULE LIST (NEW DESIGN) */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.match-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--card-border);
  padding: 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  gap: 15px;
}

.match-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Checkbox Wrapper - Desktop: Left Side */
.card-checkbox-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0; /* Remove bottom margin */
  padding-right: 15px;
  border-right: 1px solid var(--card-border); /* Divider line */
}

.match-top-check {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
  background: white;
  border-radius: 4px;
}

.match-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.team-block {
  flex: 1;
  display: flex;
  flex-direction: row; /* Default Desktop: Horizontal */
  align-items: center;
  gap: 20px;
}

.team-block.home {
  justify-content: flex-end; /* Push content towards center (score) */
  text-align: right;
}

.team-block.away {
  justify-content: flex-start; /* Push content towards center (score) */
  text-align: left;
}

.team-logo-lg {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.team-name-lg {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.2;
  color: white;
}

/* Center Inputs */
.center-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 20px;
}

.score-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-score-box {
  width: 45px;
  height: 45px;
  background: #0f172a;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-score-box:focus {
  border-color: var(--primary);
  outline: none;
}

.vs-sep {
  color: var(--text-muted);
  font-weight: 700;
}

/* Action Buttons */
.btn-save-check {
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: var(--primary);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.btn-save-check:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.btn-download-icon {
  width: 45px;
  height: 45px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-download-icon:hover {
  color: white;
  border-color: white;
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile Responsive matches */
@media (max-width: 600px) {
  .match-card {
    flex-direction: column; /* Reset to column */
    padding: 20px;
  }

  .card-checkbox-wrapper {
    border-right: none;
    padding-right: 0;
    margin-bottom: 10px;
  }

  .match-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .team-block.home,
  .team-block.away {
    align-items: center;
    text-align: center;
    width: 100%;
    flex-direction: column;
    /* Reset any specific ordering for mobile */
  }

  /* Force mirrored playout on mobile: Name-Logo VS Logo-Name */
  .team-block.home {
    flex-direction: column; /* Name Top, Logo Bottom */
  }

  .team-block.away {
    flex-direction: column; /* Logo Top, Name Bottom */
  }

  .center-actions {
    width: 100%;
    justify-content: center;
    margin: 10px 0;
  }
}

/* ANIMATIONS */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.action-btn:hover {
  color: white;
  border-color: white;
}
/* ACTIONS BAR (Matches Page) - Refined */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.actions-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.5);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  height: 42px; /* Fixed height for consistency */
}

/* Fix desktop button sizes */
.actions-buttons .btn {
  white-space: nowrap; /* Prevent text wrap */
  height: 42px; /* Match checkbox height */
}

.actions-buttons form {
  display: inline-flex;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-wrapper label {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
  user-select: none;
}

.actions-buttons {
  display: flex;
  gap: 10px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .actions-bar {
    flex-direction: column;
    align-items: stretch; /* Stretch children */
    gap: 20px;
    text-align: left;
  }

  .actions-info {
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 15px;
  }

  .actions-controls {
    flex-direction: column;
    gap: 15px;
    width: 100%;
  }

  .checkbox-wrapper {
    width: 100%;
    justify-content: center;
  }

  .actions-buttons {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .actions-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .actions-buttons form {
    width: 100%;
    display: block !important;
  }

  .actions-buttons form .btn {
    width: 100%;
  }

  /* Match Results Responsive */
  .match-teams {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 100%;
  }

  .team-side {
    justify-content: center !important;
    text-align: center !important;
    flex-direction: column;
  }

  .team-side.home,
  .team-side.away {
    order: 0;
  }

  .team-side.home .team-name,
  .team-side.away .team-name {
    text-align: center !important;
  }

  .score-display {
    order: 1;
  }

  .team-logo-md {
    width: 50px;
    height: 50px;
  }

  .team-name {
    font-size: 0.95rem;
    min-width: auto;
  }
}
