/*
 * TSD Booking form. Colours follow the tinhsangduong theme tokens, with fallbacks:
 * --tsd-primary (brand), --tsd-cta (submit button) + --tsd-cta-ink (its text, default --tsd-dark),
 * --tsd-secondary, --tsd-line, --tsd-muted, --tsd-text, --tsd-alert, --tsd-bronze, --tsd-font, --tsd-font-alt.
 */
.tsdb {
  --tsdb-primary: var(--tsd-primary, #3e6650);
  --tsdb-primary-soft: #eef3ef;
  --tsdb-primary-soft: color-mix(in srgb, var(--tsdb-primary) 9%, #fff);
  --tsdb-cta: var(--tsd-cta, var(--tsdb-primary));
  --tsdb-cta-ink: var(--tsd-cta-ink, var(--tsd-dark, #fff));
  --tsdb-cream: var(--tsd-secondary, #f7f4ee);
  --tsdb-line: var(--tsd-line, #e6dfd2);
  --tsdb-input: #d6cfc0;
  --tsdb-input: color-mix(in srgb, var(--tsdb-line) 70%, #8a8d91);
  --tsdb-bronze: #8a5a12;
  --tsdb-bronze-bar: var(--tsd-bronze, #a87e42);
  --tsdb-text: var(--tsd-text, #232b35);
  --tsdb-muted: var(--tsd-muted, #5d636a);
  --tsdb-off: #8a8d91;
  --tsdb-alert: var(--tsd-alert, #b20000);
  font-family: var(--tsd-font, "Raleway", sans-serif);
  color: var(--tsdb-text);
  text-align: left;
}
.tsdb *, .tsdb *::before, .tsdb *::after { box-sizing: border-box; }
.tsdb--page { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; max-width: 1200px; margin: 0 auto; padding: 48px 0 64px; }

/* Intro column (only with intro="1") */
.tsdb-intro { flex: 1 1 320px; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.tsdb-eyebrow { font-size: 12px; letter-spacing: .2em; font-weight: 700; color: #6b5a3c; }
.tsdb-intro__title { margin: 0; font-family: var(--tsd-font-alt, "Playfair Display", serif); font-weight: 600; font-size: 40px; line-height: 1.2; color: var(--tsdb-text); }
.tsdb-intro__lead { margin: 0; font-size: 16px; line-height: 1.7; color: #4a525c; }
.tsdb-facts { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: #fff; border: 1px solid var(--tsdb-line); border-radius: 12px; }
.tsdb-fact { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.6; }
.tsdb-fact svg { flex-shrink: 0; margin-top: 2px; color: var(--tsdb-primary); }

/* Card */
.tsdb-card { flex: 999 1 560px; min-width: 0; margin: 0; background: #fff; border: 1px solid var(--tsdb-line); border-radius: 16px; padding: 32px; box-shadow: 0 10px 30px rgba(35, 43, 53, .06); scroll-margin-top: 90px; }
.tsdb-body { display: flex; flex-direction: column; gap: 28px; }
.tsdb-title { margin: 0; font-family: var(--tsd-font-alt, "Playfair Display", serif); font-weight: 600; font-size: 24px; line-height: 1.3; color: var(--tsdb-text); }
.tsdb-group { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.tsdb-group legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--tsdb-text); }
.tsdb-group legend + * { clear: both; }
.tsdb-hint { margin: 0; font-size: 13px; color: var(--tsdb-muted); }
.tsdb-hint--swipe { display: none; font-size: 12px; }
.tsdb-err { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--tsdb-alert); }

/* Buttons: reset theme styles */
.tsdb button { font-family: inherit; margin: 0; text-transform: none; letter-spacing: normal; box-shadow: none; line-height: 1.3; }
.tsdb button:focus-visible { outline: 2px solid var(--tsdb-bronze-bar); outline-offset: 2px; }

/* Type segmented control */
.tsdb-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--tsdb-cream); border: 1px solid var(--tsdb-line); border-radius: 12px; }
.tsdb-seg__btn { min-height: 48px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--tsdb-text); font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.tsdb-seg__btn[aria-pressed="true"] { background: var(--tsdb-primary); border-color: var(--tsdb-primary); color: #fff; box-shadow: 0 2px 6px rgba(62, 102, 80, .25); }
.tsdb-cc { display: flex; flex-direction: column; gap: 28px; }
.tsdb-cc[hidden] { display: none; }

/* Day chips */
.tsdb-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.tsdb-day { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 84px; padding: 10px 6px; border: 1px solid var(--tsdb-input); border-radius: 10px; background: #fff; color: var(--tsdb-text); cursor: pointer; }
.tsdb-day:hover:not(:disabled) { border-color: var(--tsdb-primary); }
.tsdb-day__dow { font-size: 12px; font-weight: 600; opacity: .8; }
.tsdb-day__date { font-size: 20px; font-weight: 700; line-height: 1.2; }
.tsdb-day__sub { font-size: 11px; font-weight: 600; color: var(--tsdb-primary); text-align: center; }
.tsdb-day.is-low .tsdb-day__sub { color: var(--tsdb-bronze); }
.tsdb-day.is-off { background: #f3f1ec; color: var(--tsdb-off); border-style: dashed; cursor: not-allowed; }
.tsdb-day.is-off .tsdb-day__sub { color: var(--tsdb-off); }
.tsdb-day.is-on { background: var(--tsdb-primary); border-color: var(--tsdb-primary); color: #fff; }
.tsdb-day.is-on .tsdb-day__sub { color: #e6dfd2; }
.tsdb-skel { border-style: solid; border-color: #eee8dc; background: linear-gradient(90deg, #f3efe7 25%, #faf8f3 50%, #f3efe7 75%); background-size: 200% 100%; animation: tsdb-shimmer 1.2s infinite linear; cursor: default; }
@keyframes tsdb-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.tsdb-loaderr { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border: 1px solid #f0c9c9; background: #fdf3f3; border-radius: 10px; font-size: 14px; color: #7a1f1f; }
.tsdb-loaderr p { margin: 0; flex: 1 1 240px; }
.tsdb-retry { min-height: 44px; padding: 0 18px; border: 1px solid var(--tsdb-primary); border-radius: 8px; background: #fff; color: var(--tsdb-primary); font-weight: 700; cursor: pointer; }

/* Shift cards */
.tsdb-shifts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tsdb-shifts > .tsdb-hint { grid-column: 1 / -1; }
.tsdb-shift { display: flex; flex-direction: column; align-items: stretch; gap: 10px; min-height: 96px; padding: 16px; text-align: left; border: 1px solid var(--tsdb-input); border-radius: 12px; background: #fff; color: var(--tsdb-text); cursor: pointer; }
.tsdb-shift:hover:not(:disabled) { border-color: var(--tsdb-primary); }
.tsdb-shift__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tsdb-shift__name { font-size: 17px; font-weight: 700; }
.tsdb-shift__count { font-size: 15px; font-weight: 700; color: var(--tsdb-primary); }
.tsdb-shift__bar { display: block; height: 6px; background: #efe9dd; border-radius: 99px; overflow: hidden; }
.tsdb-shift__fill { display: block; height: 100%; background: var(--tsdb-primary); border-radius: 99px; }
.tsdb-shift.is-low .tsdb-shift__fill { background: var(--tsdb-bronze-bar); }
.tsdb-shift__note { font-size: 12px; font-weight: 500; color: var(--tsdb-muted); }
.tsdb-shift.is-on { background: var(--tsdb-primary-soft); border: 2px solid var(--tsdb-primary); padding: 15px; }
.tsdb-shift.is-off { background: #f3f1ec; border-style: dashed; color: var(--tsdb-off); cursor: not-allowed; }
.tsdb-shift.is-off .tsdb-shift__count, .tsdb-shift.is-off .tsdb-shift__note { color: var(--tsdb-off); }
.tsdb-shift.is-off .tsdb-shift__fill { background: #b9b3a6; }

/* Inputs */
.tsdb-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tsdb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tsdb-field label { margin: 0; font-size: 13px; font-weight: 600; color: var(--tsdb-text); }
.tsdb-req { color: var(--tsdb-alert); }
.tsdb-opt { font-weight: 500; color: #6b6f75; }
.tsdb .tsdb-field input, .tsdb .tsdb-field textarea { width: 100%; height: 48px; margin: 0; padding: 0 14px; border: 1px solid var(--tsdb-input); border-radius: 8px; background: #fff; color: var(--tsdb-text); font-family: inherit; font-size: 15px; font-weight: 500; box-shadow: none; }
.tsdb .tsdb-field textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.tsdb .tsdb-field input:focus, .tsdb .tsdb-field textarea:focus { outline: 2px solid var(--tsdb-primary); outline-offset: 1px; border-color: var(--tsdb-primary); }
.tsdb .tsdb-field [aria-invalid="true"] { border-color: var(--tsdb-alert); background: #fffafa; }
.tsdb-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Alert, submit */
.tsdb-alert { padding: 14px 16px; border-radius: 10px; font-size: 14px; line-height: 1.6; font-weight: 600; }
.tsdb-alert--error { background: #fdf3f3; border: 1px solid #f0c9c9; color: #7a1f1f; }
.tsdb-alert--warn { background: #fbf5ea; border: 1px solid #ecd9b4; color: #6b4a0e; }
.tsdb-actions { display: flex; flex-direction: column; gap: 12px; }
.tsdb .tsdb-submit { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin: 0; padding: 8px 20px; border: 0; border-radius: 10px; background: var(--tsdb-cta); color: var(--tsdb-cta-ink); font-size: 16px; font-weight: 700; line-height: 1.3; letter-spacing: .02em; cursor: pointer; }
.tsdb .tsdb-submit:hover { box-shadow: inset 0 0 0 100px rgba(0, 0, 0, .12); }
.tsdb .tsdb-submit:disabled { opacity: .75; cursor: progress; }
.tsdb-spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tsdb-rot .8s linear infinite; }
@keyframes tsdb-rot { to { transform: rotate(360deg); } }
.tsdb-note { margin: 0; font-size: 13px; line-height: 1.6; color: var(--tsdb-muted); text-align: center; }
.tsdb-note a { color: var(--tsdb-primary); font-weight: 700; }

/* Success */
.tsdb-success { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 16px 0; }
.tsdb-success[hidden], .tsdb-body[hidden] { display: none; }
.tsdb-success__icon { width: 64px; height: 64px; border-radius: 50%; background: var(--tsdb-primary-soft); color: var(--tsdb-primary); display: flex; align-items: center; justify-content: center; }
.tsdb-number { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 36px; border: 2px solid var(--tsdb-primary); border-radius: 16px; background: var(--tsdb-primary-soft); color: var(--tsdb-primary); font-size: 13px; font-weight: 600; }
.tsdb-number[hidden] { display: none; }
.tsdb-number b { font-size: 52px; line-height: 1.1; }
.tsdb-summary { width: 100%; max-width: 420px; margin: 0; padding: 4px 16px; border: 1px solid var(--tsdb-line); border-radius: 12px; background: var(--tsdb-cream); text-align: left; }
.tsdb-summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--tsdb-line); }
.tsdb-summary > div:last-child { border-bottom: 0; }
.tsdb-summary dt { font-size: 13px; color: var(--tsdb-muted); }
.tsdb-summary dd { margin: 0; font-size: 14px; font-weight: 700; text-align: right; }
.tsdb-success__msg { margin: 0; max-width: 460px; font-size: 14px; line-height: 1.6; color: var(--tsdb-muted); }
.tsdb .tsdb-again { min-height: 48px; padding: 0 22px; border: 1px solid var(--tsdb-primary); border-radius: 10px; background: #fff; color: var(--tsdb-primary); font-size: 15px; font-weight: 700; cursor: pointer; }

/* Screen-reader only (compact footer form hides its single legend) */
.tsdb .tsdb-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Compact variant (compact="1"): footer block, no intro, tighter spacing */
.tsdb--compact .tsdb-card { padding: 24px; border-radius: 14px; box-shadow: none; }
.tsdb--compact .tsdb-body { gap: 18px; }
.tsdb--compact .tsdb-title { font-size: 20px; }
.tsdb--compact .tsdb-field textarea { min-height: 72px; }
.tsdb--compact .tsdb-success { padding: 4px 0; gap: 12px; }

/* Mobile */
@media (max-width: 640px) {
  .tsdb--page { gap: 24px; padding: 24px 0 40px; }
  .tsdb-intro__title { font-size: 28px; }
  .tsdb-card, .tsdb--compact .tsdb-card { padding: 20px 16px; border-radius: 14px; }
  .tsdb-body { gap: 24px; }
  .tsdb-days { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 6px; margin-right: -16px; padding-right: 16px; scroll-snap-type: x proximity; }
  .tsdb-day { flex: 0 0 76px; min-height: 80px; scroll-snap-align: start; }
  .tsdb-day__date { font-size: 18px; }
  .tsdb-day__sub { font-size: 10px; white-space: nowrap; }
  .tsdb-hint--swipe { display: block; }
  .tsdb-shifts, .tsdb-grid2 { grid-template-columns: minmax(0, 1fr); }
  .tsdb .tsdb-field input, .tsdb .tsdb-field textarea { font-size: 16px; }
}
