@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Jost:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-elevated: #F5F0E8;
  --bg-disabled: #EDE8E0;
  --text-primary: #2B2723;
  --text-secondary: #6B6560;
  --text-muted: #9A948C;
  --text-disabled: #C4BEB6;
  --accent: #B9986A;
  --accent-hover: #A8874F;
  --accent-muted: rgba(185, 152, 106, 0.12);
  --accent-glow: rgba(185, 152, 106, 0.25);
  --green: #4A9B6E;
  --green-bg: rgba(74, 155, 110, 0.12);
  --red: #C45C4A;
  --border: #E8E0D4;
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}

.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(43, 39, 35, 0.04);
}
.header-inner {
  max-width: 500px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
}
.header-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 78px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid transparent;
  border-radius: 50px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
}
.header-nav-btn:hover {
  background: rgba(185, 152, 106, 0.2);
  border-color: rgba(185, 152, 106, 0.25);
}
.header-spacer {
  justify-self: end;
  min-width: 1px;
  display: flex;
  justify-content: flex-end;
}

/* Language selector */
.lang-selector-wrapper {
  position: relative;
}
.lang-selected-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid rgba(185, 152, 106, 0.25);
  padding: 6px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.lang-selector-wrapper:hover .lang-selected-btn,
.lang-selector-wrapper.lang-open .lang-selected-btn {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.lang-selector-wrapper::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(43, 39, 35, 0.08);
  list-style: none;
  min-width: 130px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  z-index: 200;
  padding: 4px 0;
}
.lang-selector-wrapper:hover .lang-dropdown,
.lang-selector-wrapper.lang-open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}
.lang-option {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
}
.lang-option:hover,
.lang-option.active {
  background: var(--accent-muted);
  color: var(--accent);
}
.lang-flag {
  font-size: 14px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
}
.logo-img {
  height: 40px;
  width: auto;
  display: block;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.1;
}
.logo-sub {
  display: block;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 2px;
}

.progress-bar {
  height: 3px;
  background: var(--border);
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.4s ease;
}

.main {
  max-width: 500px;
  margin: 0 auto;
  overflow: hidden;
  padding: 0 16px;
}
.wizard-track {
  display: flex;
  width: 500%;
  transition: transform 0.3s ease;
  will-change: transform;
}
.wizard-step {
  width: 20%;
  flex-shrink: 0;
  padding: 24px 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.wizard-step.active { opacity: 1; }

.step-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
}
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(43, 39, 35, 0.04);
}
.card:hover { border-color: rgba(185, 152, 106, 0.5); }
.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 16px var(--accent-glow);
}
.card-hero {
  border-left: 4px solid var(--accent);
  padding: 18px 16px;
}
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-name { font-size: 15px; font-weight: 600; }
.card-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 50px;
  background: var(--accent-muted);
  color: var(--accent);
  white-space: nowrap;
}
.card-duration { font-size: 13px; color: var(--text-secondary); }
.card-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.card .barber-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.date-strip-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 12px; }
.date-strip { display: flex; gap: 6px; padding: 4px 0; }
.date-pill {
  flex-shrink: 0;
  width: 56px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.date-pill:hover { border-color: rgba(185, 152, 106, 0.5); }
.date-pill.selected { border-color: var(--accent); background: var(--accent-muted); }
.date-pill.dimmed { opacity: 0.35; cursor: default; }
.date-pill .pill-day { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); }
.date-pill .pill-num { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.date-pill .pill-dot { width: 6px; height: 6px; border-radius: 50%; margin: 4px auto 0; }
.pill-dot.high { background: var(--green); }
.pill-dot.mid { background: #D4A843; }
.pill-dot.low { background: var(--text-muted); }

.date-display { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 12px; }

.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.time-slot {
  padding: 10px 6px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
}
.time-slot:hover:not(.unavailable):not(.outside-hours) { border-color: var(--accent); transform: translateY(-1px); }
.time-slot.available { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.time-slot.selected { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.time-slot.continue-slot { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }
.time-slot.unavailable { background: var(--bg-disabled); color: var(--text-disabled); cursor: default; border-color: transparent; }
.time-slot.outside-hours { background: var(--bg-primary); color: var(--text-disabled); cursor: default; border-color: transparent; opacity: 0.3; }

.barbers-ctx { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 8px; }

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(43, 39, 35, 0.04);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text-secondary); }
.summary-value { color: var(--text-primary); font-weight: 600; text-align: right; }
.summary-price { color: var(--accent); font-weight: 700; font-size: 18px; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.phone-row { display: flex; align-items: center; }
.phone-prefix {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}
.phone-row .form-control { border-radius: 0 var(--radius) var(--radius) 0; }
.phone-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--red); margin-top: 4px; }

.wizard-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(43, 39, 35, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wizard-footer-inner {
  max-width: 500px;
  margin: 0 auto;
}

.sticky-bar {
  max-width: 500px;
  margin: 0 auto;
  padding: 10px 16px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.sticky-label {
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sticky-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.sticky-actions {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  letter-spacing: 0.02em;
}
.btn:disabled { cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  width: 100%;
  border: 1px solid var(--accent);
}
.btn-primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled {
  opacity: 1;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondary:hover { background: var(--accent-muted); }
.btn-full { width: 100%; }

.loader { display: flex; justify-content: center; padding: 40px; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { font-size: 14px; color: var(--red); text-align: center; padding: 16px; }
.info-msg { font-size: 14px; color: var(--text-muted); text-align: center; padding: 24px; }

.confirm-content { text-align: center; padding: 40px 0; }
.confirm-check { width: 80px; height: 80px; margin: 0 auto 24px; display: block; }
.confirm-check circle { stroke-dasharray: 226; stroke-dashoffset: 226; animation: drawCircle 0.6s ease forwards; stroke: var(--green); }
.confirm-check path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: drawCheck 0.4s 0.4s ease forwards; stroke: var(--green); }
@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
.confirm-sms { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }
.confirm-actions { margin-bottom: 12px; }

.hidden { display: none !important; }

@media (max-width: 480px) {
  .step-title { font-size: 22px; margin-bottom: 16px; }
  .logo-text { font-size: 16px; }
  .logo-img { height: 36px; }
  .header-nav-btn { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  .time-grid { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 14px; }
  .wizard-step { padding: 20px 0; }
}

@media (min-width: 501px) {
  .wizard-footer {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
