/* ============================================
   STAYLOCAL DESIGN SYSTEM — "Clear Horizon"
   Airy, optimistic, minimal travel experience
   ============================================ */

:root {
  /* Primary palette */
  --primary: #0077B6;
  --primary-light: #00B4D8;
  --primary-dark: #005F8A;
  --secondary: #E9ECEF;
  --accent: #FFB703;
  --accent-dark: #E5A503;
  --bg: #FFFFFF;

  /* Text */
  --text-primary: #1B1B1E;
  --text-secondary: #6C757D;
  --text-tertiary: #ADB5BD;
  --text-on-primary: #FFFFFF;
  --text-on-accent: #1B1B1E;

  /* Semantic */
  --success: #2DC653;
  --success-bg: #E8F8ED;
  --error: #E63946;
  --error-bg: #FDE8EA;
  --info: #0077B6;
  --info-bg: #E3F2FD;
  --warning: #FFB703;
  --warning-bg: #FFF8E1;

  /* Surfaces */
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --surface-muted: #F8F9FA;
  --border: #E9ECEF;
  --border-light: #F1F3F5;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.1);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 0;
  -webkit-font-smoothing: antialiased;
}

/* ============= DEVICE FRAME ============= */
.device {
  width: 375px;
  height: 812px;
  background: var(--bg);
  border-radius: 44px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 8px #0f0f23, 0 0 0 10px #444, 0 40px 100px rgba(0,0,0,.6);
}

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 30px;
  background: #0f0f23;
  border-radius: 0 0 20px 20px;
  z-index: 1000;
}

.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 26px;
  font-size: 12px;
  font-weight: 600;
  z-index: 999;
  color: #fff;
  transition: color .2s var(--ease);
}

.status-bar.dark { color: var(--text-primary); }

.status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============= SCREEN SYSTEM ============= */
.screen-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface-muted);
}

.screen.active { display: flex; }
.screen::-webkit-scrollbar { display: none; }

/* Onboarding pages */
.ob-page { display: none; flex-direction: column; align-items: center; text-align: center; padding: 60px 30px 30px; height: 100%; }
.ob-page.active { display: flex; }

/* ============= TAB BAR ============= */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 84px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  z-index: 900;
  transition: transform .3s var(--ease);
}

.tab-bar.hidden { display: none; }

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 50px;
  padding: 4px;
  transition: color .2s var(--ease);
  font-family: inherit;
  position: relative;
}

.tab-item.active { color: var(--primary); }
.tab-item svg { width: 22px; height: 22px; transition: all .2s var(--ease); }
.tab-item.active svg { stroke: var(--primary); }

.tab-badge {
  position: absolute;
  top: -2px;
  right: 6px;
  width: 16px;
  height: 16px;
  background: var(--error);
  border-radius: var(--radius-full);
  font-size: 9px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ============= TYPOGRAPHY ============= */
.heading-xl {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -.3px;
}

.heading-lg {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -.2px;
}

.heading-md {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.heading-sm {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.body-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.caption {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.micro {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
}

/* ============= SCREEN HEADER ============= */
.screen-header {
  padding: 54px 20px 12px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.screen-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============= BUTTONS ============= */
.btn-back {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  font-weight: 600;
  font-family: inherit;
}

.btn-back svg { width: 20px; height: 20px; }

.btn-action {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px;
  font-weight: 600;
  font-family: inherit;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
  letter-spacing: .2px;
}

.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(.98); opacity: .9; }

.btn-secondary {
  width: 100%;
  padding: 16px;
  background: var(--secondary);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
}

.btn-secondary:hover { background: #DEE2E6; }

.btn-social {
  width: 100%;
  padding: 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color .15s var(--ease);
}

.btn-social:hover { border-color: #CED4DA; }

/* ============= INPUTS ============= */
.input-field {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--surface);
  outline: none;
  font-family: inherit;
  transition: border-color .2s var(--ease);
  color: var(--text-primary);
}

.input-field:focus { border-color: var(--primary); }

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

/* ============= CARDS ============= */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.card-img {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  position: relative;
}

.card-body { padding: 14px; }

/* ============= LIST ITEMS ============= */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background .15s var(--ease);
}

.list-item:active { background: var(--surface-muted); }

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.list-content { flex: 1; min-width: 0; }

/* ============= BADGES & CHIPS ============= */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: var(--info-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-accent { background: var(--warning-bg); color: #B8860B; }
.badge-error { background: var(--error-bg); color: var(--error); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  padding: 8px 14px;
  border-radius: var(--radius-xl);
  background: var(--secondary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s var(--ease);
}

.chip.active { background: var(--primary); color: #fff; }

/* ============= EMOJI BUTTONS ============= */
.emoji-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s var(--ease);
}

.emoji-btn.selected {
  border-color: var(--primary);
  background: var(--info-bg);
  transform: scale(1.1);
}

/* ============= UTILITY ============= */
.section-pad { padding: 0 20px; }
.section-gap { margin-bottom: 24px; }

.scroll-h {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 20px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.scroll-h::-webkit-scrollbar { display: none; }
.scroll-h > * { flex-shrink: 0; scroll-snap-align: start; }

.divider { height: 1px; background: var(--border-light); margin: 0 20px; }

.spacer-sm { height: 8px; }
.spacer-md { height: 16px; }
.spacer-lg { height: 24px; }
.spacer-xl { height: 32px; }

.safe-bottom { height: 100px; flex-shrink: 0; }

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--secondary);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ============= DISCOUNT TAG ============= */
.discount-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: var(--text-on-accent);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

/* ============= PROGRESS BAR ============= */
.progress-bar {
  height: 6px;
  background: var(--secondary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s var(--ease);
}

/* ============= TOGGLE SWITCH ============= */
.toggle {
  width: 48px;
  height: 28px;
  background: var(--success);
  border-radius: 14px;
  position: relative;
  flex-shrink: 0;
}

.toggle-knob {
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: var(--radius-full);
  position: absolute;
  top: 2px;
  right: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ============= TOAST ============= */
.toast {
  position: absolute;
  top: 56px;
  left: 20px;
  right: 20px;
  background: var(--text-primary);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  display: none;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  display: flex;
  animation: slideDown .3s var(--ease);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============= WIREFRAME LABEL ============= */
.wire-label {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 9px;
  color: var(--text-tertiary);
  z-index: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  font-weight: 600;
}

/* ============= WEATHER WIDGET ============= */
.weather-widget {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
  cursor: pointer;
  transition: transform .15s var(--ease);
}

.weather-widget:active { transform: scale(.98); }

/* ============= CODE INPUT ============= */
.code-char {
  width: 44px;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  background: var(--surface);
  outline: none;
  text-transform: uppercase;
  font-family: inherit;
  transition: border-color .2s var(--ease);
  color: var(--text-primary);
}

.code-char:focus { border-color: var(--primary); }

/* ============= ANIMATIONS ============= */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.pulse { animation: pulse 2s infinite; }

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