/* ============================================================
   TDNB Stamp Card — Shared Stylesheet
   Design: warm minimal, mobile-first, classy nail salon
   ============================================================ */

/* ── Custom Fonts ─────────────────────────────────────────── */
@font-face {
  font-family: 'TAN Aegean';
  src: url('TAN - AEGEAN Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Buffalo';
  src: url('Buffalo.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noah';
  src: url('noah-regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Colours */
  --cream:          #FAFAF7;
  --white:          #FFFFFF;
  --gold:           #C9A96E;
  --gold-dark:      #B8955A;
  --gold-light:     #F5ECD7;
  --gold-glow:      rgba(201, 169, 110, 0.18);
  --text:           #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted:     #9CA3AF;
  --border:         #EBEBEB;
  --border-focus:   #C9A96E;
  --surface:        #FFFFFF;
  --success:        #2D6A4F;
  --success-bg:     #D8F3DC;
  --error:          #B91C1C;
  --error-bg:       #FEE2E2;
  --info-bg:        #F0F4FF;

  /* Spacing */
  --space-xs:  .375rem;
  --space-sm:  .75rem;
  --space-md:  1.25rem;
  --space-lg:  2rem;

  /* Shape */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadow */
  --shadow-card: 0 2px 8px rgba(0,0,0,.05), 0 8px 32px rgba(0,0,0,.07);
  --shadow-btn:  0 2px 8px rgba(201,169,110,.25);

  /* Typography */
  --font:        'Noah', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'TAN Aegean', Georgia, serif;
  --font-script:  'Buffalo', cursive;
  --text-xs:     .75rem;
  --text-sm:     .875rem;
  --text-base:   1rem;
  --text-lg:     1.125rem;
  --text-xl:     1.35rem;
  --text-2xl:    1.65rem;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ─────────────────────────────────────────────────── */
html {
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

/* ── Typography ───────────────────────────────────────────── */
h1 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: normal;
  letter-spacing: .04em;
  line-height: 1.2;
  color: var(--text);
}

h2 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: normal;
  letter-spacing: .03em;
  color: var(--text);
}

h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: normal;
  color: var(--text);
}

p {
  line-height: 1.6;
}

.subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: .25rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.text-muted   { color: var(--text-muted);     font-size: var(--text-sm); }
.text-center  { text-align: center; }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }

/* ── Card / Panel ─────────────────────────────────────────── */
.panel {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg) var(--space-md);
  width: 100%;
  max-width: 400px;
}

.panel-wide { max-width: 520px; }

/* ── Form ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-md);
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  margin-bottom: .4rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"] {
  width: 100%;
  padding: .7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: border-color .15s ease, box-shadow .15s ease;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder { color: var(--text-muted); }

input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: .3rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .8rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active:not(:disabled) { transform: scale(.98); }

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

/* Gold / primary */
.btn-primary {
  background: var(--gold);
  color: var(--text);
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-dark);
  box-shadow: 0 4px 16px rgba(201,169,110,.35);
}

/* Ghost / secondary */
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  box-shadow: none;
  width: auto;
  padding: .55rem 1rem;
  font-size: var(--text-sm);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #C4C4C4;
  background: #F5F5F5;
}

/* Danger */
.btn-danger {
  background: var(--error);
  color: #fff;
  box-shadow: 0 2px 8px rgba(185,28,28,.2);
}

.btn-danger:hover:not(:disabled) { background: #991b1b; }

/* Inline / text link button */
.btn-link {
  background: none;
  border: none;
  color: var(--gold-dark);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: underline;
  text-underline-offset: 2px;
  width: auto;
  padding: 0;
}

/* ── Stamp Circles ────────────────────────────────────────── */
.stamp-row {
  display: flex;
  justify-content: center;
  gap: .65rem;
  margin: .5rem 0 1.25rem;
}

.stamp-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px dashed #D8D8D8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  background: transparent;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.stamp-circle.filled {
  background: var(--gold-light);
  border: 2px solid var(--gold);
  border-style: solid;
  animation: stampPop .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes stampPop {
  0%   { transform: scale(.65); opacity: .5; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ── QR Code ──────────────────────────────────────────────── */
.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}

.qr-section p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
}

#qrCanvas {
  border-radius: var(--radius-sm);
  border: 3px solid var(--border);
  display: block;
}

/* ── Alert / Message ──────────────────────────────────────── */
.alert {
  display: none;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-top: var(--space-sm);
}

.alert.show       { display: block; }
.alert-success    { background: var(--success-bg); color: var(--success); }
.alert-error      { background: var(--error-bg);   color: var(--error); }
.alert-info       { background: var(--info-bg);    color: #1d4ed8; }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-gold    { background: var(--gold-light); color: #92620A; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-neutral { background: #F3F4F6;           color: var(--text-secondary); }

/* ── Reward Banner ────────────────────────────────────────── */
.reward-banner {
  background: linear-gradient(135deg, #FEF9ED, var(--gold-light));
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  text-align: center;
  display: none;
}

.reward-banner.show { display: block; }

.reward-banner .reward-emoji {
  font-size: 1.75rem;
  display: block;
  margin-bottom: .35rem;
}

.reward-banner p {
  margin: 0;
  font-weight: 700;
  font-size: var(--text-base);
  color: #7A4F00;
}

.reward-banner small {
  font-size: var(--text-xs);
  color: #A0640A;
}

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(0,0,0,.15);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.btn-primary .spinner {
  border-color: rgba(0,0,0,.2);
  border-top-color: var(--text);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ──────────────────────────────────────────────── */
.divider,
.card-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ── Progress bar (countdown) ─────────────────────────────── */
.countdown-bar {
  height: 3px;
  background: var(--gold);
  border-radius: 99px;
  margin-top: .85rem;
  transform-origin: left;
  animation: countdown 3s linear forwards;
}

@keyframes countdown {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── Success state (register page) ───────────────────────── */
.success-state {
  text-align: center;
  padding: 1rem 0 .5rem;
}

.success-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: .75rem;
}

/* ── Utilities ────────────────────────────────────────────── */
.hidden           { display: none !important; }
.mt-1             { margin-top: var(--space-xs); }
.mt-2             { margin-top: var(--space-sm); }
.mt-3             { margin-top: var(--space-md); }
.mb-1             { margin-bottom: var(--space-xs); }
.mb-2             { margin-bottom: var(--space-sm); }
.mb-3             { margin-bottom: var(--space-md); }
.w-full           { width: 100%; }
.flex             { display: flex; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-sm           { gap: var(--space-sm); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 390px) {
  :root {
    --text-2xl: 1.45rem;
    --text-xl:  1.2rem;
  }

  .panel { padding: 1.5rem 1rem; }

  .stamp-circle { width: 38px; height: 38px; font-size: 1.1rem; }
  .stamp-row    { gap: .45rem; }
}

@media (min-width: 640px) {
  .btn { width: auto; min-width: 200px; }
  .btn.w-full { width: 100%; }
}
