/* musicfestival.in.th style brief — see musicfestival-style-brief.md.
   The bg/card/border/text scale below is the brief's original dark
   near-black palette — NOT the green/yellow/orange/purple mood palette.
   That palette is scoped to the header's gradient accent line (see the
   --dark-green/--main-green/--highlight/--yellow/--accent-3 variables
   below) and, as of the button re-theme, to buttons/interactive states —
   the site surface colors (bg/card/border/text) stay as originally
   specced. */
:root {
  /* Not "light dark" — that would let native controls (checkboxes,
     radios, the date picker) always follow the OS preference regardless
     of our own manual light/dark toggle, so switching the SITE to light
     while the OS is dark left checkboxes/radios rendering with dark
     native chrome that didn't match anything on the page. Scoped the same
     way the color variables below already are. */
  color-scheme: light;
  --bg: #ffffff;
  --card: #ffffff;
  --text: #111118;
  --heading: #09090f;
  --muted: #6b6b7a;
  --dim: #9a9ab0;
  --border: #e4e4ea;
  --border-hover: #cfcfdb;
  --brand-400: #fb923c;
  --brand-500: #f97316;
  --brand-600: #ea580c;
  --neon: #d946ef;
  --neon-violet: #7c3aed;
  --error: #dc2626;
  /* Full mood palette — the gradient line uses all six in this order.
     Named per the user's naming: main green, highlight green, orange
     (= --brand-400 above), purple, yellow. Highlight green is also the
     primary interactive/button color; purple is the hover/active accent. */
  --dark-green: #173d32;
  --main-green: #2b8753;
  --highlight: #63c15b;
  --highlight-hover: #4fa348;
  --on-highlight: #0f2417;
  --yellow: #f4d84a;
  --accent-3: #8d73d6;
  --ctl-bg: rgba(255, 255, 255, 0.55);
  --ctl-bg-hover: rgba(255, 255, 255, 0.85);
  --ctl-border: rgba(15, 23, 42, 0.22);
  --ctl-text: #1e293b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #09090f;
    --card: #111118;
    --text: #e2e2ec;
    --heading: #ffffff;
    --muted: #8888aa;
    --dim: #4a4a62;
    --border: #1f1f2e;
    --border-hover: #2d2d40;
    --ctl-bg: rgba(255, 255, 255, 0.12);
    --ctl-bg-hover: rgba(255, 255, 255, 0.24);
    --ctl-border: rgba(255, 255, 255, 0.4);
    --ctl-text: #ffffff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090f;
  --card: #111118;
  --text: #e2e2ec;
  --heading: #ffffff;
  --muted: #8888aa;
  --dim: #4a4a62;
  --border: #1f1f2e;
  --border-hover: #2d2d40;
  --ctl-bg: rgba(255, 255, 255, 0.12);
  --ctl-bg-hover: rgba(255, 255, 255, 0.24);
  --ctl-border: rgba(255, 255, 255, 0.4);
  --ctl-text: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  /* dvh tracks the browser's actual visible viewport (shrinks when the
     address bar is showing) instead of 100vh's "chrome fully hidden"
     height, so a short page's min-height stops exceeding what's actually
     visible and no longer forces a scrollbar to reach content that was
     already fully in view. Kept the 100vh line above as a fallback for
     browsers that don't support dvh — this line simply wins over it where
     supported. */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* "safe center" (not plain "center"): when content is short enough to
     fit, this centers exactly as before. When it's not — e.g. the real
     reCAPTCHA widget renders (local dev's emulator never shows it, so this
     doesn't reproduce there), or a validation error adds a line — plain
     "center" splits the overflow evenly above AND below the viewport, so
     the page shows a scrollbar that scrolls to nothing (the extra content
     is invisible above scrollTop 0). "safe" falls back to top-alignment
     only in that overflow case, so any extra height shows up below,
     scrollable and visible, instead of as a dead scrollbar. */
  justify-content: safe center;
  background: var(--bg);
  color: var(--text);
  font-family: "Bai Jamjuree", "K2D", "Noto Sans Thai", sans-serif;
  /* Extra top padding reserves room for .top-bar (position: fixed, top:
     16px, ~36px tall — 52px bottom edge). Padded well past that (not just
     enough to clear it) since a short viewport (e.g. landscape mobile, or
     a mobile browser's address bar eating into 100vh) vertically centers
     this flex column, and any shortfall here pushes the logo straight
     into the fixed bar's space. */
  padding: 90px 16px 16px;
}

.font-display,
h1 {
  font-family: "K2D", "Bai Jamjuree", sans-serif;
}

/* Sits centered directly above the card, not fixed in the top bar. */
.brand-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  line-height: 0;
}

