/* ==========================================================================
   Exhibition Visitor Registration — styles
   Mobile-first, lightweight, no external dependencies.
   ========================================================================== */

:root {
  --brand: #0d6efd;
  --brand-dark: #0b5ed7;
  --brand-light: #e7f1ff;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1b1f29;
  --text-muted: #5b6472;
  --border: #d6dbe4;
  --border-focus: var(--brand);
  --error: #d32f2f;
  --success: #1a9d55;
  /* Fastex Media brand accents */
  --fastex-orange: #ef6c00;
  --fastex-bg: #fff3e6;
  --fastex-border: #ffd9b3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(20, 30, 60, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%; /* stop iOS auto-inflating text on rotate */
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ------- Card ------- */
.card {
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px 28px;
  margin-top: 12px;
}

.card__header {
  text-align: center;
  margin-bottom: 22px;
}

.logo {
  max-width: min(170px, 45vw);
  max-height: 150px;
  height: auto;
  width: auto;
  object-fit: contain;
  margin: 0 auto 10px;
  display: block;
}

/* Hide the <img> gracefully if the logo file is missing/not set */
.logo:not([src]),
.logo[src=""] {
  display: none;
}

.exhibition-name {
  font-size: clamp(1.3rem, 5.5vw, 1.6rem);
  line-height: 1.25;
  font-weight: 700;
  margin: 4px 0 2px;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ------- Form ------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.label {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
}

.req {
  color: var(--error);
  font-weight: 700;
}

.input {
  width: 100%;
  font-size: 1.05rem;
  padding: 14px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: #9aa2b1;
}

.input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
  cursor: pointer;
}

/* invalid state */
.input.is-invalid {
  border-color: var(--error);
}

.input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

.error-text {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0;
  min-height: 0;
}

.error-text:empty {
  display: none;
}

/* ------- Buttons ------- */
.btn {
  width: 100%;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--brand);
  color: #fff;
  margin-top: 4px;
}

.btn--primary:hover {
  background: var(--brand-dark);
}

.btn--primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--brand-light);
  color: var(--brand-dark);
  margin-top: 22px;
}

.btn--secondary:hover {
  background: #d5e6ff;
}

.note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 4px 0 0;
}

.note .req {
  color: var(--error);
}

/* ------- Form-level message ------- */
.form-message {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  display: none;
}

.form-message.is-visible {
  display: block;
}

.form-message.is-error {
  background: #fdecea;
  color: var(--error);
  border: 1px solid #f5c6c2;
}

/* ------- Success screen ------- */
.success {
  text-align: center;
  padding: 10px 4px 4px;
}

.success__icon {
  color: var(--success);
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.success__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0 16px;
  color: var(--text);
}

.success__idlabel {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.success__id {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--brand-dark);
  background: var(--brand-light);
  display: inline-block;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
}

.success__text {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

/* Promotional lucky-draw callout on the thank-you screen */
.promo {
  margin: 18px 0 4px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--fastex-bg), #fff8ef);
  border: 1.5px dashed var(--fastex-orange);
}

.promo__text {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--fastex-orange);
}

.promo__note {
  margin: 6px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* On the success screen, give the buttons breathing room */
.success .btn--primary {
  margin-top: 20px;
}
.success .btn--secondary {
  margin-top: 12px;
}

/* ------- Footer ------- */
.page__footer {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.page__footer-title {
  margin-bottom: 10px;
}

/* "Managed by Fastex Media" credit — sits in the header, under the subtitle */
.managed-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.3;
}

.managed-credit__prefix {
  color: var(--text-muted);
  font-weight: 500;
}

/* The highlighted Fastex Media brand pill */
.managed-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--fastex-bg);
  border: 1.5px solid var(--fastex-orange);
  box-shadow: 0 2px 10px rgba(239, 108, 0, 0.22);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.managed-brand:hover {
  box-shadow: 0 3px 14px rgba(239, 108, 0, 0.32);
}

.managed-brand__logo {
  height: 20px;
  width: auto;
  display: block;
}

.managed-brand__name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.015em;
  color: var(--fastex-orange);
  text-shadow: 0 0 1px rgba(239, 108, 0, 0.15);
}

/* ------- Utility ------- */
.is-hidden {
  display: none !important;
}

/* ------- Phones (default is already mobile-first; refine spacing) ------- */
@media (max-width: 480px) {
  .page {
    padding: 14px 12px calc(20px + env(safe-area-inset-bottom));
  }
  .card {
    padding: 22px 18px 24px;
    margin-top: 6px;
  }
  .form {
    gap: 14px;
  }
}

/* ------- Small phones (e.g. iPhone SE, 320px) ------- */
@media (max-width: 360px) {
  .card {
    padding: 20px 14px 22px;
  }
  .input {
    font-size: 16px; /* keep >=16px so iOS never zooms on focus */
    padding: 13px 12px;
  }
  .btn {
    font-size: 1.05rem;
    padding: 14px 16px;
  }
  .subtitle {
    font-size: 0.88rem;
  }
}

/* ------- Dark mode support ------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --card-bg: #1c2029;
    --text: #eef1f6;
    --text-muted: #a2abbb;
    --border: #384154;
    --brand-light: #16324f;
    /* Fastex pill in dark mode */
    --fastex-orange: #ff9e40;
    --fastex-bg: #2c1c0d;
    --fastex-border: #5a3a17;
  }
  .input {
    background: #232833;
    color: var(--text);
  }
  .input::placeholder {
    color: #7c8698;
  }
  .form-message.is-error {
    background: #3a1f1e;
    border-color: #6b2f2c;
    color: #ff9d97;
  }
  .promo {
    background: linear-gradient(135deg, #2c1c0d, #34240f);
  }
}
