@font-face {
  font-family: 'Peyda';
  src: url('fonts/woff2/PeydaWebFaNum-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Peyda';
  src: url('fonts/woff2/PeydaWebFaNum-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Peyda';
  src: url('fonts/woff2/PeydaWebFaNum-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Peyda';
  src: url('fonts/woff2/PeydaWebFaNum-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Peyda';
  src: url('fonts/woff2/PeydaWebFaNum-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-app: #080b12;
  --bg-card: rgba(22, 29, 47, 0.7);
  --bg-card-hover: rgba(30, 41, 67, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --primary: #00d2ff;
  --primary-glow: rgba(0, 210, 255, 0.3);
  --accent-purple: #a855f7;
  --accent-gold: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-pill: 24px;
  --transition: all 0.22s ease-in-out;
  --font-family: 'Peyda', system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 80px;
}

body[dir="rtl"] { direction: rtl; }
body[dir="ltr"] { direction: ltr; }

/* Top Header */
.app-header {
  position: sticky;
  top: 0;
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 24px;
}

.brand-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand-title span {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
}

.lang-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  font-family: inherit;
}

/* Category Nav Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab-pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  font-family: inherit;
}

.tab-pill.active {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.25), rgba(168, 85, 247, 0.25));
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 12px var(--primary-glow);
}

/* Search Bar */
.search-container {
  padding: 0 16px 16px;
}

.search-input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

.search-input-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
}

/* VIP Banner */
.vip-banner {
  margin: 0 16px 18px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vip-content h3 {
  font-size: 0.95rem;
  color: var(--accent-gold);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vip-content p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.vip-btn {
  background: linear-gradient(135deg, var(--accent-gold), #ea580c);
  color: #000;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 0 16px;
}

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.media-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.media-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #111726;
  display: block;
}

.media-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.media-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.media-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.media-badge.badge-ongoing {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.media-badge.badge-ended {
  background: rgba(71, 85, 105, 0.92);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.media-badge.badge-coming-soon {
  background: rgba(245, 158, 11, 0.95);
  color: #000;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Modal Sheet for Details */
.sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  display: flex;
  align-items: flex-end;
}

.sheet-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.sheet-content {
  width: 100%;
  background: #101626;
  border-top: 1px solid var(--border-glass);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 40px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-overlay.active .sheet-content {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.sheet-poster-img {
  width: 68px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.sheet-header-text {
  flex: 1;
  min-width: 0;
}

.sheet-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

.download-links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.download-link-item {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.download-link-item:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.download-btn {
  background: linear-gradient(135deg, var(--primary), #0284c7);
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

/* Audio Player for Music */
.audio-player-bar {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Movie Franchise Collection styling */
.collection-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-top: 8px;
  scrollbar-width: thin;
}

.collection-part-card {
  min-width: 105px;
  max-width: 105px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  text-align: center;
}

.collection-part-card:hover, .collection-part-card.active {
  border-color: var(--primary);
  background: rgba(0, 210, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.25);
}

.collection-part-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}

.collection-part-info {
  padding: 6px 4px;
}

.collection-part-order {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.collection-part-title {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  display: block;
}

.collection-part-year {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Mini App Series Episodes & Season Tabs
   ========================================================================== */
.mini-season-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.mini-season-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  font-family: inherit;
}

.mini-season-pill.active {
  background: linear-gradient(135deg, var(--primary), #0284c7);
  color: #0b0f19;
  border-color: var(--primary);
  font-weight: 700;
}

.mini-episodes-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mini-episode-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: var(--transition);
}

.mini-episode-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.mini-episode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 4px 2px;
  border-radius: 8px;
  transition: var(--transition);
}

.mini-episode-header:hover {
  opacity: 0.92;
}

.mini-ep-thumb {
  width: 48px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mini-ep-thumb:hover, .mini-ep-thumb:active {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(0, 210, 255, 0.3);
}

.mini-ep-thumb-fallback {
  width: 48px;
  height: 70px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* Lightbox Photo Modal */
.photo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.photo-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.photo-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: photoModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes photoModalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.photo-modal-content img {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 30px rgba(0, 210, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.photo-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  z-index: 10;
  transition: background 0.2s, transform 0.2s;
}

.photo-modal-close:hover {
  background: rgba(239, 68, 68, 0.9);
  transform: scale(1.1);
}

.photo-modal-caption {
  margin-top: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  text-align: center;
  direction: rtl;
}

.mini-ep-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  display: inline-block;
}

.mini-ep-count-badge {
  font-size: 0.72rem;
  color: var(--primary);
  background: rgba(0, 210, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(0, 210, 255, 0.2);
}

.mini-ep-duration {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
}

.mini-ep-body {
  transition: all 0.2s ease;
}

.mini-ep-links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mini-quality-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  transition: var(--transition);
}

.mini-quality-btn:hover {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.18), rgba(99, 102, 241, 0.18));
  border-color: var(--primary);
  transform: translateY(-1px);
}

.mini-q-tag {
  font-weight: 700;
  color: var(--primary);
}

.mini-q-size {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.mini-q-icon {
  font-size: 0.85rem;
  color: var(--primary);
}

/* ==========================================================================
   In-App Toast Notification
   ========================================================================== */
.app-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  opacity: 0;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 440px;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 99999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.2);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  font-family: inherit;
  direction: rtl;
  text-align: right;
}

.app-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.app-toast.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(10, 32, 24, 0.96);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.25);
}

.app-toast.toast-error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(38, 16, 20, 0.96);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
}

.app-toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(36, 28, 12, 0.96);
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.25);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-msg {
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-word;
}

.toast-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Category Filter Chips for Series */
.series-type-chips {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.series-type-chips::-webkit-scrollbar {
  display: none;
}
.type-chip {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.type-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.type-chip.active {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.2), rgba(168, 85, 247, 0.25));
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--primary-glow);
}