.brand-mark img {
  height: 60px;
  width: auto;
}

/* --- Top bar: lang switch + theme toggle, outside the card --- */
.top-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--ctl-border);
  /* Floats over .top-bar's fixed position, which can sit over the logo
     on a short viewport — frosted glass reads as an intentional floating
     control there. Same look as the header buttons on www/tickets web. */
  background: var(--ctl-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ctl-text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s linear;
}

.icon-btn:hover {
  background: var(--ctl-bg-hover);
}

.icon-btn-square {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.lang-flag {
  font-size: 1rem;
  line-height: 1;
}

.tracking-wide {
  letter-spacing: 0.02em;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
}

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.tabs {
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.15s linear, color 0.15s linear;
}

.tab.active {
  background: var(--highlight);
  color: var(--on-highlight);
}

.tab-tip {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.mode {
  display: none;
}

.mode.active {
  display: block;
}

.btn-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  text-align: center;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--highlight);
}

.btn-secondary {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--border-hover);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s linear, color 0.15s linear;
}

.btn-secondary:hover {
  border-color: rgba(141, 115, 214, 0.6);
  color: var(--highlight);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

select {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

select:focus {
  border-color: var(--accent-3);
  outline: none;
}

.add-contact {
  margin: 4px 0 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.add-contact label {
  margin-bottom: 8px;
}

.add-contact .phone-row {
  margin-bottom: 0;
}

.add-contact .phone-row input {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.add-contact > .btn-secondary {
  width: 100%;
  margin-top: 4px;
}

.contact-status {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.contact-status.success {
  color: var(--highlight);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 18px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
  margin: 2px 0 0;
}

.checkbox-label a,
.link-btn {
  color: var(--highlight);
}

.checkbox-label a:hover,
.link-btn:hover {
  color: var(--accent-3);
}

.req {
  color: var(--error);
  margin-left: 2px;
}

/* Inline field errors — replaces the browser's native validation tooltip
   entirely (forms carry novalidate; login.js/business/login.js do their
   own checks and call showFieldError). Sits right under the field it
   belongs to, pulling up into that field's existing bottom margin. */
.field-error {
  margin: 6px 0 12px;
  font-size: 0.75rem;
  color: var(--error);
}

input.invalid,
.country-select.invalid input {
  border-color: var(--error) !important;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.radio-label:has(input:checked) {
  border-color: var(--accent-3);
  color: var(--highlight);
}

.radio-label input {
  width: auto;
  margin: 0;
}

.qr-code {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 8px;
}

.totp-secret {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
  margin: 0 0 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

input:focus {
  border-color: var(--accent-3);
  outline: none;
}

input::placeholder {
  color: var(--dim);
}

.btn-primary {
  width: 100%;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background: var(--highlight);
  color: var(--on-highlight);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s linear;
}

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

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

/* Same box model as .btn-primary, for a confirm action that should read as
   destructive/irreversible (e.g. the sign-out confirm modal) rather than
   the routine highlight green. */
.btn-danger {
  width: 100%;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background: var(--error);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s linear;
}

.btn-danger:hover {
  background: #b91c1c;
}

a.btn-primary {
  display: block;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

#status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--muted);
}

#status.error {
  color: var(--error);
}

#result {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.75rem;
}

/* --- Phone row: country combobox + number input --- */
.phone-row {
  display: flex;
  gap: 8px;
}

.country-select {
  position: relative;
  width: 92px;
  flex-shrink: 0;
}

.country-select input {
  margin-bottom: 0;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}

/* Nationality picker: same combobox, but full-width and not squeezed next
   to a phone-number field — needs room for e.g. "United Kingdom". */
.country-select-wide {
  width: 100%;
}

.country-select-wide input {
  margin-bottom: 14px;
  text-align: left;
}

.country-select-wide .country-list {
  width: 100%;
}

.country-select-wide input {
  padding-right: 34px;
}

.country-clear-btn {
  display: none;
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
}

.country-select-wide.has-value .country-clear-btn {
  display: flex;
}

.country-clear-btn:hover {
  color: var(--error);
}

/* --- Date of birth: masked dd/mm/yyyy text field + calendar icon sitting
   inside the field (like the nationality clear button) that drives a
   hidden native <input type="date"> (kept as the source of truth for
   min/max and ISO value, since its picker UI is still useful, but its own
   display format is locale-dependent — the visible field never is). --*/
.dob-field {
  position: relative;
  margin-bottom: 14px;
}

.dob-field input {
  margin-bottom: 0;
  padding-right: 40px;
}

.dob-calendar-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
  transition: color 0.15s linear;
}

.dob-calendar-btn svg {
  width: 18px;
  height: 18px;
}

.dob-calendar-btn:hover {
  color: var(--accent-3);
}

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

.phone-row input[type="tel"] {
  margin-bottom: 0;
  width: auto;
  flex: 1 1 0%;
  min-width: 0;
}

.country-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 260px;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.country-list li {
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-list li:hover {
  background: var(--bg);
}

#recaptcha-container {
  margin-bottom: 14px;
}

/* --- Policy pages (terms-and-conditions, privacy-policy) --- */
.prose h1 {
  margin-bottom: 4px;
}

.prose .updated {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 20px;
}

.prose h2 {
  font-family: "K2D", "Bai Jamjuree", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
  margin: 24px 0 8px;
}

.prose p,
.prose li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.prose ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.prose li {
  margin-bottom: 4px;
}

.prose .highlight-text {
  background: rgba(141, 115, 214, 0.15);
  color: var(--accent-3);
  border-radius: 3px;
  padding: 0 3px;
}

/* Still-unfilled draft content — kept apart from .highlight-text above so
   anything not yet written stays visually flagged now that the todo-banner
   is gone. */
.prose .placeholder {
  background: rgba(251, 146, 60, 0.15);
  color: var(--brand-600);
  border-radius: 3px;
  padding: 0 3px;
}

/* --- Policy modal (opened from the profile form's consent checkboxes) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-box {
  width: 100%;
  max-width: 640px;
  height: 80vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--accent-3);
  background: var(--bg);
}

.modal-box iframe {
  flex: 1;
  width: 100%;
  border: none;
}

/* Cookie consent (public/consent.js) */
.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 50;
  width: 18rem;
  max-width: calc(100vw - 2rem);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}
.cookie-banner-heading {
  margin: 0 0 0.25rem;
  font-weight: 600;
  color: var(--heading);
}
.cookie-banner-body {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}
.cookie-banner-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}
.cookie-banner-option-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--heading);
}
.cookie-banner-option-desc {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.cookie-toggle {
  position: relative;
  flex-shrink: 0;
  width: 2.25rem;
  height: 1.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--border-hover);
  cursor: pointer;
  transition: background 0.15s;
}
.cookie-toggle.on {
  background: var(--highlight);
}
.cookie-toggle-knob {
  display: block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.cookie-toggle.on .cookie-toggle-knob {
  transform: translateX(1rem);
}
.cookie-banner-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.cookie-btn {
  flex: 1;
  width: 100%;
  padding: 0.375rem 0;
  border: 1px solid var(--border-hover);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.cookie-btn:hover {
  color: var(--heading);
}
.cookie-btn-primary {
  border-color: transparent;
  background: var(--highlight);
  color: var(--on-highlight);
  font-weight: 600;
}
.cookie-btn-primary:hover {
  background: var(--highlight-hover);
  color: var(--on-highlight);
}
.cookie-settings-link {
  position: fixed;
  bottom: 0.5rem;
  left: 1rem;
  z-index: 40;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dim);
  font: inherit;
  font-size: 0.7rem;
  text-decoration: underline;
  cursor: pointer;
}
.cookie-settings-link:hover {
  color: var(--muted);
}

/* Shown when the browser holds a session for a different role (common.js) */
.session-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--yellow);
  border-radius: 8px;
  background: rgba(244, 216, 74, 0.12);
  color: var(--text);
  font-size: 0.85rem;
}

.session-notice-signout {
  padding: 0;
  border: 0;
  background: none;
  color: var(--highlight);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Show/hide eye on every password field (common.js setupPasswordToggles) */
.password-wrap {
  position: relative;
  margin-bottom: 14px;
}

.password-wrap input {
  margin-bottom: 0;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--heading);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}
