/* ============================================================
   AL GHAZALEEN TEA — COMPETITION PAGE
   ============================================================ */

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

:root {
  --red: #b22924;
  --red-dim: #8a1e1b;
  --gold: #fecc18;
  --gold-dim: #c9a00f;
  --black: #000000;
  --white: #ffffff;
  --gray: #32373c;
  --light: #fafafa;
  --muted: #abb8c3;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  font-family: 'Tajawal', sans-serif;
  color: var(--black);
  background: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   HEADER
   ============================================================ */
.comp-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 5vw;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.comp-logo img { height: 45px; width: auto; }

.back-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red);
  transition: color 0.3s ease;
}

.back-link:hover { color: var(--gold); }

/* ============================================================
   HERO
   ============================================================ */
.comp-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8rem 5vw 4rem;
  background: linear-gradient(135deg, var(--red) 0%, #d4453e 50%, var(--red-dim) 100%);
  overflow: hidden;
}

.hero-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(254, 204, 24, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
}

.hero-badge {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-title .gold { color: var(--gold); }
.hero-title .red { color: var(--white); text-shadow: 0 2px 20px rgba(0,0,0,0.3); }

.hero-subtitle {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 2.5rem;
}

/* Countdown */
.hero-countdown {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  direction: ltr;
}

.countdown-item {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  min-width: 70px;
  text-align: center;
}

.countdown-num {
  display: block;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

.countdown-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.3rem;
  display: block;
}

.countdown-sep {
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.4);
  align-self: center;
  padding-bottom: 1rem;
}

.hero-cta {
  display: inline-block;
  padding: 1rem 3rem;
  background: var(--gold);
  color: var(--black);
  font-size: 1.1rem;
  font-weight: 800;
  border-radius: 8px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}

.hero-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(254, 204, 24, 0.4);
}

/* Floating Leaves */
.floating-leaves {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.leaf {
  position: absolute;
  font-size: 2rem;
  opacity: 0.2;
  animation: floatLeaf 8s ease-in-out infinite;
}

.l1 { top: 15%; right: 10%; animation-delay: 0s; }
.l2 { top: 40%; left: 8%; animation-delay: 1.5s; font-size: 1.5rem; }
.l3 { bottom: 20%; right: 20%; animation-delay: 3s; }
.l4 { top: 60%; left: 15%; animation-delay: 4.5s; font-size: 1.2rem; }
.l5 { bottom: 35%; right: 5%; animation-delay: 6s; font-size: 1.8rem; }

@keyframes floatLeaf {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(15deg); }
}

/* ============================================================
   SECTION COMMON
   ============================================================ */
.section-heading {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--black);
}

/* ============================================================
   PRIZES
   ============================================================ */
.comp-prizes {
  padding: 5rem 5vw;
  background: var(--light);
}

/* Hide the hero text until cms-loader has populated it from JSON.
   Prevents the visible flash where the hardcoded styled text shows
   for ~150ms before being overwritten with plain CMS textContent.
   The .cms-pending class is removed by:
     - js/cms-loader.js at the end of injectCompPage (preferred path)
     - comp.js after a 1500ms timeout (fallback if CMS fetch is slow
       or fails — the hardcoded fallback text becomes visible). */
html.cms-pending .hero-title,
html.cms-pending .hero-subtitle {
  visibility: hidden;
}

.prizes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

/* When the CMS configures only a single prize, collapse to a centered
   single column instead of leaving the lone card pinned to the start
   of a 2-column grid (which lands on the right side under RTL). */
.prizes-grid:has(> .prize-card:only-child) {
  grid-template-columns: 1fr;
  max-width: 400px;
}

.prize-card {
  text-align: center;
  padding: 3rem 2rem;
  border-radius: 16px;
  transition: transform 0.4s var(--ease);
}

.prize-card:hover { transform: translateY(-6px); }

.prize-main {
  background: linear-gradient(135deg, var(--red), var(--red-dim));
  color: var(--white);
}

.prize-secondary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--black);
}

.prize-icon { font-size: 3rem; margin-bottom: 1rem; }
.prize-count {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.prize-card h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.prize-card p {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ============================================================
   STEPS
   ============================================================ */
.comp-steps {
  padding: 5rem 5vw;
}

.steps-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  text-align: center;
  flex: 1;
  max-width: 240px;
}

.step-num {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.step h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.step p {
  font-size: 0.9rem;
  color: var(--gray);
}

.step-arrow {
  font-size: 1.5rem;
  color: var(--gold);
  font-weight: 900;
}

/* ============================================================
   FORM
   ============================================================ */
.comp-form-section {
  padding: 5rem 5vw;
  background: var(--light);
}

/* Progress Bar */
.form-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 3rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.progress-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0e0e0;
  color: var(--gray);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s var(--ease);
}

.progress-step.active .progress-dot {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(178, 41, 36, 0.3);
}

.progress-step.done .progress-dot {
  background: var(--gold);
  color: var(--black);
}

.progress-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.progress-step.active .progress-label { color: var(--red); }
.progress-step.done .progress-label { color: var(--gold-dim); }

.progress-line {
  flex: 1;
  height: 3px;
  background: #e0e0e0;
  margin: 0 0.5rem;
  margin-bottom: 1.5rem;
  transition: background 0.4s var(--ease);
}

.progress-line.active { background: var(--gold); }

/* Form Steps */
.comp-form {
  max-width: 550px;
  margin: 0 auto;
}

.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeInUp 0.5s var(--ease);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--gray);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.3s ease;
  direction: rtl;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--red);
}

