/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --navy: #1C2D3F;
  --coral: #E8675A;
  --coral-dark: #D85647;
  --coral-light: #FADED9;
  --cream: #FBF0E2;
  --cream-light: #FFFAF4;
  --sage: #5BAE8A;

  --gray-900: #1C2D3F; /* same as navy, used for primary text */
  --gray-600: #6b7c8d; /* secondary text */
  --gray-400: #b0b0b0; /* muted icons/placeholders */
  --gray-200: #e8e0d5; /* dashed lines, subtle dividers */
  --gray-100: #eee;    /* borders */
  --gray-50:  #fafafa; /* subtle fills */

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --shadow-card: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-elevated: 0 8px 24px rgba(0,0,0,0.12);

  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

body {
  font-family: Outfit, Arial, sans-serif;
  background: var(--cream);
  color: var(--navy);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   Layout shell
   ========================================================================== */

.card {
  background: #fff;
  max-width: 480px;
  width: calc(100% - 32px);
  margin: 32px 16px;
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

@media (min-width: 700px) {
  .card {
    width: 85vw;
    max-width: 1100px;
    padding: 40px 56px;
  }
}

@media (min-width: 1400px) {
  .card { width: 70vw; }
}

.banner {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: block;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

p.sub { margin: 0 0 24px; color: var(--gray-600); font-size: 14px; }

.instruction {
  font-size: 14px;
  color: var(--gray-600);
  margin: 0 0 16px;
  line-height: 1.5;
}

.intro { font-size: 14px; color: #444; line-height: 1.6; margin-bottom: 20px; }
.intro p { margin: 0 0 10px; }
.intro ul { margin: 0 0 10px; padding-left: 20px; }
.intro li { margin-bottom: 4px; }

.step-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 16px;
}

.section-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 28px 0 4px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--coral-light);
}

/* ==========================================================================
   Form fields
   ========================================================================== */

label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 6px; }

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8d8d8;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-light);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.cta-btn {
  width: 100%;
  padding: 14px;
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s ease, transform 0.15s var(--ease-bounce), box-shadow 0.15s ease;
}
.cta-btn:hover {
  background: var(--coral-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232,103,90,0.3);
}
.cta-btn:active { transform: translateY(0); }
.cta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Outline variant: same prominence/size as .cta-btn, but visually secondary
   (used e.g. for "place another order" — a clear call to action, but not
   the primary one on that screen). */
.cta-btn-outline {
  background: #fff;
  color: var(--coral);
  border: 2px solid var(--coral);
}
.cta-btn-outline:hover {
  background: var(--coral-light);
  color: var(--coral-dark);
  border-color: var(--coral-dark);
}

.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.15s ease, transform 0.15s var(--ease-bounce), box-shadow 0.15s ease;
}
.submit-btn:hover:not(:disabled) {
  background: var(--coral-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232,103,90,0.3);
}
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-btn {
  display: block;
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--navy);
  opacity: 0.6;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.link-btn:hover { opacity: 1; }

.back-link {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin: 0 0 20px;
  transition: color 0.15s ease, transform 0.15s ease;
}
.back-link:hover { color: var(--coral); transform: translateX(-2px); }

/* ==========================================================================
   Ticket type price list
   ========================================================================== */

.ticket-types-info {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--gray-50);
}
.ticket-types-info .type-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
}
.ticket-types-info .type-row span:first-child { font-weight: 600; }

/* ==========================================================================
   Messages
   ========================================================================== */

#message {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: none;
}
#message.success { background: #DDF0E7; color: var(--sage); display: block; }
#message.error { background: var(--coral-light); color: var(--coral); display: block; }

.code-error {
  color: var(--coral);
  font-size: 13px;
  margin: -8px 0 12px;
}

/* ==========================================================================
   6-digit code input
   ========================================================================== */

