/* 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;
}

@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;
  }
}

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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: 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: 4px;
  border: 1px solid var(--border-hover);
  /* Floats over .top-bar's fixed position, which can sit over the logo
     on a short viewport — a translucent card + blur reads as an
     intentional floating control there instead of a bare outline
     clashing with whatever's underneath. */
  background: color-mix(in srgb, var(--card) 50%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s linear, border-color 0.15s linear;
}

.icon-btn:hover {
  color: var(--accent-3);
  border-color: rgba(141, 115, 214, 0.6);
}

.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;
}

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;
}
