/* CSS Variables - Design Tokens */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-header: 'Outfit', sans-serif;
  
  /* Color Palette matching the LaTeX template */
  --bg-deep: #0b0125;         /* Border Blue - RGB(11, 1, 37) */
  --bg-navy: #0e2b5c;         /* Navy Blue - RGB(14, 43, 92) */
  --gold: #d4af37;            /* Gold - RGB(212, 175, 55) */
  --dark-green: #052918;      /* Dark Green - RGB(5, 41, 24) */
  
  /* Custom shades for HSL layouts */
  --bg-card: rgba(14, 43, 92, 0.15);
  --bg-card-hover: rgba(14, 43, 92, 0.25);
  --border-gold: rgba(212, 175, 55, 0.4);
  --border-gold-focus: rgba(212, 175, 55, 1);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-gold: #f6e093;
  --green-accent: #10b981;
  --red-accent: #ef4444;
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(at 10% 20%, rgba(5, 41, 24, 0.4) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(14, 43, 92, 0.4) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 1, 37, 0.8);
}
::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #bfa032;
}

/* Main Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Section */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  background: rgba(11, 1, 37, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-main);
}

.header-logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo-img {
  max-height: 55px;
  width: auto;
}

.header-titles h1 {
  font-family: var(--font-header);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff 30%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.header-titles h2 {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.2rem;
}

/* Stats Summary Widget */
.stats-widget {
  display: flex;
  gap: 1rem;
}

.stat-card {
  background: rgba(5, 41, 24, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.15);
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 130px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 175, 55, 0.4);
}

.stat-card.points {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.05);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-header);
  color: var(--text-main);
}

.stat-card.points .stat-val {
  color: var(--text-gold);
}

/* Navigation Tabs */
.tab-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.nav-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(212, 175, 55, 0.15);
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  cursor: pointer;
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(14, 43, 92, 0.25);
  border-color: var(--gold);
}

.nav-btn.active {
  color: var(--bg-deep);
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  background: rgba(14, 43, 92, 0.3);
  color: var(--text-main);
  border: 1px solid rgba(212, 175, 55, 0.25);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold);
}

.action-btn.danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red-accent);
}

.action-btn.randomize {
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
}

.action-btn.randomize:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: #8b5cf6;
}

/* Main Content Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* SECTION HEADERS */
.groups-layout-header, .bracket-layout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.groups-layout-header h3, .bracket-layout-header h3 {
  font-family: var(--font-header);
  font-size: 1.4rem;
  color: var(--text-gold);
  margin-bottom: 0.25rem;
}

.section-help {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* View Mode Toggles */
.view-toggle-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(14, 43, 92, 0.25);
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 0.35rem 0.5rem;
  border-radius: 30px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 0.5rem;
}

.toggle-buttons {
  display: flex;
  gap: 0.25rem;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.toggle-btn:hover {
  color: var(--text-main);
}

.toggle-btn.active {
  background: var(--gold);
  color: var(--bg-deep);
}

/* TAB 1: GROUP STAGE GRID */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: 1.5rem;
}

/* For sequence view mode we might force 1-column list of matches */
.groups-grid.sequence-view {
  grid-template-columns: 1fr;
  max-width: 1400px;
  margin: 0 auto;
}

.sequence-layout-container {
  display: grid;
  grid-template-columns: 290px 1fr 290px;
  gap: 1.5rem;
  align-items: start;
}

.side-standings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 145px;
  max-height: calc(100vh - 175px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Scrollbar styling for side standings if they overflow */
.side-standings::-webkit-scrollbar {
  width: 4px;
}
.side-standings::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 2px;
}