.form-group input.error,
.form-group select.error {
  border-color: var(--red);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn-next,
.btn-submit {
  width: 100%;
  padding: 1rem;
  background: var(--red);
  color: var(--white);
  font-family: 'Tajawal', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s var(--ease);
  margin-top: 0.5rem;
}

.btn-next:hover,
.btn-submit:hover {
  background: var(--red-dim);
  transform: translateY(-2px);
}

/* Captcha */
.captcha-box {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.2rem;
  margin: 1.5rem 0;
  text-align: center;
}

.captcha-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--black);
  margin-bottom: 0.8rem;
}

.captcha-box input {
  width: 120px;
  padding: 0.7rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  direction: ltr;
}

.captcha-box input:focus {
  outline: none;
  border-color: var(--red);
}

.captcha-error {
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.btn-back {
  padding: 0.8rem 1.5rem;
  background: transparent;
  color: var(--gray);
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-back:hover {
  border-color: var(--gray);
}

.form-nav {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-nav .btn-submit { flex: 1; }

/* Quiz Card */
.quiz-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.quiz-icon { font-size: 3rem; margin-bottom: 1rem; }

/* Consent step */
.consent-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.consent-heading {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--black);
  margin-bottom: 0.6rem;
  text-align: center;
}

.consent-intro {
  color: var(--gray);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 1.4rem;
}

.consent-terms-list {
  list-style: none;
  padding: 0 0;
  margin: 0 0 1.4rem 0;
  border: 1px solid #efe6e1;
  border-radius: 12px;
  background: #fdfaf7;
  max-height: 280px;
  overflow-y: auto;
}

.consent-terms-list li {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0e8e2;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #444;
}

.consent-terms-list li:last-child { border-bottom: none; }

.consent-terms-list li .term-icon {
  flex-shrink: 0;
  font-size: 1.05rem;
  margin-top: 1px;
}

.consent-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #fff8e6;
  border: 2px solid #fecc18;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
}

.consent-checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--red);
  flex-shrink: 0;
  cursor: pointer;
}

.consent-checkbox-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black);
  line-height: 1.5;
}

.btn-next:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}
.btn-next:disabled:hover {
  background: #ccc;
  transform: none;
}

.quiz-question {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.quiz-option {
  cursor: pointer;
}

.quiz-option input { display: none; }

.option-box {
  display: block;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  transition: all 0.3s var(--ease);
}

.quiz-option input:checked + .option-box {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(178, 41, 36, 0.25);
}

.option-box:hover {
  border-color: var(--red);
}

/* Success */
.success-card {
  text-align: center;
  padding: 3rem;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

.success-icon { font-size: 4rem; margin-bottom: 1rem; }

.success-card h3 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--red);
  margin-bottom: 0.5rem;
}

.success-card > p {
  color: var(--gray);
  margin-bottom: 2rem;
}

.share-section {
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.share-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 1rem;
}

.share-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--white);
  transition: transform 0.3s var(--ease);
}

.share-btn:hover { transform: translateY(-2px); }

.share-btn.whatsapp { background: #25D366; }
.share-btn.facebook { background: #1877F2; }

/* ============================================================
   TERMS
   ============================================================ */
.comp-terms {
  padding: 5rem 5vw;
}

.terms-card {
  max-width: 700px;
  margin: 0 auto;
}

.term-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid #eee;
}

.term-item:last-child { border-bottom: none; }

.term-icon { font-size: 1.5rem; flex-shrink: 0; }

.term-item p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--gray);
}

/* ============================================================
   FOOTER
   ============================================================ */
.comp-footer {
  text-align: center;
  padding: 3rem 5vw;
  background: #1a1a1a;
  color: var(--white);
}

.comp-footer img { margin-bottom: 1rem; }

.comp-footer p {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.footer-copy {
  font-size: 0.8rem;
  color: #555;
  margin-top: 1rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .comp-header { padding: 0.6rem 4vw; }
  .comp-logo img { height: 35px; }

  .hero-title { font-size: clamp(2rem, 8vw, 3rem); }
  .countdown-item { min-width: 55px; padding: 0.7rem 0.8rem; }
  .countdown-num { font-size: 1.5rem; }

  .prizes-grid { grid-template-columns: 1fr; max-width: 400px; }

  .steps-row { flex-direction: column; }
  .step-arrow { transform: rotate(-90deg); }

  .form-row { grid-template-columns: 1fr; }

  .quiz-card { padding: 1.5rem; }

  .share-buttons { flex-direction: column; }
}

@media (max-width: 480px) {
  .hero-countdown { gap: 0.3rem; }
  .countdown-item { min-width: 48px; padding: 0.6rem; }
  .countdown-sep { font-size: 1.5rem; }
  .prize-card { padding: 2rem 1.5rem; }
}
