/* ===== CSS Custom Properties ===== */
:root {
  --accent: #00968D;
  --accent-dark: #007A72;
  --accent-light: rgba(0, 150, 141, 0.1);
  --bg-page: #f0f4f8;
  --bg-card: #ffffff;
  --text-main: #1a1a2e;
  --text-muted: #6b7280;
  --border: rgba(0, 0, 0, 0.07);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.08);
  --radius-card: 12px;
  --radius-pill: 20px;
}

/* ===== Base ===== */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
}

.container {
  padding-top: 20px;
}

/* ===== Navbar ===== */
.navbar {
  background-color: var(--accent) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 12px 0;
}
.navbar-brand {
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 1.1rem;
}
.nav-link {
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-link:hover {
  color: #ffffff !important;
}
.navbar .btn-outline-primary {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  border-radius: var(--radius-pill);
  font-weight: 600;
  padding: 4px 18px;
}
.navbar .btn-outline-primary:hover {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
}

/* ===== Buttons ===== */
.btn-primary {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
  border-radius: var(--radius-pill);
  font-weight: 600;
  padding: 8px 28px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--accent-dark) !important;
  border-color: var(--accent-dark) !important;
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== Accordion ===== */
.accordion-item {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-card) !important;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.accordion-button {
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card);
}
.accordion-button:not(.collapsed) {
  background-color: var(--accent-light);
  color: var(--accent);
  box-shadow: none;
}
.accordion-button:focus {
  box-shadow: none;
  border-color: transparent;
}

/* ===== Match cards ===== */
.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.match_wrapper {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  margin: 10px;
}

.match-missing {
  background-color: #fff5f5;
  border-left: 4px solid #e63946;
}

.team-flag {
  width: 42px;
  height: 42px;
  margin-right: 5px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.team-name {
  font-weight: 600;
  text-align: left;
  margin-left: 0;
  color: var(--text-main);
}

.score-input {
  width: 38px;
  height: 38px;
  text-align: center;
  border-radius: var(--radius-pill);
  border: 1.5px solid #d1d5db;
  background: #f9fafb;
  font-weight: 700;
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-right: 5px;
}
.score-input:focus {
  border-color: var(--accent);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-light);
}
.score-input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
}

.game_time {
  text-align: center;
  font-size: 0.8rem;
  margin: 8px 0 0;
  color: var(--text-muted);
}

.score {
  display: inline-block;
  width: 120px;
}

.invalid {
  border: 2px solid red;
}

.error-message {
  color: red;
  margin-top: 5px;
}

.winner_selection {
  display: flex;
  align-items: center;
  justify-content: start;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 4px;
}

.form-select {
  width: 50%;
  margin: 5px;
  border-radius: 10px;
  border: 1.5px solid #d1d5db;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== Image wrappers ===== */
.img_wrapper {
  height: 100%;
  margin: 10%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.centered-image {
  max-width: 100%;
  max-height: 100%;
}

/* ===== Countdown ===== */
.countdown {
  height: 100%;
  margin-top: 5%;
  font-size: 150%;
  color: white;
  padding: 10px;
  display: flex;
  justify-content: space-between;
}

.countdown_numbers {
  font-size: 150%;
  background-color: rgb(0, 150, 141);
  color: white;
  padding: 10px;
  text-align: center;
  font-weight: bold;
}

@media (max-width: 768px) {
  .countdown {
    margin-top: 1%;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ===== Tables ===== */
.table {
  font-size: small;
}

.table-container {
  overflow: auto;
}

@media (max-width: 1024px) {
  .table-container {
    max-height: 400px;
  }
}

/* ===== Results page ===== */
.match {
  position: relative;
}

.info-icon {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 20px;
  cursor: pointer;
}

.match-results-tooltip {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #f1f1f1;
  padding: 10px;
  border-radius: 5px;
  display: none;
  z-index: 1;
}

.match:hover .match-results-tooltip {
  display: block;
}

.match-results-container {
  display: flex;
  justify-content: center;
}

.match-result {
  display: flex;
  align-items: center;
}

.date {
  width: 100px;
  text-align: right;
  padding-right: 10px;
}

/* ===== Summary ===== */
.summary-container {
  display: flex;
  justify-content: space-between;
}

.summary-item {
  text-align: center;
  font-weight: bold;
}

.summary-item :first-child {
  margin-bottom: 0px;
}

.summary-label {
  margin: 0px;
}

/* ===== Match card scroll container ===== */
.matches-scroll-container {
  display: flex;
  gap: 0;
}

/* Desktop: wrap into rows of 2 */
@media (min-width: 768px) {
  .matches-scroll-container {
    flex-wrap: wrap;
  }
  .matches-scroll-container .match_wrapper {
    flex: 1 1 calc(50% - 20px);
    min-width: 0;
  }
}

/* Mobile: horizontal thumb-scroll with snap */
@media (max-width: 767px) {
  .matches-scroll-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .matches-scroll-container::-webkit-scrollbar {
    display: none;
  }
  .matches-scroll-container .match_wrapper {
    flex: 0 0 85%;
    scroll-snap-align: start;
  }
}

/* ===== Scroll dots (mobile only) ===== */
.scroll-dots {
  display: none;
}

@media (max-width: 767px) {
  .scroll-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px 0 2px;
  }
  .scroll-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #ccc;
    transition: background-color 0.2s;
    flex-shrink: 0;
  }
  .scroll-dot.active {
    background-color: var(--accent);
  }
}

/* ===== Leaderboard ===== */
.leaderboard-table {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: none !important;
  font-size: 0.95rem;
}
.leaderboard-table thead th {
  background-color: var(--accent);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: none;
  padding: 14px 12px;
}
.leaderboard-table tbody tr {
  border-left: 4px solid transparent;
  transition: background 0.15s;
  border-bottom: 1px solid #f3f4f6;
}
.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}
.leaderboard-table tbody tr:hover {
  background: #f0fdf9;
}
.leaderboard-table tbody tr:nth-child(1) { border-left-color: #f59e0b; }
.leaderboard-table tbody tr:nth-child(2) { border-left-color: #9ca3af; }
.leaderboard-table tbody tr:nth-child(3) { border-left-color: #c2824a; }
.leaderboard-table td,
.leaderboard-table th {
  border: none;
  padding: 18px 14px;
  vertical-align: middle;
}
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f3f4f6;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}
.leaderboard-table tbody tr:nth-child(1) .rank-badge {
  background: #fef3c7;
  color: #d97706;
}
.leaderboard-table tbody tr:nth-child(2) .rank-badge {
  background: #f3f4f6;
  color: #6b7280;
}
.leaderboard-table tbody tr:nth-child(3) .rank-badge {
  background: #fde8d8;
  color: #c2824a;
}
.rank-movement {
  display: inline;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 4px;
}
.rank-movement.up   { color: #00968D; }
.rank-movement.down { color: #e63946; }
