:root {
  /* Light theme */
  --bg: #ffffff;
  --bg-2: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --accent: #ff3d7f;
  --accent-2: #ff9500;
  --accent-3: #0097e6;
  --accent-4: #7b2ff7;
  --text: #1a1a2e;
  --text-dim: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --gradient-main: linear-gradient(135deg, #C70808 0%, #C70808 100%);
  --gradient-warm: linear-gradient(135deg, #C70808 0%, #C70808 100%);
  --gradient-cool: linear-gradient(135deg, #C70808 0%, #C70808 100%);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Tajawal', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Cairo', sans-serif; }
a { color: inherit; text-decoration: none; }
.text-dim { color: var(--text-dim); }

/* ================ NAV ================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.logo {
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 26px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -1px;
}
.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-link {
  padding: 8px 16px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-dim);
  transition: all .2s;
}
.nav-link:hover { color: var(--accent); background: var(--surface-2); }
.search-wrap {
  margin-inline-start: auto;
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
.search-input {
  width: 100%;
  padding: 10px 42px 10px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 3px rgba(255,61,127,0.1);
}
.search-input::placeholder { color: var(--text-dim); }
.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

/* ================ HERO ================ */
.hero {
  position: relative;
  height: 520px;
  overflow: hidden;
  margin-bottom: 40px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 70%, rgba(255,255,255,0.95) 100%),
              linear-gradient(270deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
  margin: 0 auto;
  padding: 100px 32px;
  padding-inline-start: 60px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: white;
}
.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--gradient-warm);
  color: white;
  font-weight: 700;
  font-size: 13px;
  border-radius: 100px;
  margin-bottom: 16px;
  width: fit-content;
  box-shadow: 0 4px 12px rgba(255,149,0,0.4);
}
.hero-title {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 14px;
  color: white;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.hero-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  flex-wrap: wrap;
}
.hero-rating { color: var(--accent-2); font-weight: 700; }
.hero-overview {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
  margin-bottom: 26px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ================ BUTTONS ================ */
.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: 100px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform .2s, box-shadow .2s;
}
.btn-primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: 0 6px 20px rgba(255,61,127,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(255,61,127,0.5); }
.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-warm {
  background: var(--gradient-warm);
  color: white;
  box-shadow: 0 6px 20px rgba(255,149,0,0.35);
}

/* ================ SECTIONS ================ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}
.section { margin-bottom: 52px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.section-title {
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.section-title::before {
  content: '';
  width: 5px;
  height: 26px;
  background: var(--gradient-main);
  border-radius: 3px;
}
.section-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  transition: color .2s;
}
.section-link:hover { color: var(--accent-4); }

/* ================ CARDS ================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease;
  aspect-ratio: 2 / 3;
  display: block;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-cool);
  color: white;
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  text-align: center;
}
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.85) 100%);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity .3s;
  color: white;
}
.card:hover .card-overlay { opacity: 1; }
.card-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 6px;
}
.card-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}
.card-rating {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  box-shadow: var(--shadow);
}
.card-type {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.card-type.movie { background: var(--accent); color: white; }
.card-type.tv { background: var(--accent-3); color: white; }

/* ================ DETAIL PAGE ================ */
.detail-hero {
  position: relative;
  min-height: 560px;
  background-size: cover;
  background-position: center;
}
.detail-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.75) 60%, rgba(255,255,255,0.95) 100%);
}
.detail-wrap {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 32px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
  color: white;
}
.detail-poster {
  width: 100%;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.detail-info { padding-top: 20px; }
.detail-badge {
  display: inline-block;
  padding: 5px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 12px;
  border-radius: 100px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(255,61,127,0.4);
}
.detail-title {
  font-size: 48px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 10px;
  color: white;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.detail-tagline {
  color: var(--accent-2);
  font-style: italic;
  margin-bottom: 20px;
  font-size: 17px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.detail-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  margin-bottom: 22px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.detail-meta b { color: var(--accent-2); }
.detail-genres {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.detail-genre {
  padding: 6px 14px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 100px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  transition: all .2s;
}
.detail-genre:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.detail-overview {
  line-height: 1.9;
  color: rgba(255,255,255,0.95);
  margin-bottom: 28px;
  font-size: 16px;
  max-width: 800px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Cast — white background */
.cast-section {
  margin-top: 40px;
}
.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 18px;
}
.cast-item {
  text-align: center;
  padding: 14px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: all .2s;
}
.cast-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.cast-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  background: var(--surface-2);
  border: 3px solid white;
  box-shadow: var(--shadow);
}
.cast-photo-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--text-dim);
}
.cast-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
  color: var(--text);
}
.cast-char {
  font-size: 11px;
  color: var(--text-dim);
}

/* ================ APP MODAL ================ */
.app-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.app-modal.active {
  display: flex;
  animation: fadeIn .3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.app-modal-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  position: relative;
  animation: slideUp .4s;
  box-shadow: 0 25px 70px rgba(0,0,0,0.25);
}
.app-modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  transition: all .2s;
}
.app-modal-close:hover { background: var(--accent); color: white; border-color: var(--accent); }
.app-modal-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bounce 2s ease infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.app-modal-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 10px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-modal-msg {
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 28px;
  font-size: 15px;
}
.app-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.store-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: #1a1a2e;
  border: 1px solid #1a1a2e;
  border-radius: 12px;
  color: white;
  transition: all .2s;
}
.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.store-btn-icon {
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
}
.store-android .store-btn-icon { color: #3dd98f; }
.store-ios .store-btn-icon { color: white; font-size: 32px; }
.store-btn-text {
  display: flex;
  flex-direction: column;
  text-align: start;
  line-height: 1.2;
}
.store-btn-text small { font-size: 11px; color: rgba(255,255,255,0.7); }
.store-btn-text strong { font-size: 16px; }

/* ================ FOOTER ================ */
.site-footer {
  margin-top: 80px;
  padding: 36px 32px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.footer-inner p { margin: 4px 0; }
.footer-inner a { color: var(--accent); }

/* ================ CHIPS (categories & sort) ================ */
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.chip {
  padding: 8px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 14px;
  color: var(--text-dim);
  transition: all .2s;
  box-shadow: var(--shadow);
}
.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.chip.active {
  background: var(--gradient-main);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255,61,127,0.35);
}

/* ================ PAGINATION ================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  transition: all .2s;
}
.pagination a:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.pagination .current {
  background: var(--gradient-main);
  border-color: transparent;
  color: white;
}

/* ================ EMPTY ================ */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty .icon { font-size: 56px; display: block; margin-bottom: 12px; }
.empty h3 { color: var(--text); margin-bottom: 8px; font-size: 22px; }

/* ================ RESPONSIVE ================ */
@media (max-width: 900px) {
  .hero { height: 440px; }
  .hero-content { padding: 40px 20px; padding-inline-start: 20px; }
  .hero-title { font-size: 34px; }
  .detail-wrap { grid-template-columns: 1fr; padding: 40px 20px; gap: 24px; }
  .detail-poster { max-width: 240px; margin: 0 auto; }
  .detail-title { font-size: 32px; text-align: center; }
  .detail-info { padding-top: 0; text-align: center; }
  .detail-meta, .detail-genres, .detail-actions { justify-content: center; }
  .detail-overview { text-align: start; }
  .container { padding: 0 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .section-title { font-size: 22px; }
  .nav-inner { padding: 12px 16px; gap: 12px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; }
  .search-wrap { min-width: 180px; }
}