/* ============================================================
   TFLIX - Main Stylesheet
   Dark Theme - Live TV Streaming Website
   ============================================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1a2232;
  --bg-card-hover: #1e2a3a;
  --accent-red: #e63946;
  --accent-pink: #ff2d55;
  --accent-blue: #00b4d8;
  --accent-green: #2ecc71;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --border-color: #21262d;
  --border-dashed: #2d3748;
  --live-color: #e63946;
  --upcoming-color: #f59e0b;
  --header-bg: #0d1117;
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   HEADER / NAVBAR
   ============================================================ */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0;
}

.navbar { padding: 10px 0; min-height: 56px; }

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.navbar-brand .logo-img { height: 38px; width: auto; object-fit: contain; }

.navbar-brand .logo-text {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -1px;
  color: #fff;
}
.navbar-brand .logo-text span { color: var(--accent-pink); }

.navbar-toggler {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
}
.navbar-toggler:focus { box-shadow: none; }

.navbar-nav .nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.2s;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ============================================================
   FILTER BUTTONS
   ============================================================ */
.filter-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.filter-buttons {
  gap: 10px;
  width: 100%;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 7px 20px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-1px);
  text-decoration: none;
}
.filter-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30, 144, 255, 0.25);
}

/* ============================================================
   CATEGORY HEADER
   ============================================================ */
.category-header {
  padding: 10px 4px 6px;
}
.category-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  position: relative;
  padding-left: 10px;
}
.category-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  background: var(--accent-blue);
  border-radius: 2px;
}

/* ============================================================
   MATCH CARDS
   ============================================================ */
.matches-container { padding: 8px 0; }
.match-group { margin-bottom: 4px; }

.match-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-dashed);
  border-radius: 0;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  color: inherit;
  position: relative;
  gap: 8px;
}
.match-card:hover { background: var(--bg-card-hover); color: inherit; text-decoration: none; }

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.match-category {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.match-title-badge {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-time-info {
  font-size: 11px;
  color: var(--accent-red);
  font-weight: 600;
  margin-bottom: 4px;
}

.match-date { font-size: 11px; color: var(--text-muted); }

.match-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 4px 0;
  flex: 1;
}

.team-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 130px;
}

.team-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  display: block;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.team-logo-placeholder {
  width: 72px;
  height: 72px;
  background: var(--bg-secondary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.team-name {
  font-size: 12px;
  color: var(--text-primary);
  text-align: center;
  font-weight: 500;
}

.vs-separator {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.match-status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}
.match-status-badge.live { color: var(--live-color); }
.match-status-badge.live::before { content: '» '; }
.match-status-badge.upcoming { color: var(--upcoming-color); }
.match-status-badge.upcoming::before { content: '⏰ '; }

/* Category separator */
.category-separator {
  background: var(--bg-primary);
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

/* ============================================================
   LIVE INDICATOR
   ============================================================ */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--live-color);
  border-radius: 50%;
  margin-right: 4px;
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================================
   MATCH DETAIL / PLAYER PAGE
   ============================================================ */
.player-section {
  background: #000;
  position: relative;
  width: 100%;
}

.player-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.player-wrapper iframe,
.player-wrapper video,
#video-player {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

.stream-servers {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.stream-server-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin: 3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.stream-server-btn:hover,
.stream-server-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}
.stream-server-btn .resolution-badge {
  font-size: 10px;
  background: rgba(255,255,255,0.15);
  padding: 1px 5px;
  border-radius: 3px;
}

.match-info-section {
  background: var(--bg-secondary);
  padding: 16px;
}

.match-info-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px 0;
}

.match-info-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.match-info-team img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; display: block; }
.match-info-team .name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.match-vs { font-size: 18px; font-weight: 700; color: var(--text-muted); }

/* ============================================================
   CHANNELS PAGE
   ============================================================ */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 0;
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.channel-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}

.channel-logo { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; }

.channel-logo-placeholder {
  width: 60px;
  height: 60px;
  background: var(--bg-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-blue);
  font-weight: 700;
}

.channel-name { font-size: 12px; font-weight: 500; color: var(--text-primary); text-align: center; line-height: 1.3; }

.channel-category-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 32px 0 16px;
  margin-top: 40px;
}

.footer-logo { font-size: 22px; font-weight: 900; color: #fff; margin-bottom: 8px; }
.footer-logo span { color: var(--accent-pink); }

.footer-heading {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text-primary); }

.footer-social a {
  color: var(--text-secondary);
  font-size: 18px;
  margin-right: 12px;
  transition: color 0.2s;
}
.footer-social a:hover { color: var(--accent-blue); }

.footer-copy {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading-spinner { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border-color); border-top-color: var(--accent-blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb-section {
  padding: 10px 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.breadcrumb { margin: 0; background: transparent; }
.breadcrumb-item a { color: var(--accent-blue); text-decoration: none; font-size: 13px; }
.breadcrumb-item.active { color: var(--text-secondary); font-size: 13px; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 12px 0 8px;
  border-bottom: 2px solid var(--accent-blue);
  margin-bottom: 16px;
  display: inline-block;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-live {
  background: rgba(230,57,70,0.15);
  color: var(--live-color);
  border: 1px solid rgba(230,57,70,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-upcoming {
  background: rgba(245,158,11,0.15);
  color: var(--upcoming-color);
  border: 1px solid rgba(245,158,11,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

/* ============================================================
   SCROLL TO TOP
   ============================================================ */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,180,216,0.3);
  transition: all 0.2s;
}
.scroll-top-btn:hover { background: #0096b4; transform: translateY(-2px); }
.scroll-top-btn.visible { display: flex; }

/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */
.page-fade { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container { position: fixed; top: 70px; right: 16px; z-index: 9999; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .match-teams { gap: 14px; }
  .team-logo { width: 60px; height: 60px; }
  .team-logo-placeholder { width: 60px; height: 60px; font-size: 18px; }
  .channel-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .match-card { padding: 8px 12px; }
  .filter-btn { padding: 6px 16px; font-size: 12px; }
  .filter-buttons { gap: 8px; }
  .match-title-badge { max-width: 45%; font-size: 10px; }
}

@media (max-width: 480px) {
  .match-teams { gap: 10px; }
  .team-logo { width: 52px; height: 52px; }
  .team-logo-placeholder { width: 52px; height: 52px; font-size: 16px; }
  .channel-grid { grid-template-columns: repeat(3, 1fr); }
  .scroll-top-btn { bottom: 16px; right: 16px; }
  .filter-btn { padding: 5px 14px; font-size: 12px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-live { color: var(--live-color) !important; }
.text-upcoming { color: var(--upcoming-color) !important; }
.text-accent { color: var(--accent-blue) !important; }
.bg-card { background: var(--bg-card) !important; }
.border-custom { border-color: var(--border-color) !important; }
