/* ============================================================
   Betty Beauty — main.css
   Design tokens + reset + base elements + shared components
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Instrument+Sans:wght@400;500;600&display=swap');

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Colours */
  --black:    #080706;
  --jet:      #131210;
  --surface:  #1a1917;
  --surface2: #222018;
  --gold:     #C9961E;
  --gold2:    #F0C84A;
  --wheat:    #C4A46A;
  --egg:      #F0EAD8;
  --text:     #e6dfd2;
  --muted:    #7a756c;
  --border:   rgba(201, 150, 30, 0.14);
  --border2:  rgba(255, 255, 255, 0.05);
  --green:    #7abf8e;
  --blue:     #7a9fc4;
  --purple:   #9a8fd4;
  --red:      #e08070;

  /* Layout */
  --radius:   4px;
  --sidebar:  260px;

  /* Typography */
  --font-ui:      'Instrument Sans', system-ui, sans-serif;
  --font-display: 'Cormorant Garamond', serif;

  /* Spacing scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Transitions */
  --ease: 150ms ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family:      var(--font-ui);
  font-size:        0.9375rem;    /* 15px */
  line-height:      1.5;
  color:            var(--text);
  background-color: var(--black);
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover { color: var(--gold2); }

ul, ol { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size:   inherit;
}

button { cursor: pointer; }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family:  var(--font-display);
  font-weight:  600;
  line-height:  1.2;
  color:        var(--egg);
}

h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.4rem,  2vw, 1.875rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }

/* Use Instrument Sans for UI headings (not display) */
.ui-heading {
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.6875rem;
  color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             var(--sp-2);
  padding:         var(--sp-2) var(--sp-4);
  border:          1px solid transparent;
  border-radius:   var(--radius);
  font-family:     var(--font-ui);
  font-size:       0.875rem;
  font-weight:     500;
  line-height:     1;
  white-space:     nowrap;
  transition:      background var(--ease), border-color var(--ease), color var(--ease), opacity var(--ease);
  min-height:      36px;
  min-width:       44px;
}

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

.btn-primary {
  background:   var(--gold);
  border-color: var(--gold);
  color:        var(--black);
}
.btn-primary:hover:not(:disabled) {
  background:   var(--gold2);
  border-color: var(--gold2);
}

.btn-secondary {
  background:   transparent;
  border-color: var(--border);
  color:        var(--text);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--gold);
  color:        var(--gold);
}

.btn-ghost {
  background:   transparent;
  border-color: transparent;
  color:        var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  color:        var(--text);
  background:   var(--border2);
}

.btn-danger {
  background:   transparent;
  border-color: var(--red);
  color:        var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red);
  color:      var(--black);
}

.btn-sm {
  padding:    var(--sp-1) var(--sp-3);
  font-size:  0.8125rem;
  min-height: 28px;
}

.btn-full {
  width:           100%;
  justify-content: center;
}

.btn-icon {
  padding:  var(--sp-2);
  min-width: 36px;
  width:     36px;
  height:    36px;
}

/* ── Form elements ────────────────────────────────────────── */
.form-group {
  display:        flex;
  flex-direction: column;
  gap:            var(--sp-1);
}

.form-group label {
  font-size:   0.8125rem;
  font-weight: 500;
  color:       var(--muted);
  letter-spacing: 0.01em;
}

.form-group label.required::after {
  content: ' *';
  color:   var(--gold);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="search"],
select,
textarea {
  width:         100%;
  padding:       var(--sp-2) var(--sp-3);
  background:    var(--jet);
  border:        1px solid var(--border2);
  border-radius: var(--radius);
  color:         var(--text);
  transition:    border-color var(--ease), box-shadow var(--ease);
  outline:       none;
  min-height:    40px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow:   0 0 0 2px rgba(201, 150, 30, 0.15);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor:  not-allowed;
}

select {
  appearance:      none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a756c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right var(--sp-3) center;
  padding-right:   var(--sp-8);
}

textarea {
  resize:     vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-row {
  display: grid;
  gap:     var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.form-error {
  font-size: 0.8125rem;
  color:     var(--red);
  margin-top: var(--sp-1);
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position:   fixed;
  inset:      0;
  background: rgba(8, 7, 6, 0.85);
  z-index:    900;
  display:    flex;
  align-items: center;
  justify-content: center;
  padding:    var(--sp-4);
  backdrop-filter: blur(2px);
}

.modal {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  width:         100%;
  max-width:     560px;
  max-height:    90dvh;
  overflow-y:    auto;
  display:       flex;
  flex-direction: column;
}

.modal-lg { max-width: 780px; }
.modal-xl { max-width: 980px; }

.modal-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--sp-5) var(--sp-6);
  border-bottom:   1px solid var(--border2);
  position:        sticky;
  top:             0;
  background:      var(--surface);
  z-index:         1;
}

.modal-header h3 {
  font-family: var(--font-ui);
  font-size:   1rem;
  font-weight: 600;
  color:       var(--egg);
}

.modal-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  flex: 1;
}

.modal-footer {
  display:         flex;
  align-items:     center;
  justify-content: flex-end;
  gap:             var(--sp-3);
  padding:         var(--sp-4) var(--sp-6);
  border-top:      1px solid var(--border2);
  position:        sticky;
  bottom:          0;
  background:      var(--surface);
}

/* ── Toast notifications ──────────────────────────────────── */
#toast-container {
  position:       fixed;
  bottom:         var(--sp-6);
  right:          var(--sp-6);
  z-index:        9999;
  display:        flex;
  flex-direction: column;
  gap:            var(--sp-2);
  pointer-events: none;
}

