/* DAFTsports — Dark Theme, Mobile-First */
:root {
  --bg: #0a0a0f;
  --surface: #14141f;
  --surface-hover: #1c1c2e;
  --border: #2a2a3e;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --accent: #6c5ce7;
  --accent-hover: #7c6cf7;
  --live: #e74c3c;
  --live-glow: rgba(231, 76, 60, 0.3);
  --green: #2ecc71;
  --yellow: #f39c12;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-brand span {
  color: var(--accent);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ---- Login ---- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
}

.login-title {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-title span { color: var(--accent); }

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.login-error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--live);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  text-align: center;
}

.tab:hover { background: var(--surface-hover); }

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab .live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--live);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Match List ---- */
.match-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s;
}

.match-card:hover { border-color: var(--accent); }

.match-card.live {
  border-left: 3px solid var(--live);
  box-shadow: inset 4px 0 8px var(--live-glow);
}

.match-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
}

.match-competition {
  color: var(--accent);
  font-weight: 500;
}

.match-time {
  color: var(--text-muted);
}

.match-time.live {
  color: var(--live);
  font-weight: 600;
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.team-name {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.team-name.away { text-align: right; }

.match-score {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0 16px;
  min-width: 80px;
  text-align: center;
}

.match-score.upcoming {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

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

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.channel-badge.has-stream {
  color: var(--green);
  border-color: var(--green);
  background: rgba(46, 204, 113, 0.1);
}
.channel-badge.no-feed {
  color: var(--yellow);
  border-color: var(--yellow);
  background: rgba(243, 156, 18, 0.1);
}
.channel-badge.not-televised {
  color: var(--text-muted);
  opacity: 0.6;
}
.channel-badge.clickable {
  cursor: pointer;
  user-select: none;
}
.channel-badge.clickable:hover {
  filter: brightness(1.2);
}
.badge-arrow {
  font-size: 0.65rem;
  margin-left: 2px;
}

/* Feeds list (expandable) */
.feeds-list {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--border);
}
.feeds-section { margin-bottom: 4px; }
.feeds-section.unavailable { opacity: 0.6; }
.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
}
.feed-item + .feed-item { border-top: 1px solid rgba(255,255,255,0.05); }
.feed-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.feed-flag { font-size: 1.1rem; flex-shrink: 0; }
.feed-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-item.available .feed-name { color: var(--text); }
.feed-no-stream {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.btn-watch-feed {
  padding: 4px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.btn-watch-feed:hover { background: var(--accent-hover); }

.btn-watch {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-watch:hover { background: var(--accent-hover); }

/* ---- Player ---- */
.player-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.8);
  z-index: 201;
}

.player-title {
  font-size: 0.9rem;
  font-weight: 500;
}

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

.btn-close-player {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  padding: 4px 8px;
}

.player-video {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-video video {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  background: #000;
}

/* ---- Loading / Empty States ---- */
.loading, .empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  margin: 16px auto 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---- Responsive ---- */
@media (min-width: 600px) {
  .match-list { padding: 24px; }
  .match-card { padding: 20px; }
  .match-score { font-size: 1.75rem; }
}

@media (min-width: 900px) {
  .match-list {
    max-width: 900px;
  }
}