.code-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
}
.code-digit {
  width: 48px;
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  padding: 0;
  background: var(--gray-50);
  border: 2px solid #e4e4e4;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.code-digit:hover {
  border-color: #d0d0d0;
}
.code-digit:focus {
  outline: none;
  background: #fff;
  border-color: var(--coral);
  box-shadow: 0 0 0 4px var(--coral-light);
  transform: scale(1.06);
}
.code-digit.is-filled {
  background: #fff;
  border-color: var(--coral);
}

/* ==========================================================================
   Verified-email bar
   ========================================================================== */

.verified-email-bar {
  font-size: 13px;
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.verified-email-bar strong { color: var(--navy); }
.verified-email-bar .link-btn { display: inline; margin-top: 0; margin-left: 8px; }

/* ==========================================================================
   Custom dropdown (replaces native <select> for ticket type)
   ========================================================================== */

.custom-dropdown {
  position: relative;
  width: 100%;
  border: 1px solid #d8d8d8;
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease;
}
.custom-dropdown:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-light);
}
.custom-dropdown.open { border-color: var(--coral); }

.dropdown-selected {
  padding: 10px 36px 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dropdown-selected::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--navy);
  border-bottom: 2px solid var(--navy);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.32s var(--ease-bounce);
  pointer-events: none;
}
.custom-dropdown.open .dropdown-selected::after {
  transform: translateY(-30%) rotate(-135deg);
}

.dropdown-options {
  position: fixed; /* exact top/left/width set via JS on open, see positionOptionsList() */
  z-index: 20;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;

  opacity: 0;
  transform: translateY(-8px) scale(0.9);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.32s var(--ease-bounce);
}
.dropdown-options.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-option {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.1s ease;
}
.dropdown-option:hover { background: var(--coral-light); }
.dropdown-option.selected { background: var(--coral); color: #fff; }
.dropdown-option.selected .dropdown-option-price { color: #fff; }
.dropdown-option-price {
  color: var(--gray-600);
  font-size: 13px;
  margin-left: 12px;
}

/* ==========================================================================
   Confirmation step
   ========================================================================== */

#confirmation-step { text-align: center; }
.confirmation-icon {
  width: 56px;
  height: 56px;
  line-height: 56px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 16px;
}
#confirmation-step h2 { font-size: 20px; margin: 0 0 8px; }
#confirmation-step .instruction { text-align: center; }

.order-summary {
  text-align: left;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 20px 0;
  background: var(--gray-50);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}
.summary-row:last-child { border-bottom: none; }
.summary-total {
  font-weight: 700;
  color: var(--navy);
  border-top: 2px solid var(--gray-100);
  margin-top: 4px;
  padding-top: 10px;
}

/* ==========================================================================
   Same-name toggle
   ========================================================================== */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 16px;
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: #d8d8d8;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.toggle-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s var(--ease-bounce);
}
.toggle-row input:checked + .toggle-switch { background: var(--coral); }
.toggle-row input:checked + .toggle-switch::before { transform: translateX(18px); }
.toggle-label { font-size: 13px; color: var(--navy); }

/* ==========================================================================
   Ticket cards grid
   ========================================================================== */

.tickets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 8px;
}

@media (min-width: 700px) {
  .tickets-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 480px) {
  .tickets-grid { grid-template-columns: 1fr; }
}

.ticket-card {
  position: relative;
  display: flex;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.ticket-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.ticket-card-body {
  flex: 1;
  padding: 16px;
  min-width: 0; /* allows flex child to shrink properly */
}

/* Vertical stub on the right, separated by a dashed tear-line — classic ticket look */
.ticket-card-stub {
  width: 34px;
  flex-shrink: 0;
  background: var(--coral);
  border-left: 2px dashed rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ticket-card-stub-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ticket-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ticket-card-header strong { font-size: 14px; color: var(--navy); }

.remove-card-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s ease, transform 0.15s ease;
}
.remove-card-btn:hover { color: var(--coral); transform: rotate(90deg); }

/* The "+" add-ticket card */
.add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border: 2px dashed #d8d8d8;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.add-card:hover, .add-card:focus {
  border-color: var(--coral);
  background: var(--coral-light);
  outline: none;
  transform: scale(1.02);
}
.add-card-plus {
  font-size: 32px;
  font-weight: 300;
  color: var(--gray-400);
  transition: color 0.15s ease, transform 0.2s var(--ease-bounce);
}
.add-card:hover .add-card-plus, .add-card:focus .add-card-plus {
  color: var(--coral);
  transform: rotate(90deg) scale(1.1);
}

