/* =========================================================================
   CastX TV Plus - Cyberpunk Cyan & Space Blue Sports/IPTV Theme
   ========================================================================= */

:root {
  --primary: #00f0ff;
  --primary-dark: #0072ff;
  --primary-glow: rgba(0, 240, 255, 0.35);

  --bg-main: #060911;
  --bg-surface: #0c1220;
  --bg-card: rgba(16, 24, 40, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(0, 240, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.07);

  --text-main: #ffffff;
  --text-muted: #8e9bb2;
  --text-dim: #54627a;

  --accent-red: #ff3366;
  --accent-green: #00f59b;
  --accent-gold: #ffbe0b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-main: 'Cairo', sans-serif;
  --font-en: 'Outfit', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #05070c;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00f0ff, #0072ff);
  border-radius: 999px;
  border: 2px solid #05070c;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #67e8f9, #00f0ff);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}
* {
  scrollbar-width: thin;
  scrollbar-color: #00f0ff #05070c;
}

.text-cyan { color: var(--primary); }
.neon-cyan {
  color: var(--primary);
  text-shadow: 0 0 15px var(--primary-glow);
}

/* =========================================================================
   1. Header Navigation
   ========================================================================= */
.castx-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 9, 17, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-glass);
  padding: 12px 24px;
}

.header-container {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Brand */
.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 18px var(--primary-glow);
  transition: transform 0.3s ease;
}

.brand-box:hover .brand-logo {
  transform: scale(1.08);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-en);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.1;
}

.brand-name span {
  color: var(--primary);
  text-shadow: 0 0 14px var(--primary-glow);
}

.brand-tag {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--primary);
  background: rgba(0, 240, 255, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  display: inline-block;
  align-self: flex-start;
  margin-top: 2px;
}

/* Nav Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #000;
  background: linear-gradient(135deg, var(--primary), #00c2ff);
  font-weight: 800;
  box-shadow: 0 4px 18px var(--primary-glow);
}

/* Search Wrap & Hub Button */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrap {
  position: relative;
  width: 280px;
}

.search-wrap input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 8px 38px 8px 34px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-wrap input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
  width: 320px;
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.clear-btn {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
}

.hub-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.hub-btn:hover {
  color: #fff;
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--primary);
}

/* =========================================================================
   2. Mobile Navigation
   ========================================================================= */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(8, 12, 20, 0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: 8px 10px;
  justify-content: space-around;
}

.m-nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
}

.m-nav-item i {
  font-size: 1.15rem;
}

.m-nav-item.active {
  color: var(--primary);
}

/* =========================================================================
   3. Hero Banner
   ========================================================================= */
.castx-hero {
  position: relative;
  background: radial-gradient(circle at 50% -20%, rgba(0, 240, 255, 0.18), transparent 70%), #080c14;
  border-bottom: 1px solid var(--border-glass);
  padding: 50px 24px 40px;
  text-align: center;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 250px;
  background: var(--primary-glow);
  filter: blur(100px);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 860px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.hero-headline {
  font-size: 2.4rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.3;
}

.hero-subtext {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* =========================================================================
   4. Section Panes
   ========================================================================= */
.main-content {
  max-width: 1560px;
  margin: 0 auto 80px;
  padding: 24px;
}

.section-pane {
  display: none;
}

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

.section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 15px;
}

.section-heading {
  font-size: 1.55rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.refresh-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  transform: rotate(30deg);
}

/* =========================================================================
   5. Matches Grid & Match Cards
   ========================================================================= */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.match-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px var(--primary-glow);
}

.match-league-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
}

.match-status-tag {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: var(--accent-red);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.match-status-tag.live {
  background: rgba(0, 245, 155, 0.15);
  border-color: rgba(0, 245, 155, 0.4);
  color: var(--accent-green);
}

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

.team-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 40%;
  text-align: center;
}

.team-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.team-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.match-center-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-text {
  font-family: var(--font-en);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary-glow);
}

.match-time-text {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.match-footer-info {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.match-watch-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #000;
  border: none;
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.match-watch-btn:hover {
  box-shadow: 0 0 15px var(--primary-glow);
}

/* =========================================================================
   6. Categories Strip & Channel Cards
   ========================================================================= */
.categories-scroll-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.cat-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.cat-pill:hover {
  color: #fff;
  border-color: rgba(0, 240, 255, 0.3);
}

.cat-pill.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.category-banner {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 20px;
}

.cat-banner-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cat-banner-info h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-count-badge {
  background: var(--primary);
  color: #000;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

/* Channel Card */
.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
}

.channel-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7), 0 0 15px var(--primary-glow);
}

.channel-logo-wrap {
  position: relative;
  width: 100%;
  height: 120px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(8, 12, 20, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.channel-logo-wrap img {
  max-height: 80px;
  max-width: 80%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s ease;
}

.channel-card:hover .channel-logo-wrap img {
  transform: scale(1.08);
}

.live-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}

.servers-count-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--primary);
  border: 1px solid var(--border-glass);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.channel-card-body {
  padding: 12px 14px;
  text-align: center;
}

.channel-card-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =========================================================================
   7. Live Video Player Modal
   ========================================================================= */
.player-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.player-modal-overlay.active {
  display: flex;
}

.player-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
}

.player-modal-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 960px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
  animation: modalPop 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.player-modal-header {
  padding: 12px 20px;
  background: rgba(12, 18, 32, 0.95);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-ch-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 4px;
}

.player-ch-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.player-ch-cat {
  font-size: 0.75rem;
  color: var(--primary);
}

.player-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fav-action-btn, .close-player-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.fav-action-btn:hover { color: var(--primary); }
.close-player-btn:hover { background: var(--accent-red); }

/* Video Wrapper */
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

.player-loader {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 700;
  gap: 12px;
}

.player-loader i {
  font-size: 2.4rem;
}

.player-modal-footer {
  padding: 14px 20px;
  background: rgba(12, 18, 32, 0.95);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.servers-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
}

.servers-pill-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.server-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.server-pill:hover {
  color: #fff;
  border-color: var(--primary);
}

.server-pill.active {
  background: var(--primary);
  color: #000;
  font-weight: 800;
  border-color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 300;
  background: rgba(12, 18, 32, 0.95);
  border: 1px solid var(--primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  display: none;
  animation: slideUp 0.3s ease;
}

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

.loading-box i {
  color: var(--primary);
  font-size: 2.2rem;
  margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 900px) {
  .nav-links, .hub-btn { display: none; }
  .mobile-nav { display: flex; }
  .search-wrap { width: 220px; }
  .matches-grid { grid-template-columns: 1fr; }
  .channels-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .hero-headline { font-size: 1.8rem; }
}