.toast {
  display:       flex;
  align-items:   center;
  gap:           var(--sp-3);
  padding:       var(--sp-3) var(--sp-4);
  background:    var(--surface2);
  border:        1px solid var(--border2);
  border-radius: var(--radius);
  font-size:     0.875rem;
  min-width:     260px;
  max-width:     360px;
  pointer-events: all;
  animation:     toast-in 200ms ease forwards;
  box-shadow:    0 4px 16px rgba(0,0,0,0.4);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red);   }
.toast.info    { border-left: 3px solid var(--blue);  }

.toast-dot {
  width:         8px;
  height:        8px;
  border-radius: 50%;
  flex-shrink:   0;
}
.toast.success .toast-dot { background: var(--green); }
.toast.error   .toast-dot { background: var(--red);   }
.toast.info    .toast-dot { background: var(--blue);  }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ── Badge / Chip ─────────────────────────────────────────── */
.badge {
  display:       inline-flex;
  align-items:   center;
  padding:       2px var(--sp-2);
  border-radius: 999px;
  font-size:     0.6875rem;
  font-weight:   600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space:   nowrap;
}

.badge-gold    { background: rgba(201,150,30,0.18); color: var(--gold2); }
.badge-green   { background: rgba(122,191,142,0.18); color: var(--green); }
.badge-red     { background: rgba(224,128,112,0.18); color: var(--red); }
.badge-blue    { background: rgba(122,159,196,0.18); color: var(--blue); }
.badge-muted   { background: var(--border2); color: var(--muted); }
.badge-purple  { background: rgba(154,143,212,0.18); color: var(--purple); }

/* Booking status badges */
.badge-pending         { background: rgba(122,159,196,0.18); color: var(--blue); }
.badge-confirmed       { background: rgba(201,150,30,0.18);  color: var(--gold2); }
.badge-completed       { background: rgba(122,191,142,0.18); color: var(--green); }
.badge-no_show         { background: rgba(224,128,112,0.18); color: var(--red); }
.badge-cancelled_refund,
.badge-cancelled_no_refund { background: var(--border2); color: var(--muted); }

/* BD tier badges */
.badge-tier-standard { background: var(--border2);              color: var(--muted); }
.badge-tier-bronze   { background: rgba(196,164,106,0.18);      color: var(--wheat); }
.badge-tier-silver   { background: rgba(180,190,200,0.18);      color: #b4bec8; }
.badge-tier-gold     { background: rgba(201,150,30,0.18);       color: var(--gold2); }
.badge-tier-diamond  { background: rgba(154,143,212,0.18);      color: var(--purple); }

/* ── Auth / Login page ────────────────────────────────────── */
.auth-wrapper {
  display:          flex;
  align-items:      center;
  justify-content:  center;
  min-height:       100dvh;
  padding:          var(--sp-4);
  background:       var(--black);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(201,150,30,0.06) 0%, transparent 70%);
}

.auth-card {
  width:         100%;
  max-width:     400px;
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  padding:       var(--sp-10) var(--sp-8);
  display:       flex;
  flex-direction: column;
  gap:           var(--sp-8);
}

.auth-brand {
  text-align: center;
}

.auth-logo-text {
  display:     block;
  font-family: var(--font-display);
  font-size:   2rem;
  font-weight: 600;
  color:       var(--egg);
  letter-spacing: 0.04em;
}

.auth-logo-text .gold { color: var(--gold); }

.auth-subtitle {
  font-size:   0.8125rem;
  color:       var(--muted);
  margin-top:  var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-form {
  display:        flex;
  flex-direction: column;
  gap:            var(--sp-5);
}

.auth-error {
  padding:       var(--sp-3) var(--sp-4);
  background:    rgba(224, 128, 112, 0.12);
  border:        1px solid rgba(224, 128, 112, 0.3);
  border-radius: var(--radius);
  color:         var(--red);
  font-size:     0.875rem;
  line-height:   1.4;
}

.auth-footer {
  text-align: center;
  font-size:  0.75rem;
  color:      var(--muted);
}

/* ── Offline banner ───────────────────────────────────────── */
.offline-banner {
  position:    fixed;
  top:         0;
  left:        0;
  right:       0;
  z-index:     9000;
  padding:     var(--sp-2) var(--sp-4);
  background:  rgba(224, 128, 112, 0.12);
  border-bottom: 1px solid rgba(224, 128, 112, 0.3);
  color:       var(--red);
  font-size:   0.8125rem;
  text-align:  center;
  display:     none;
}
.offline-banner.visible { display: block; }

/* ── Loading spinner ──────────────────────────────────────── */
.spinner {
  width:          20px;
  height:         20px;
  border:         2px solid var(--border2);
  border-top-color: var(--gold);
  border-radius:  50%;
  animation:      spin 600ms linear infinite;
  flex-shrink:    0;
}

.spinner-lg {
  width:  40px;
  height: 40px;
  border-width: 3px;
}

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

.loading-screen {
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-direction:  column;
  gap:             var(--sp-4);
  min-height:      100dvh;
  color:           var(--muted);
  font-size:       0.875rem;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height:     1px;
  background: var(--border2);
  border:     none;
}

/* ── Utility classes ──────────────────────────────────────── */
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--muted); }
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.text-egg    { color: var(--egg); }
.text-sm     { font-size: 0.8125rem; }
.text-xs     { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.truncate {
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }

.hidden { display: none !important; }
.sr-only {
  position:  absolute;
  width:     1px;
  height:    1px;
  padding:   0;
  margin:    -1px;
  overflow:  hidden;
  clip:      rect(0,0,0,0);
  border:    0;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,150,30,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,150,30,0.4); }

/* ── Focus visible ────────────────────────────────────────── */
:focus-visible {
  outline:        2px solid var(--gold);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }
