@font-face {
  font-family: "YekanTicket";
  src: url("../fonts/yekan/Yekan Bakh FaNum 04 Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanTicket";
  src: url("../fonts/yekan/Yekan Bakh FaNum 05 Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanTicket";
  src: url("../fonts/yekan/Yekan Bakh FaNum 05 Medium.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanTicket";
  src: url("../fonts/yekan/Yekan Bakh FaNum 06 Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanTicket";
  src: url("../fonts/yekan/Yekan Bakh FaNum 06 Bold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanTicket";
  src: url("../fonts/yekan/Yekan Bakh FaNum 07 Heavy.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. CSS Variables & Visual Identity (پالت دقیق مستخرج از ۲ تصویر مرجع جدید)
   ========================================================================== */
:root {
  --ticket-primary-color: #C8AD71;
  --ticket-button-color: #B49452;
  --ticket-button-hover-color: #D4BC75;
  --ticket-button-pressed-color: #A27B37;
  --modal-close-color: #9C9178;
  --modal-close-hover-color: #E6CD7C;
  --ticket-detail-color: #C8AD71;
  --ticket-frame-color: #DFDFDF;
  --ticket-frame-thickness: 1.5px;
  --ticket-frame-visible: true;
  --ticket-perforation-color: #464E56;
  --ticket-detail-surface-color: #1E272E;
  --ticket-inner-surface-color: #FFFFFF;
  --ticket-content-surface-color: #FFFFFF;
  --text-primary-color: #262626;
  --text-secondary-color: #6E6D74;
  --coupon-code-color: #534C5C;
  --surface-white-color: #FFFFFF;

  --modal-backdrop: rgba(14, 18, 24, 0.76);
  --ticket-drop-shadow:
    drop-shadow(0 22px 44px rgba(0, 0, 0, 0.45))
    drop-shadow(0 4px 14px rgba(0, 0, 0, 0.22));

  --ticket-max-width: 400px;
  --ticket-corner-radius: 24px;
  --ticket-notch-radius: 22px;

  --font-fa: "YekanTicket", "Yekan", Tahoma, sans-serif;
  --ease-ticket: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-step: 280ms;
  --duration-fast: 170ms;
}

.ticket-modal,
.ticket-modal *,
.ticket-modal *::before,
.ticket-modal *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-fa);
}

.ticket-modal .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   2. Modal Backdrop & Dialog Container
   ========================================================================== */
.ticket-modal {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--modal-backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
  overscroll-behavior: contain;
  direction: rtl;
  color: var(--text-primary-color);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 250ms var(--ease-ticket),
    visibility 250ms var(--ease-ticket);
}

.ticket-modal[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ticket-modal__dialog {
  position: relative;
  width: 100%;
  max-width: var(--ticket-max-width);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(0) scale(1);
  transition: transform 280ms var(--ease-ticket);
}

.ticket-modal[aria-hidden="true"] .ticket-modal__dialog {
  transform: translateY(16px) scale(0.96);
}

/* ==========================================================================
   3. Portrait Ticket Component (هدر سرمه‌ای تیره + روبان طلایی + بدنه سفید)
   ========================================================================== */
.ticket-shadow-wrap {
  filter: var(--ticket-drop-shadow);
  width: 100%;
}

.ticket {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  user-select: none;
}

.ticket__svg {
  position: absolute;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* روبان طلایی سه‌بعدی در گوشه بالای سمت راست بلیت */
.ticket__ribbon {
  position: absolute;
  top: -5px;
  right: 44px;
  width: 42px;
  height: 54px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.36));
}

.ticket__ribbon-fold {
  position: absolute;
  top: 0;
  left: -4px;
  width: 8px;
  height: 5px;
  background: #6B5528;
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.ticket__ribbon-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* دکمه بستن در گوشه بالای سمت چپ داخل هدر تیره */
.ticket-modal__topbar {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ticket-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: var(--modal-close-color);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    transform var(--duration-fast) ease;
}

.ticket-modal__close:hover {
  color: var(--modal-close-hover-color);
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.08);
}

.ticket-modal__close:active {
  transform: scale(0.95);
}

.ticket-modal__close:focus-visible {
  outline: 2px solid var(--ticket-primary-color);
  outline-offset: 2px;
}

/* بخش بالایی بلیت: هدر سرمه‌ای تیره (Stub) */
.ticket__stub {
  position: relative;
  z-index: 2;
  padding: 38px 30px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.ticket__stub-emblem {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 18px rgba(212, 188, 117, 0.42));
  transition: transform 360ms var(--ease-ticket);
}

.ticket--celebrate .ticket__stub-emblem {
  animation: emblemCelebrate 650ms var(--ease-ticket) 1;
}

@keyframes emblemCelebrate {
  0% { transform: scale(1) rotate(0deg); }
  40% { transform: scale(1.09) rotate(-3deg); }
  75% { transform: scale(1.03) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.ticket__stub-icon {
  width: 58px;
  height: 42px;
  display: block;
  overflow: visible;
}

.ticket__stub-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ticket__stub-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.ticket__stub-title-gold {
  background: linear-gradient(180deg, #E6CD7C 0%, #C4A972 60%, #AA8C4E 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--ticket-primary-color);
  font-weight: 900;
}

/* خط جداکننده بین دو بخش (Seam) */
.ticket__perforation-spacer {
  position: relative;
  z-index: 2;
  height: 2px;
  width: 100%;
  pointer-events: none;
}

/* بخش پایینی بلیت: بدنه سفید (Body) */
.ticket__body {
  position: relative;
  z-index: 2;
  padding: 36px 34px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ticket__stage-viewport {
  position: relative;
  width: 100%;
  transition: height var(--duration-step) var(--ease-ticket);
}

.ticket-step {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 220ms var(--ease-ticket),
    transform 220ms var(--ease-ticket);
}

.ticket-step--active {
  display: flex;
}

.ticket-step--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   4. Typography & Form Controls Inside White Body
   ========================================================================== */
.ticket-step__title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-primary-color);
  line-height: 1.85;
  margin-bottom: 18px;
  max-width: 320px;
}

.ticket-step__subtitle {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary-color);
  line-height: 1.7;
  margin-bottom: 14px;
  max-width: 300px;
}

.ticket-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ticket-field-wrap {
  position: relative;
  width: 100%;
}

.ticket-input {
  width: 100%;
  height: 56px;
  padding: 10px 20px;
  background: var(--ticket-content-surface-color);
  color: var(--text-primary-color);
  border: 1.25px solid #3A3A3A;
  border-radius: 12px;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  direction: ltr;
  user-select: text;
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.ticket-input::placeholder {
  color: #A0A0A5;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.ticket-input:focus {
  outline: none;
  border-color: #1E272E;
  box-shadow: 0 0 0 3px rgba(180, 148, 82, 0.22);
}

.ticket-input[aria-invalid="true"] {
  border-color: #D9383A;
  background: #FFF8F8;
  animation: ticketShake 320ms ease;
}

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

.ticket-feedback {
  min-height: 20px;
  width: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
  color: #C92A2A;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: -6px;
}

.ticket-feedback:empty {
  display: none;
}

.ticket-feedback__box {
  width: 100%;
  padding: 6px 12px;
  border-radius: 8px;
  background: #FFF3F3;
  border: 1px solid rgba(201, 42, 42, 0.25);
}

/* دکمه طلایی متالیک افقی دقیقاً منطبق با تصاویر مرجع */
.ticket-btn {
  position: relative;
  width: 100%;
  min-height: 54px;
  padding: 12px 22px;
  background: linear-gradient(
    90deg,
    var(--ticket-button-pressed-color) 0%,
    var(--ticket-button-color) 24%,
    var(--ticket-button-hover-color) 50%,
    var(--ticket-button-color) 76%,
    var(--ticket-button-pressed-color) 100%
  );
  color: #FFFFFF;
  border: 1px solid rgba(162, 123, 55, 0.45);
  border-radius: 12px;
  box-shadow:
    0 10px 24px rgba(180, 148, 82, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition:
    filter var(--duration-fast) ease,
    transform var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.ticket-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    0 14px 28px rgba(180, 148, 82, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.ticket-btn:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.97);
  box-shadow:
    0 6px 16px rgba(180, 148, 82, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.ticket-btn:focus {
  outline: none;
}

.ticket-btn:focus-visible {
  outline: 2px solid rgba(180, 148, 82, 0.55);
  outline-offset: 2px;
}

.ticket-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.ticket-btn--copied {
  filter: brightness(1.04);
  box-shadow:
    0 12px 26px rgba(180, 148, 82, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: ticketSpin 0.65s linear infinite;
}

.ticket-btn.is-loading .btn-spinner {
  display: inline-block;
}

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

/* ==========================================================================
   5. Step 2: Coupon Code Box (کادر خط‌چین مشکی با نیم‌دایره‌های جانبی مطابق تصویر اول)
   ========================================================================== */
.coupon-reveal-wrap {
  position: relative;
  width: 100%;
  margin: 4px 0 22px;
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition:
    opacity 360ms var(--ease-ticket),
    transform 420ms var(--ease-ticket);
}

.coupon-reveal-wrap.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.coupon-code-box {
  position: relative;
  min-height: 92px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px 24px;
  border: 1.6px dashed #222222;
  border-radius: 12px;
  background: #FFFFFF;
  transition:
    box-shadow 220ms ease,
    border-color 220ms ease,
    transform 220ms ease;
}

.coupon-code-box::before,
.coupon-code-box::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 1.8px solid #222222;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px #FFFFFF;
  transform: translateY(-50%);
  z-index: 2;
}

.coupon-code-box::before { right: -11px; }
.coupon-code-box::after { left: -11px; }

.coupon-code-box__sheen {
  position: absolute;
  inset: -40% auto -40% -50%;
  top: -40%;
  bottom: -40%;
  left: -50%;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(212, 188, 117, 0.25), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
}

.coupon-reveal-wrap.is-revealed .coupon-code-box__sheen {
  animation: couponSheen 900ms ease-out 240ms 1 both;
}

.coupon-code-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  direction: ltr;
  color: var(--coupon-code-color);
  font-size: clamp(1.5rem, 7vw, 1.95rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.2;
  user-select: all;
}

.coupon-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px) scale(0.75);
}

.coupon-reveal-wrap.is-revealed .coupon-char {
  animation: couponCharReveal 420ms var(--ease-ticket) calc(110ms + var(--char-index) * 65ms) both;
}

.coupon-code-box.is-copied-pulse {
  border-color: var(--ticket-button-color);
  box-shadow: 0 0 0 4px rgba(180, 148, 82, 0.18);
  transform: scale(1.015);
}

@keyframes couponCharReveal {
  60% { opacity: 1; transform: translateY(-3px) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes couponSheen {
  from { left: -50%; }
  to { left: 125%; }
}

.ticket-enjoy-note {
  margin-top: 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary-color);
  line-height: 1.65;
}

/* ==========================================================================
   6. Responsive Breakpoints (Desktop, Laptop, Tablet, Mobile)
   ========================================================================== */
@media (max-width: 480px) {
  .ticket-modal {
    padding: 16px 14px;
  }

  .ticket-modal__dialog {
    max-width: 100%;
  }

  .ticket__ribbon {
    right: 34px;
    width: 38px;
    height: 48px;
  }

  .ticket__stub {
    padding: 34px 24px 28px;
    gap: 14px;
  }

  .ticket__stub-title {
    font-size: 1.24rem;
  }

  .ticket__body {
    padding: 30px 26px 30px;
  }

  .ticket-step__title {
    font-size: 1.04rem;
    margin-bottom: 16px;
  }

  .ticket-input {
    height: 52px;
    font-size: 1.22rem;
  }

  .ticket-btn {
    min-height: 50px;
    font-size: 1.02rem;
  }

  .coupon-code-box {
    min-height: 84px;
    padding: 16px 18px;
  }
}

@media (max-width: 350px) {
  .ticket__stub {
    padding: 28px 18px 24px;
  }

  .ticket__body {
    padding: 24px 20px 26px;
  }

  .ticket__ribbon {
    right: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket-modal *,
  .ticket-modal *::before,
  .ticket-modal *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .coupon-reveal-wrap,
  .coupon-char {
    opacity: 1 !important;
    transform: none !important;
  }
}