.mini-standings-card {
  background: rgba(14, 43, 92, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 0.6rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: border-color var(--transition-fast);
}

.mini-standings-card:hover {
  border-color: var(--gold);
}

.mini-standings-card .group-header {
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  padding-bottom: 0.2rem;
  margin-bottom: 0.35rem;
}

.mini-standings-card .group-header h4 {
  font-size: 0.85rem;
  color: var(--text-gold);
}

.mini-standings-card .standings-table {
  margin-bottom: 0;
  font-size: 0.72rem;
}

.mini-standings-card .standings-table td, 
.mini-standings-card .standings-table th {
  padding: 0.15rem;
}

.center-matches {
  min-width: 0;
}

@media (max-width: 1200px) {
  .sequence-layout-container {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }
  .side-standings {
    position: static;
    max-height: none;
    overflow-y: visible;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
  }
  .left-standings {
    order: 2;
  }
  .center-matches {
    order: 1;
  }
  .right-standings {
    order: 3;
  }
}

.group-card {
  background: var(--bg-card);
  border: 1.5px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.group-card:hover {
  border-color: var(--gold);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.group-header h4 {
  font-family: var(--font-header);
  font-size: 1.25rem;
  color: var(--text-gold);
}

.group-flags {
  display: flex;
  gap: 0.25rem;
}

.group-flags img {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Group Standings Table */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.standings-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.standings-table td {
  padding: 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.standings-table tr:last-child td {
  border-bottom: none;
}

.standings-table .team-name-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standings-table img {
  width: 16px;
  height: 11px;
}

.standings-table th.num, .standings-table td.num {
  text-align: center;
  width: 25px;
}

.standings-table th.pts, .standings-table td.pts {
  text-align: center;
  font-weight: 700;
  color: var(--text-gold);
  width: 30px;
}

/* Matches List */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.match-item {
  background: rgba(11, 1, 37, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: background-color var(--transition-fast);
}

.match-item:hover {
  background: rgba(11, 1, 37, 0.7);
  border-color: rgba(212, 175, 55, 0.15);
}

.match-item.match-played, .ko-match-card.match-played {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

.match-item.match-played:hover, .ko-match-card.match-played:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.6);
}

.match-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  border-bottom: 1px dashed rgba(255,255,255,0.05);
  padding-bottom: 0.2rem;
}

.match-id-badge {
  background: rgba(212, 175, 55, 0.15);
  color: var(--text-gold);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}

.match-group-badge {
  background: rgba(14, 43, 92, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--text-main);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.6rem;
  font-weight: 500;
}

.match-content-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.team-display {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.team-display.home {
  justify-content: flex-end;
  text-align: right;
}

.team-display.away {
  justify-content: flex-start;
  text-align: left;
}

.team-display img {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Input Columns */
.score-inputs-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.score-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-col span {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.15rem;
  font-weight: 600;
}

.score-box-pair {
  display: flex;
  align-items: center;
  gap: 2px;
}

.score-input {
  width: 26px;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  outline: none;
  font-family: var(--font-header);
}

.score-input.pred, .ko-score-input.pred {
  border-color: rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.05);
  color: var(--text-gold);
}

.score-input.pred:focus, .ko-score-input.pred:focus {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

.score-input.actual, .ko-score-input.actual {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.05);
  color: #6ee7b7;
}

.score-input.actual:focus, .ko-score-input.actual:focus {
  border-color: var(--green-accent);
  background: rgba(16, 185, 129, 0.15);
  box-shadow: 0 0 5px rgba(16, 185, 129, 0.3);
}

/* Chrome/Safari spinner removal */
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Firefox spinner removal */
.score-input[type=number] {
  -moz-appearance: textfield;
}

.score-divider {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Points Badge */
.points-badge {
  min-width: 38px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-family: var(--font-header);
}

.points-badge.earned-5 {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.points-badge.earned-3 {
  background: rgba(52, 211, 153, 0.1);
  color: #a7f3d0;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.points-badge.earned-2 {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.points-badge.earned-1 {
  background: rgba(245, 158, 11, 0.15);
  color: #fde047;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.points-badge.earned-draw {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.points-badge.earned-0 {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}


/* TAB 2: BRACKET STYLING */
.bracket-viewport {
  overflow-x: auto;
  padding: 2rem 1rem;
  background: rgba(11, 1, 37, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 16px;
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.5);
  min-height: 700px;
}

.bracket-container {
  display: flex;
  justify-content: space-between;
  width: 2200px; /* Forces wide container for brackets */
  margin: 0 auto;
  position: relative;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  width: 230px;
  gap: 1.5rem;
}

.bracket-round h4 {
  text-align: center;
  font-family: var(--font-header);
  font-size: 0.85rem;
  color: var(--text-gold);
  border-bottom: 1px solid rgba(212,175,55,0.2);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bracket-round .match-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-around;
}

/* Knockout Match Cards */
.ko-match-card {
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 0.4rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  position: relative;
  transition: all var(--transition-fast);
}

.ko-match-card:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
  transform: scale(1.02);
}

.ko-match-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.15rem;
  margin-bottom: 0.3rem;
}

.ko-match-team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.2rem;
  border-radius: 4px;
}

.ko-match-team-row.winner-predicted {
  background: rgba(16, 185, 129, 0.08);
}

.ko-match-team-row.winner-actual {
  border-left: 3px solid var(--green-accent);
}

.ko-team-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ko-team-info img {
  width: 16px;
  height: 11px;
  border-radius: 1px;
}

.ko-placeholder-text {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-style: italic;
}

.ko-score-inputs {
  display: flex;
  gap: 0.25rem;
}

.ko-score-input {
  width: 34px;
  height: 30px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 4px;
  outline: none;
}

.ko-score-input:focus {
  border-color: var(--gold);
}

/* Hide number input spinners on knockout inputs */
.ko-score-input::-webkit-outer-spin-button,
.ko-score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ko-score-input {
  -moz-appearance: textfield;
}

/* Overridden by general pred/actual rules */

.ko-points-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  border-top: 1px dashed rgba(255,255,255,0.05);
  padding-top: 0.15rem;
}

/* Bracket Connector SVG Overlay */
.bracket-connectors-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Center stage finals layout */
.center-finals {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.trophy-display {
  text-align: center;
  margin-bottom: 1rem;
}

.trophy-display i {
  font-size: 4rem;
  color: var(--gold);
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
  margin-bottom: 0.5rem;
}

.trophy-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-gold);
  letter-spacing: 2px;
}


/* TAB 3: STATS & RULES */
.stats-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1.5px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
}

.card h3 {
  font-family: var(--font-header);
  color: var(--text-gold);
  font-size: 1.3rem;
  border-bottom: 1px solid rgba(212,175,55,0.25);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* Rules List */
.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rules-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rule-score {
  min-width: 55px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-family: var(--font-header);
  font-size: 0.9rem;
}

.rule-score.rule-5 { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid var(--green-accent); }
.rule-score.rule-3 { background: rgba(52, 211, 153, 0.15); color: #a7f3d0; border: 1px solid #34d399; }
.rule-score.rule-2 { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid #3b82f6; }
.rule-score.rule-1 { background: rgba(245, 158, 11, 0.15); color: #fde047; border: 1px solid #f59e0b; }
.rule-score.rule-draw { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid #8b5cf6; }
.rule-score.rule-0 { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid var(--red-accent); }

.rule-desc {
  font-size: 0.85rem;
  color: var(--text-main);
}

.rule-desc strong {
  color: var(--text-gold);
}

/* Breakdown Analysis */
.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.breakdown-item {
  background: rgba(11, 1, 37, 0.5);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breakdown-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breakdown-count {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-gold);
}

.total-summary-card {
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 1rem;
}

.total-summary-card h4 {
  font-family: var(--font-header);
  color: var(--text-gold);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}

.metric-row:last-child {
  border-bottom: none;
  font-weight: 700;
  color: var(--text-gold);
  font-size: 0.95rem;
}


/* Footer Section */
.app-footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: auto;
}

/* Responsiveness Settings */
@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .stats-widget {
    width: 100%;
    justify-content: space-between;
  }
  .stats-layout {
    grid-template-columns: 1fr;
  }
  .groups-layout-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .groups-grid {
    grid-template-columns: 1fr;
  }
  .stat-card {
    min-width: 100px;
  }
}

/* Single Group View Mode Styles */
.single-view {
  grid-template-columns: 1fr !important;
  max-width: 800px;
  margin: 0 auto;
}

.single-group-layout-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.group-sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  background: rgba(14, 43, 92, 0.25);
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 0.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sub-nav-btn {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-header);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.sub-nav-btn:hover {
  color: var(--text-main);
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--gold);
}

.sub-nav-btn.active {
  background: var(--gold);
  color: var(--bg-deep);
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.single-group-card-wrapper {
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}

/* Country Details Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 1, 37, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0e2b5c;
  border: 2px solid var(--gold);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-main);
  animation: modalSlideIn 0.3s ease forwards;
}

@keyframes modalSlideIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  background: rgba(11, 1, 37, 0.4);
}

.modal-title-sec {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-country-flag {
  width: 32px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  object-fit: cover;
}

.modal-header h3 {
  font-family: var(--font-header);
  color: var(--text-gold);
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--gold);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-deep);
}

.modal-stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.modal-stat {
  flex: 1;
  background: rgba(14, 43, 92, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-stat .m-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.modal-stat .m-val {
  font-family: var(--font-header);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-gold);
}

.modal-body h4 {
  font-family: var(--font-header);
  color: var(--text-gold);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.15);
  padding-bottom: 0.25rem;
}

.modal-matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-match-item {
  background: rgba(14, 43, 92, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-match-item .m-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.modal-match-item .m-type-badge {
  background: rgba(14, 43, 92, 0.4);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
}

.modal-match-item .m-id-badge {
  background: rgba(212, 175, 55, 0.15);
  color: var(--text-gold);
  padding: 1px 5px;
  border-radius: 4px;
}

.modal-match-item .m-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-match-item .m-team {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  width: 30%;
  color: var(--text-muted);
}

.modal-match-item .m-team.home {
  justify-content: flex-end;
  text-align: right;
}

.modal-match-item .m-team.away {
  justify-content: flex-start;
  text-align: left;
}

.modal-match-item .m-team img {
  width: 18px;
  height: 12px;
  border-radius: 1px;
}

.modal-match-item .m-team.active-country {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 0 5px rgba(212, 175, 55, 0.4);
}

.modal-match-item .m-scores {
  font-size: 0.72rem;
  text-align: center;
  width: 40%;
  line-height: 1.3;
}

.modal-match-item .score-lbl {
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-right: 0.25rem;
}

.modal-match-item .m-points {
  width: 10%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-gold);
  text-align: right;
}

/* Interactivity style for country names */
.team-name {
  cursor: pointer;
  transition: color var(--transition-fast);
}

.team-name:hover {
  color: var(--gold) !important;
  text-decoration: underline;
}

/* Fix Plotly modebar floating outside container */
.modebar-container {
  top: 15px !important;
  right: 15px !important;
}
