/* assets/css/external-tournament.css
 *
 * Styles for /external/tournament-schedule.php — the guest-facing
 * tournament view. Uses the `ext-` prefix and a more vibrant, web-friendly
 * design language than the admin grid (rounded corners, color-coded badges,
 * hover effects).
 *
 * Color tokens follow the team-roster page conventions so the two pages
 * feel like family.
 */

/* ============================================================
 * Page shell
 * ============================================================ */

body.ext-tournament-body {
  background: #f1f5f9;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
}

.ext-tournament-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
}

.ext-tournament-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.ext-tournament-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 320px;
  min-width: 0;
}

.ext-tournament-icon {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ext-tournament-icon i {
  font-size: 28px;
  color: #fbbf24;
}

.ext-tournament-text { min-width: 0; }

.ext-tournament-name {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.ext-tournament-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 6px;
  font-size: 13px;
  color: #cbd5e1;
}
.ext-tournament-meta i {
  margin-right: 3px;
  vertical-align: -2px;
}
.ext-tournament-meta-sep {
  opacity: 0.5;
}

.ext-tournament-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.ext-tournament-gf-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #cbd5e1;
}
.ext-tournament-gf-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.ext-tournament-gf-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.ext-tournament-gf-by {
  font-size: 10px;
  opacity: 0.7;
}
.ext-tournament-gf-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.ext-tournament-stats {
  display: flex;
  gap: 18px;
}
.ext-tournament-stat {
  text-align: center;
}
.ext-tournament-stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.ext-tournament-stat-label {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
 * Main content
 * ============================================================ */

.ext-tournament-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.ext-tournament-empty {
  background: #fff;
  border-radius: 12px;
  padding: 64px 24px;
  text-align: center;
  color: #64748b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.ext-tournament-empty i {
  font-size: 48px;
  color: #cbd5e1;
  display: block;
  margin-bottom: 12px;
}
.ext-tournament-empty h2 {
  margin: 0 0 6px;
  color: #1e293b;
  font-size: 18px;
}
.ext-tournament-empty p { margin: 0; font-size: 14px; }

/* Day tabs */
.ext-tournament-day-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.ext-day-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  text-align: left;
  min-width: 100px;
}
.ext-day-tab:hover { border-color: #cbd5e1; }
.ext-day-tab.is-active {
  border-color: #0284c7;
  background: rgba(2,132,199,0.04);
}
.ext-day-tab-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.ext-day-tab-date {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.1;
  margin: 2px 0;
}
.ext-day-tab-count {
  font-size: 11px;
  color: #94a3b8;
}
.ext-day-tab.is-active .ext-day-tab-date { color: #0284c7; }

/* Team filter */
.ext-tournament-filter { margin-bottom: 16px; }
.ext-tournament-search {
  position: relative;
}
.ext-tournament-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  font-size: 16px;
}
.ext-tournament-search input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  font-size: 14px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  box-sizing: border-box;
}
.ext-tournament-search input:focus {
  outline: 2px solid #0284c7;
  outline-offset: -1px;
}

/* Day panels */
.ext-tournament-day-panel { display: none; }
.ext-tournament-day-panel.is-active { display: block; }

.ext-tournament-games {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Game card */
.ext-game-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s, transform 0.15s;
}
.ext-game-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ext-game-card.is-cancelled { opacity: 0.55; }
.ext-game-card.is-live      { box-shadow: 0 0 0 2px #ef4444, 0 4px 12px rgba(239,68,68,0.2); }
.ext-game-card.is-final     { border-left: 3px solid #10b981; }

/* Time block */
.ext-game-time {
  flex: 0 0 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 12px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  text-align: center;
}
.ext-game-time-main {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.ext-game-time-end {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Matchup body */
.ext-game-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 14px;
  min-width: 0;
}

.ext-game-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.ext-game-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ext-game-team--away { justify-content: flex-end; flex-direction: row-reverse; }

.ext-game-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.ext-game-logo--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ext-game-team-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.ext-game-score {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1e293b;
  margin-left: 4px;
}
.ext-game-team--away .ext-game-score { margin-left: 0; margin-right: 4px; }

.ext-game-vs {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.04em;
}
.ext-game-vs-label { text-transform: uppercase; }

.ext-game-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}
.ext-game-info i {
  margin-right: 3px;
  vertical-align: -1px;
}
.ext-game-info-sep { opacity: 0.5; }

/* Tail (status + watch) */
.ext-game-tail {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  border-left: 1px solid #e2e8f0;
  min-width: 80px;
}

.ext-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.ext-badge--scheduled { background: #f1f5f9; color: #475569; }
.ext-badge--final     { background: #d1fae5; color: #065f46; }
.ext-badge--cancelled { background: #f3f4f6; color: #6b7280; }
.ext-badge--live      { background: #ef4444; color: #fff; }

.ext-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: ext-live-pulse 1.4s ease-in-out infinite;
}
@keyframes ext-live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.ext-watch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #0284c7;
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s;
}
.ext-watch-btn:hover { background: #0369a1; }

.ext-no-results {
  text-align: center;
  padding: 40px 16px;
  color: #94a3b8;
  font-size: 14px;
}
.ext-no-results i {
  font-size: 24px;
  display: block;
  margin-bottom: 6px;
}

/* Footer */
.ext-tournament-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}
.ext-tournament-footer p { margin: 0; }
.ext-tournament-footer i { margin-right: 4px; vertical-align: -1px; }

/* ============================================================
 * Password gate (unauthorized landing)
 * ============================================================ */

.ext-tournament-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.ext-tournament-gate-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.ext-tournament-gate-icon {
  width: 64px;
  height: 64px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.ext-tournament-gate-icon i { font-size: 28px; color: #64748b; }
.ext-tournament-gate-card h1 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #1e293b;
}
.ext-tournament-gate-card p {
  margin: 0 0 20px;
  font-size: 14px;
  color: #64748b;
}
.ext-tournament-gate-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ext-tournament-gate-card input[type="password"] {
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.ext-tournament-gate-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  background: #0284c7;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ext-tournament-gate-card button:hover { background: #0369a1; }

/* ============================================================
 * Mobile — tighten the game cards
 * ============================================================ */

@media (max-width: 600px) {
  .ext-tournament-header-inner {
    padding: 16px;
  }
  .ext-tournament-name { font-size: 18px; }
  .ext-tournament-stats { gap: 12px; }
  .ext-tournament-stat-num { font-size: 18px; }
  .ext-tournament-header-right { width: 100%; justify-content: space-between; }

  .ext-tournament-main { padding: 12px 12px 32px; }

  .ext-game-card {
    flex-wrap: wrap;
  }
  .ext-game-time {
    flex: 0 0 64px;
  }
  .ext-game-time-main { font-size: 13px; }

  .ext-game-tail {
    flex: 1 1 100%;
    flex-direction: row;
    justify-content: space-between;
    border-left: 0;
    border-top: 1px solid #e2e8f0;
    min-width: 0;
    padding: 8px 14px;
  }
  .ext-game-matchup {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .ext-game-team--away { flex-direction: row; justify-content: flex-start; }
  .ext-game-vs { text-align: left; padding-left: 36px; }
}

