/* Hallaq — client booking demo
   Tokens from Maghreb Noir design system (see /CLAUDE.md, /DESIGN.md) */

:root {
  --bg: #0E0E10;
  --surface-1: #1B1B1D;
  --surface-2: #232326;
  --surface-3: #353437;

  --gold: #F2BF52;
  --gold-container: #D4A439;
  --on-gold: #402D00;

  --whatsapp: #25D366;
  --paid-green: #3DE273;

  --error: #FFB4AB;

  --text-primary: #F5F1E8;
  --text-secondary: #A8A6A3;
  --text-disabled: #6B6966;

  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-input: 8px;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 20px;
  --space-4: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100%;
}

body {
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

button {
  font-family: inherit;
}

.loading-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 100vh;
  padding: var(--space-3);
  text-align: center;
}

.app.is-loading .loading-screen {
  display: flex;
}

.app.is-loading .barber-header,
.app.is-loading .screens {
  display: none;
}

.loading-screen__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--gold);
  animation: hallaq-spin 0.8s linear infinite;
}

.loading-screen__text {
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-screen__text.is-error {
  color: var(--error);
}

/* Pending-setup state (see index.html) — hidden by default, shown only via .app.is-pending-setup;
   gold/neutral tones like the rest of the page, deliberately not the error color, since this is an
   expected state, not a failure. */
.pending-setup {
  display: none;
}

.app.is-pending-setup .pending-setup {
  display: flex;
}

.app.is-pending-setup .loading-screen#loadingScreen,
.app.is-pending-setup .barber-header,
.app.is-pending-setup .screens {
  display: none;
}

.pending-setup__icon {
  font-size: 40px;
}

.pending-setup__title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 17px;
  margin: 0;
}

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

.slot-error {
  margin: 0 0 var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-input);
  background: rgba(255, 180, 171, 0.12);
  color: var(--error);
  font-size: 14px;
}

.slot-error[hidden] {
  display: none;
}

.slots__loading {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---------- Header ---------- */

.barber-header {
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: var(--surface-1);
  border-bottom: 1px solid var(--surface-3);
  position: sticky;
  top: 0;
  z-index: 10;
}

.barber-header__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: var(--gold-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid var(--gold);
}

.barber-header__info {
  flex: 1;
  min-width: 0;
}

.barber-header__shop {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barber-header__name {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.barber-header__whatsapp {
  margin-top: var(--space-2);
}

.lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-btn);
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 32px;
}

.lang-btn.is-active {
  background: var(--gold);
  color: var(--on-gold);
}

/* ---------- Progress ---------- */

.progress {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: var(--space-2) 0 0;
  padding: 0;
}

.progress__step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.progress__step span {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress__step em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-disabled);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress__step.is-active span {
  background: var(--gold);
  color: var(--on-gold);
}

.progress__step.is-active em {
  color: var(--text-primary);
}

.progress__step.is-done span {
  background: var(--paid-green);
  color: var(--on-gold);
}

/* ---------- Screens ---------- */

.screens {
  flex: 1;
  padding: var(--space-3);
  padding-bottom: 48px;
}

.screen {
  display: none;
  animation: fade-in 0.15s ease-out;
}

.screen.is-active {
  display: block;
}

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

.screen__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
  margin: 0 0 var(--space-3);
}

/* ---------- Service cards ---------- */

.services {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  background: var(--surface-1);
  border: 2px solid var(--surface-3);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  min-height: 48px;
  cursor: pointer;
  text-align: start;
  color: var(--text-primary);
  transition: border-color 0.12s, transform 0.08s;
}

.service-card:active {
  transform: scale(0.98);
}

.service-card.is-selected {
  border-color: var(--gold);
  background: var(--surface-2);
}

.service-card__name {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.service-card__duration {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.service-card__price {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

/* ---------- Day pills ---------- */

.day-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: var(--space-3);
  scrollbar-width: none;
}

.day-pills::-webkit-scrollbar { display: none; }

.day-pill {
  flex: 0 0 auto;
  min-width: 60px;
  min-height: 60px;
  border-radius: var(--radius-card);
  border: 2px solid var(--surface-3);
  background: var(--surface-1);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.day-pill__dow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.day-pill__num {
  font-size: 18px;
  font-weight: 700;
}

.day-pill.is-active {
  border-color: var(--gold);
  background: var(--gold-container);
}

.day-pill.is-active .day-pill__dow,
.day-pill.is-active .day-pill__num {
  color: var(--on-gold);
}

.day-pill.is-friday .day-pill__dow {
  color: var(--gold);
}

/* ---------- Time slots ---------- */

.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: var(--space-3);
}

.slot-btn {
  min-height: 48px;
  border-radius: var(--radius-btn);
  border: 2px solid var(--surface-3);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.slot-btn:active {
  transform: scale(0.98);
}

.slot-btn.is-selected {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.slot-btn:disabled {
  border-style: dashed;
  color: var(--text-disabled);
  background: transparent;
  cursor: not-allowed;
}

.slots__empty {
  grid-column: 1 / -1;
  color: var(--text-secondary);
  font-size: 14px;
  padding: var(--space-3) 0;
  text-align: center;
}

/* ---------- Buttons ---------- */

.btn {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-btn);
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn--gold {
  background: var(--gold);
  color: var(--on-gold);
}

.btn--gold:active {
  transform: scale(0.98);
}

.btn--whatsapp {
  background: var(--whatsapp);
  color: #06210F;
}

.btn--whatsapp:active {
  transform: scale(0.98);
}

.btn--directions {
  background: transparent;
  color: var(--gold);
  border: 2px solid var(--gold);
}

.btn--directions:active {
  transform: scale(0.98);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--surface-3);
}

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

.btn__icon {
  font-size: 18px;
}

/* ---------- Form ---------- */

.form {
  display: flex;
  flex-direction: column;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-2);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field input {
  font-family: inherit;
  min-height: 48px;
  border-radius: var(--radius-input);
  border: 2px solid var(--surface-3);
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 16px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
}

/* ---------- Recap card ---------- */

.recap-card {
  background: var(--surface-1);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
}

.recap-row:not(:last-child) {
  border-bottom: 1px solid var(--surface-3);
}

.recap-row__label {
  font-size: 13px;
  color: var(--text-secondary);
}

.recap-row__value {
  font-size: 15px;
  font-weight: 600;
  text-align: end;
}

.recap-row__value.is-price {
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
}

/* ---------- Confirmation ---------- */

.confirm {
  text-align: center;
}

.confirm__check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--paid-green);
  color: #06210F;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
}

.confirm__sub {
  color: var(--text-secondary);
  margin: -10px 0 var(--space-3);
  font-size: 14px;
}

.confirm .recap-card {
  text-align: start;
}

/* ---------- RTL (Arabic / stub) ---------- */

.app.is-rtl {
  direction: rtl;
}
