:root {
  --bg: #0e0f12;
  --bg-raised: #17191f;
  --amber: #e8a33d;
  --teal: #2bc8b0;
  --ivory: #f2f0ea;
  --muted: #9a9aa2;
  --line: #2a2c33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ivory);
  font-family: 'Tajawal', sans-serif;
  line-height: 1.6;
}

h1, h2, .eyebrow {
  font-family: 'Cairo', sans-serif;
}

/* ===== شريط الفيلم — العنصر المميز ===== */
.filmstrip {
  height: 22px;
  background: repeating-linear-gradient(
    90deg,
    #000 0 14px,
    var(--bg) 14px 22px
  );
  position: relative;
}
.filmstrip::before, .filmstrip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 6px, #000 6px 8px);
  opacity: 0.4;
}
.filmstrip-inline { margin: 0 0 24px 0; border-radius: 4px; overflow: hidden; }

/* ===== الهيدر ===== */
.hero {
  padding: 64px 24px 48px;
  text-align: center;
  background: radial-gradient(ellipse at top, #1c1e25 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.eyebrow {
  color: var(--amber);
  letter-spacing: 0.08em;
  font-weight: 600;
  font-size: 0.85rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  margin: 12px 0;
  color: var(--ivory);
}
.hero-sub { color: var(--muted); font-size: 1.05rem; }

/* ===== المسرح الرئيسي ===== */
.stage {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.reel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.reel-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}
.reel-label span {
  color: var(--bg);
  background: var(--amber);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
}
.reel-body { padding: 22px; }

.hint { color: var(--muted); font-size: 0.92rem; margin: 0 0 16px; }

textarea, input[type="text"], input[type="number"], select {
  background: #0b0c0f;
  border: 1px solid var(--line);
  color: var(--ivory);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
}
textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
}
textarea:focus, input:focus, select:focus, button:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.row label { color: var(--muted); font-size: 0.9rem; }
.row input[type="number"] { width: 70px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ivory) !important;
  cursor: pointer;
  font-size: 0.92rem;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
  cursor: pointer;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--amber); color: #201400; }
.btn-secondary { background: var(--teal); color: #00201b; }
.btn-large { padding: 14px 28px; font-size: 1rem; }

/* ===== قائمة المشاهد ===== */
.scenes-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.scene-card {
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scene-card .scene-num {
  color: var(--amber);
  font-weight: 700;
  font-size: 0.85rem;
}
.scene-card textarea { min-height: 50px; font-size: 0.88rem; }

/* ===== شبكة المقاطع ===== */
.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.clip-card {
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.clip-card video { width: 100%; border-radius: 6px; background: #000; }
.status-badge {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 20px;
  width: fit-content;
}
.status-pending { background: #2a2c33; color: var(--muted); }
.status-processing { background: #3a2e12; color: var(--amber); }
.status-done { background: #123a2e; color: var(--teal); }
.status-failed { background: #3a1212; color: #ff8080; }

/* ===== التايم لاين ===== */
.timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
}
.timeline-item {
  min-width: 140px;
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.timeline-item video { width: 100%; border-radius: 4px; }
.timeline-item .order-btns { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.timeline-item .order-btns button {
  padding: 4px 8px;
  font-size: 0.8rem;
  background: var(--line);
  color: var(--ivory);
}

.edit-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.edit-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.edit-group label { color: var(--muted); font-size: 0.88rem; }

.merged-preview, .final-result { margin-top: 18px; }
.merged-preview video, .final-result video, .img2vid-panel video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.img2vid-panel { flex-direction: column; align-items: stretch; }
.img2vid-panel #img2vidResult:empty { display: none; }
.final-result a.download {
  display: inline-block;
  margin-top: 12px;
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px;
}

@media (max-width: 600px) {
  .hero { padding: 48px 16px 36px; }
  .reel-body { padding: 16px; }
}

/* ===== بوابة تسجيل الدخول ===== */
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top, #1c1e25 0%, var(--bg) 70%);
  padding: 24px;
}
.auth-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.auth-card h2 {
  font-family: 'Cairo', sans-serif;
  margin: 10px 0 22px;
  font-size: 1.4rem;
}
.auth-card form { text-align: right; }
.auth-card input { width: 100%; }
.auth-card .btn-large { width: 100%; margin-top: 6px; }
.auth-error {
  color: #ff8080;
  font-size: 0.85rem;
  min-height: 18px;
  margin: 6px 0;
}
.auth-toggle {
  background: none;
  border: none;
  color: var(--teal);
  margin-top: 16px;
  font-weight: 600;
  text-decoration: underline;
}

/* ===== شريط علوي بعد الدخول ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.topbar span { color: var(--muted); font-size: 0.9rem; }

/* ===== مساعد الدعم العائم ===== */
.support-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 100;
}
.support-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--amber);
  color: #201400;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  border: none;
  cursor: pointer;
}
.support-panel {
  position: absolute;
  bottom: 68px;
  left: 0;
  width: 320px;
  max-width: 85vw;
  height: 420px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.support-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
}
.support-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  padding: 4px;
}
.support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.support-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  max-width: 85%;
  line-height: 1.5;
}
.support-msg-bot {
  background: #0b0c0f;
  align-self: flex-start;
}
.support-msg-user {
  background: var(--teal);
  color: #00201b;
  align-self: flex-end;
}
.support-input-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.support-input-row input {
  flex: 1;
}
.support-input-row button {
  padding: 8px 14px;
  font-size: 0.85rem;
}
.faq-list {
  max-height: 140px;
  overflow-y: auto;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--line);
}
.faq-title {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 8px;
}
.faq-item {
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.faq-item summary {
  cursor: pointer;
  color: var(--amber);
  font-weight: 600;
}
.faq-item p {
  color: var(--muted);
  margin: 6px 0 0;
  padding-right: 10px;
}

/* ===== الباقات والدفع ===== */
.current-plan-box {
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 0.92rem;
  color: var(--muted);
}
.current-plan-box strong { color: var(--teal); }
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.plan-card {
  background: #0b0c0f;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-card.plan-current {
  border-color: var(--teal);
}
.plan-card h3 {
  font-family: 'Cairo', sans-serif;
  margin: 0;
  color: var(--amber);
}
.plan-price {
  font-size: 1.6rem;
  font-weight: 800;
}
.plan-price span { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.plan-quota { color: var(--muted); font-size: 0.88rem; }
.plan-paypal-slot { min-height: 45px; margin-top: 8px; }
.plan-badge-current {
  background: var(--teal);
  color: #00201b;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  align-self: center;
}

/* ===== الصفحة التعريفية (Landing Page) ===== */
.landing-page .hero { border-bottom: none; }
.landing-page .btn-large { margin-top: 22px; }
.hero-cta-note {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 10px;
  opacity: 0.85;
}

.landing-steps {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}
.landing-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.landing-step {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.landing-step-num {
  display: inline-block;
  color: var(--bg);
  background: var(--amber);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  text-align: center;
  line-height: 34px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  margin-bottom: 14px;
}
.landing-step h3 {
  font-family: 'Cairo', sans-serif;
  margin: 0 0 8px;
  color: var(--ivory);
}
.landing-step p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.6;
}

.landing-audience {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  text-align: center;
}
.landing-audience h2 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.6rem;
  margin-bottom: 12px;
}
.landing-audience p {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.7;
}

.landing-faq {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 80px;
}
.landing-faq h2 {
  font-family: 'Cairo', sans-serif;
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 24px;
}
.landing-faq-list { display: flex; flex-direction: column; gap: 12px; }
.landing-faq-item {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
}
.landing-faq-item summary {
  cursor: pointer;
  color: var(--ivory);
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
}
.landing-faq-item p {
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.7;
}

/* ===== تأثيرات الإضاءة الخلفية بالهيرو ===== */
.landing-page .hero {
  position: relative;
  overflow: hidden;
  min-height: 560px;
}
.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
  animation: glow-float 9s ease-in-out infinite;
}
.hero-glow-1 {
  width: 340px; height: 340px;
  background: var(--amber);
  top: -80px; left: -60px;
}
.hero-glow-2 {
  width: 300px; height: 300px;
  background: var(--teal);
  bottom: -100px; right: -40px;
  animation-delay: -4.5s;
}
@keyframes glow-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.15); }
}

