:root {
  --primary: #0458a3;
  --primary-dark: #034679;
  --primary-light: #1a78c9;
  --secondary: #ebbf3c;
  --accent: #ffd96a;
  --bg-dark: #0a0e27;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #b8c5d6;
  --border-glass: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.3);
  --gradient-1: linear-gradient(135deg, #0458a3 0%, #034679 100%);
  --gradient-2: linear-gradient(135deg, #0458a3 0%, #1a78c9 100%);
  --gradient-3: linear-gradient(135deg, #ebbf3c 0%, #ffd96a 100%);
}

.live-page-section {
  font-family: "Cairo", sans-serif;
  min-height: 100vh;
  background: #f8faff;
  background-image: linear-gradient(135deg, #e8f1f8 0%, #f5f7fa 50%, #fff9f0 100%);
  color: #002a41;
  background-attachment: fixed;
  transition: all 0.3s ease;
}

body.dark-mode .live-page-section {
  background: var(--bg-dark);
  color: var(--text-primary);
  background-image: radial-gradient(circle at 20% 50%, rgba(4, 88, 163, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(235, 191, 60, 0.1) 0%, transparent 50%);
}

body:not(.dark-mode) .channel-card {
  background: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border-color: #eee;
}

body:not(.dark-mode) .channel-name {
  color: #002a41;
}

body:not(.dark-mode) .category-pill {
  background: #fff;
  color: #002a41;
  border-color: #ddd;
}

body:not(.dark-mode) .search-box {
  background: #fff;
  border-color: #ddd;
  color: #002a41;
}

.search-container {
  flex: 1;
  max-width: 500px;
  position: relative;
  margin: 0 auto;
}

.search-box {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  background: var(--bg-card);
  border: 2px solid var(--border-glass);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: "Cairo", sans-serif;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.search-box:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 20px rgba(0, 102, 255, 0.3);
}

.load-more-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 2.5rem;
}

.load-more-btn {
  padding: 0.7rem 2.5rem;
  border: none;
  border-radius: 999px;
  background: var(--gradient-2);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 10px 25px rgba(4, 88, 163, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(4, 88, 163, 0.35);
}

.search-icon {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.live-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: center;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-tabs {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-tab {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 2px solid var(--border-glass);
  background: var(--bg-card);
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.page-tab.active {
  background: var(--gradient-2);
  color: #fff;
  border-color: var(--primary);
}

.categories {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-top: 16px;
  padding-bottom: 16px;
}

.category-pill {
  padding: 0.7rem 1.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border-glass);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.95rem;
  backdrop-filter: blur(10px);
}

.category-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.category-pill.active {
  background: var(--gradient-2);
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.4);
  color: white;
}

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

@media (max-width: 768px) {
  .channels-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 1.2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.channel-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-2);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.channel-card:hover::before {
  opacity: 0.1;
}

.channel-card:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(0, 102, 255, 0.3);
}

.channel-card > * {
  position: relative;
  z-index: 1;
}

.live-tv .channel-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: 15px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-glass);
  transition: all 0.3s ease;
  display: block;
  padding: 5px;
}

.live-movies .channel-icon,
.live-series .channel-icon {
  width: 110px;
  height: 160px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-glass);
  transition: all 0.3s ease;
  display: block;
}

.live-series .channel-card {
  text-decoration: none;
  color: inherit;
}

.channel-card:hover .channel-icon {
  transform: scale(1.05);
  border-color: var(--primary);
}

.channel-name {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.player-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}

.player-modal.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.player-container {
  width: 90%;
  max-width: 1000px;
  max-height: 92vh;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.player-header {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#videoPlayer {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
  display: block;
}

.player-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem 1rem;
  color: #fff;
  font-weight: 600;
}

.player-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.player-loading-inline.hidden {
  display: none;
}

.close-btn {
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: #ff4757;
  transform: rotate(90deg);
}

.player-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
  overflow: visible;
}

.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2;
  color: #fff;
  font-weight: 600;
  text-align: center;
  padding: 1rem;
}

.player-loading.hidden {
  display: none;
}

#videoPlayer {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
  display: block;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-container {
  text-align: center;
  padding: 3rem;
}

.loading-text {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.status-text {
  text-align: center;
  color: #fff;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.series-page {
  padding-top: 0;
}

.header-spacer {
  height: 90px;
}

.series-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stream-layout {
  display: block;
}

.auth-locked .stream-content {
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}



@media (max-width: 992px) {
  .stream-layout {
    grid-template-columns: 1fr;
  }
}

.stream-content {
  min-width: 0;
}

.account-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 1.25rem;
  color: inherit;
  backdrop-filter: blur(10px);
  height: fit-content;
}

.account-panel {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 300px;
  z-index: 100001;
  display: none;
}

.account-toggle {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: none;
  background: var(--gradient-2);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 1.25rem;
  transform: rotate(180deg);
}

.account-panel.open .account-arrow {
  transform: rotate(0deg);
}

.account-panel .account-sidebar {
  display: none;
}

.account-panel.open .account-sidebar {
  display: block;
}

@media (max-width: 576px) {
  .account-panel {
    left: 12px;
    right: 12px;
    width: auto;
  }
}

.account-sidebar {
  direction: rtl;
  text-align: right;
}

body:not(.dark-mode) .account-sidebar {
  background: #fff;
  border-color: #ddd;
  color: #002a41;
}

.account-header {
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.account-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.95rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

.status-badge.status-active {
  background: #18a058;
  color: #fff;
}

.account-item:last-child {
  border-bottom: none;
}

.logout-btn {
  margin-top: 1rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: none;
  background: var(--gradient-2);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.login-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.login-modal.active {
  display: flex;
}

.login-card {
  width: 92%;
  max-width: 420px;
  background: #0b1026;
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  color: #fff;
}

.login-card h3 {
  margin-bottom: 1rem;
  font-weight: 700;
}

.login-field {
  margin-bottom: 0.75rem;
}

.login-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.login-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: none;
  background: var(--gradient-2);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.login-message {
  margin-top: 0.75rem;
  text-align: center;
  color: #ffd96a;
}

.login-help {
  margin-top: 0.35rem;
  text-align: center;
  color: #b8c5d6;
  font-size: 0.9rem;
}