/* --- Required field marker --- */

.required-mark {
  color: var(--coral);
  font-weight: 700;
}

/* --- Extra questions box (visually separated from regular fields) --- */

.extra-questions-box {
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--cream-light);
  margin-bottom: 20px;
}
.extra-questions-box label:first-child { margin-top: 0; }

/* --- Progress bar --- */

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--coral);
  border-radius: 999px;
  transition: width 0.4s var(--ease-bounce);
}

/* --- Step fade transition --- */

.step-fade-out {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.step-fade-in {
  opacity: 0;
  transform: translateY(-4px);
}
.step-fade-in-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* --- Submit button loading state --- */

.submit-btn.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Confirmation icon: entrance animation to punctuate a completed order */
.confirmation-icon {
  animation: pop-in 0.4s var(--ease-bounce);
}
@keyframes pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Confetti burst (order confirmation) --- */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  border-radius: 2px;
  opacity: 0.9;
}

/* --- Resend code row --- */

.resend-row {
  margin-top: 20px;
  text-align: center;
}
.resend-btn {
  display: inline;
  margin: 0 0 0 4px;
  font-weight: 600;
}
.resend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}
#resend-countdown {
  font-variant-numeric: tabular-nums;
}

/* --- Full-screen loading overlay --- */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(28, 45, 63, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.loading-overlay.visible {
  opacity: 1;
}

.loading-overlay-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-overlay-text {
  color: #fff;
  font-family: Outfit, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

/* --- Top navbar --- */

.top-navbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.navbar-brand:hover {
  opacity: 0.75;
}
.navbar-logo {
  height: 32px;
  width: auto;
}
.navbar-brand-name {
  font-family: Outfit, Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--navy);
}

/* --- Account menu (chip + dropdown, lives in the navbar) --- */

.account-menu {
  position: relative;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.account-chip:hover {
  border-color: var(--coral);
  background: var(--coral-light);
}

.account-icon { font-size: 14px; }
.account-chevron { font-size: 10px; color: var(--gray-600); }

.account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  padding: 6px;
}

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s ease;
}
.account-dropdown-item:hover {
  background: var(--gray-50);
}

/* --- Navbar login button (shown when not authenticated) --- */

.navbar-login-btn {
  display: inline-flex;
  align-items: center;
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s var(--ease-bounce);
}
.navbar-login-btn:hover {
  background: var(--coral-dark);
  transform: translateY(-1px);
}

/* --- Jonc. footer credit --- */

.jonc-footer {
  width: 100%;
  max-width: 480px;
  margin: 0 16px 32px;
  padding: 20px;
  text-align: center;
}

@media (min-width: 700px) {
  .jonc-footer {
    max-width: 1100px;
    width: 85vw;
  }
}
@media (min-width: 1400px) {
  .jonc-footer { width: 70vw; }
}

.jonc-footer-brand {
  display: inline-block;
  margin-bottom: 8px;
}
.jonc-footer-logo {
  height: 24px;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.jonc-footer-brand:hover .jonc-footer-logo {
  opacity: 1;
}

.jonc-footer-text {
  margin: 0;
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.6;
}
.jonc-footer-text a {
  color: var(--coral);
  font-weight: 600;
  text-decoration: none;
}
.jonc-footer-text a:hover {
  text-decoration: underline;
}