/* ===== مجسم كلابر (Clapperboard) ثلاثي الأبعاد بـ CSS ===== */
.clapper-scene {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding-bottom: 50px;
  perspective: 900px;
}
.clapper-3d {
  width: 200px;
  height: 150px;
  position: relative;
  transform-style: preserve-3d;
  animation: clapper-spin 12s linear infinite;
}
@keyframes clapper-spin {
  0%   { transform: rotateY(0deg) rotateX(8deg); }
  100% { transform: rotateY(360deg) rotateX(8deg); }
}
.clapper-body {
  position: absolute;
  inset: 0;
  top: 26px;
  background:
    repeating-linear-gradient(45deg, var(--bg) 0 14px, var(--ivory) 14px 28px);
  border: 3px solid var(--bg);
  border-radius: 6px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.clapper-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 34px;
  background:
    repeating-linear-gradient(-45deg, var(--bg) 0 14px, var(--amber) 14px 28px);
  border: 3px solid var(--bg);
  border-radius: 6px;
  transform-origin: top left;
  animation: clapper-clap 3s ease-in-out infinite;
}
@keyframes clapper-clap {
  0%, 15%, 100% { transform: rotateX(0deg); }
  7% { transform: rotateX(-25deg); }
}

/* ===== حركة عند تمرير الفأرة على خطوات الشرح ===== */
.landing-step {
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.landing-step:hover {
  transform: translateY(-6px);
  border-color: var(--amber);
}

@media (prefers-reduced-motion: reduce) {
  .hero-glow, .clapper-3d, .clapper-top, .landing-step { animation: none !important; transition: none !important; }
}

/* ===== نافذة الحفظ (بعد ما يخلص تجهيز الفيديو) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-box {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
.modal-box h3 {
  font-family: 'Cairo', sans-serif;
  margin: 0 0 8px;
  font-size: 1.3rem;
}
.modal-box p { color: var(--muted); font-size: 0.9rem; margin: 0 0 18px; }
.modal-box .edit-group { text-align: right; margin-bottom: 8px; }
.modal-box select { width: 100%; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ===== أيقونات SVG لخطوات الشرح ===== */
.step-icon {
  width: 56px;
  height: 56px;
  margin: 4px 0 12px;
}
.step-icon .icon-stroke {
  stroke: var(--ivory);
  fill: none;
}
.step-icon .icon-accent {
  fill: var(--amber);
}
.landing-step:hover .icon-stroke {
  stroke: var(--teal);
  transition: stroke 0.3s ease;
}
.landing-step:hover .icon-accent {
  fill: var(--teal);
  transition: fill 0.3s ease;
}
