/* ============================================================
   Seren Coupon Page - Andalus Opening
   Theme: deep green on warm light background, mobile-first RTL.
   ============================================================ */

:root {
  --color-primary: #4f5829;
  --color-primary-700: #3d4520;
  --color-primary-50: #eeefd9;
  --color-accent: #b89466;
  --color-bg: #f4efe0;
  --color-bg-alt: #faf6e8;
  --color-surface: #ffffff;
  --color-text: #1c1c1c;
  --color-muted: #6b6b6b;
  --color-border: #e0d9c4;
  --color-error: #b3261e;
  --color-success: #4a6b1f;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 8px rgba(15, 61, 46, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 61, 46, 0.10);

  --font-body: "Tajawal", "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --transition: 180ms ease;
}

html[lang="en"] body {
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(79, 88, 41, 0.10), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(184, 148, 102, 0.10), transparent 60%),
    var(--color-bg);
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--color-primary);
}

/* ---------- layout ---------- */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 18px;
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 22px;
  border: 1px solid rgba(15, 61, 46, 0.06);
}

.page__footer {
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ---------- brand header ---------- */

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0 0 18px;
  text-align: center;
}

.brand__logo-img {
  width: 130px;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.brand__divider {
  display: block;
  width: 40px;
  height: 2px;
  background: var(--color-primary);
  opacity: 0.25;
  margin: 6px auto 8px;
  border-radius: 2px;
}

.lang-switch {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  transition: var(--transition);
  letter-spacing: 0.02em;
}

.lang-switch:hover,
.lang-switch:focus-visible {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  outline: none;
}

.brand__tag {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

/* ---------- views ---------- */

.view { display: none; }
.view--active { display: block; }
[hidden] { display: none !important; }

.title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.4;
}

.subtitle {
  margin: 0 0 22px;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- form ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label,
.field__label {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary-700);
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="date"] {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  outline: none;
  font-size: 15px;
}

.field input::placeholder { color: #a89f8c; }

.field input:focus {
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 88, 41, 0.12);
}

.field input.invalid {
  border-color: var(--color-error);
  background: #fdf4f4;
}

.field__hint {
  font-size: 12px;
  color: var(--color-muted);
}

.field__error {
  min-height: 14px;
  color: var(--color-error);
  font-size: 12.5px;
  font-weight: 500;
}

/* Gender group */
.gender {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gender__option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.gender__option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.gender__option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
  color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

/* Buttons */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  width: 100%;
  border: 1.5px solid transparent;
  transition: var(--transition);
  position: relative;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover  { background: var(--color-primary-700); }
.btn--primary:active { transform: translateY(1px); }

.btn--primary[disabled],
.btn--primary.is-loading {
  opacity: 0.85;
  cursor: not-allowed;
}

.btn--ghost {
  background: var(--color-primary-50);
  color: var(--color-primary);
  border-color: rgba(15, 61, 46, 0.15);
}

.btn--ghost:hover { background: #dfeae3; }

.btn--link {
  background: transparent;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 6px;
  margin-top: 14px;
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.btn.is-loading .btn__spinner { display: inline-block; }
.btn.is-loading .btn__label { opacity: 0.7; }

@keyframes spin { to { transform: rotate(360deg); } }

.copy__default,
.copy__done { display: inline; }
.copy__done { display: none; color: var(--color-success); }
.btn--ghost.is-copied .copy__default { display: none; }
.btn--ghost.is-copied .copy__done    { display: inline; }

.legal {
  margin: 14px 0 0;
  color: var(--color-muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.7;
}

/* ---------- success ---------- */

.success { text-align: center; }

.success__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-primary-50);
  color: var(--color-success);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-sm);
}

.coupon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-700));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  margin: 18px 0 14px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.coupon::before,
.coupon::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: var(--color-surface);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}
.coupon::before { right: -11px; }
.coupon::after  { left: -11px; }

.coupon__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 10px;
}

.coupon__code {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0 0 14px;
  font-family: "Tajawal", monospace;
  word-break: break-all;
}

.coupon__qr {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin: 6px auto 8px;
  width: max-content;
  max-width: 200px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.coupon__qr svg {
  display: block;
  width: 160px;
  height: 160px;
}
.coupon__qr:empty { display: none; }

.coupon__qr-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.02em;
}

.coupon .btn--ghost {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.coupon .btn--ghost:hover { background: rgba(255, 255, 255, 0.24); }
.coupon .btn--ghost.is-copied { background: rgba(255, 255, 255, 0.92); color: var(--color-success); }

/* ---------- coupon action pills ---------- */

.coupon-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 18px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-pill:hover,
.btn-pill:focus-visible {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  outline: none;
}

.btn-pill svg {
  flex-shrink: 0;
  stroke-width: 2;
}

.btn-pill__default,
.btn-pill__done { display: inline; }
.btn-pill__done { display: none; color: var(--color-success); }
.btn-pill.is-copied { background: var(--color-primary-50); border-color: var(--color-primary); }
.btn-pill.is-copied .btn-pill__default { display: none; }
.btn-pill.is-copied .btn-pill__done    { display: inline; }
.btn-pill.is-copied svg { stroke: var(--color-success); }

.notice {
  background: #fff7e6;
  color: #7a5300;
  border: 1px solid #f0d99a;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.7;
}

/* ---------- error view ---------- */

.error { text-align: center; }
.error__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fde9e7;
  color: var(--color-error);
  font-weight: 900;
  font-size: 36px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

/* ---------- responsive ---------- */

@media (min-width: 540px) {
  .card { padding: 34px 30px; }
  .title { font-size: 22px; }
  .coupon__code { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
