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

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

:root {
  --bg: #080808;
  --surface: #111110;
  --surface-raised: #1a1918;
  --surface-hover: #222120;
  --border: #2a2928;
  --border-light: #3a3938;
  --text: #e6e1d8;
  --text-dim: #8a8580;
  --text-faint: #5a5550;
  --accent: #c9a84c;
  --accent-dim: #a88a3a;
  --accent-glow: rgba(201, 168, 76, 0.12);
  --accent-glow-strong: rgba(201, 168, 76, 0.25);
  --error: #e5484d;
  --success: #30a46c;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Outfit', -apple-system, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overscroll-behavior: none;
}

/* ——— App Container ——— */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s 0.35s;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s 0s;
}

/* ——— Screen Header ——— */
.screen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  flex-shrink: 0;
}

.screen-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text);
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  flex-shrink: 0;
}

.btn-back:active {
  background: var(--surface-hover);
}

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

/* ——— Home Screen ——— */
.brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-bottom: 20px;
  min-height: 0;
}

.brand-icon {
  width: 96px;
  height: 96px;
  margin-bottom: 10px;
}

.brand-icon svg {
  width: 100%;
  height: 100%;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}

.brand p {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

/* ——— Booking Form ——— */
.booking-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 12px;
}

.field-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pickup-actions {
  display: flex;
  gap: 8px;
}

.btn-action-sm {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.btn-action-sm:active {
  background: var(--surface-hover);
  transform: scale(0.97);
}

.btn-action-sm svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.field-status {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 10px;
  background: var(--surface);
  border-radius: var(--radius-xs);
  text-align: center;
}

.field-status.error {
  color: var(--error);
}

.field-status.success {
  color: var(--success);
}

.pickup-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow-strong);
}

.dropoff-dot {
  background: var(--text);
}

.dot-sm {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.route-line-connector {
  width: 2px;
  height: 16px;
  background: var(--border);
  margin: 4px 0 4px 16px;
  border-radius: 1px;
}

.address-search {
  position: relative;
  flex: 1;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

.address-input {
  width: 100%;
  padding: 14px 40px 14px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
}

.address-input:focus {
  border-color: var(--accent-dim);
}

.address-input::placeholder {
  color: var(--text-faint);
}

.btn-clear-input {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  -webkit-appearance: none;
  border-radius: 50%;
}

.btn-clear-input:active {
  background: var(--surface-hover);
}

.btn-clear-input svg {
  width: 14px;
  height: 14px;
}

input[type="file"] {
  display: none;
}

/* ——— Suggestions ——— */
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 4px;
  padding: 4px 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.suggestions li {
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border);
}

.suggestions li:last-child {
  border-bottom: none;
}

.suggestions li:active {
  background: var(--surface-hover);
}

.suggestions .suggestion-main {
  font-weight: 500;
  color: var(--text);
}

.suggestions .suggestion-detail {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.suggestions .suggestion-loading {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  cursor: default;
}

/* ——— Primary Button ——— */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  margin-top: 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-dim);
  transform: scale(0.98);
}

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

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-primary.btn-outline {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-primary.btn-outline:active {
  background: var(--accent-glow);
}

/* ——— Route Summary Bar ——— */
.route-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.route-summary-locations {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.route-point {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.route-point span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-summary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

.meta-sep {
  color: var(--text-faint);
}

/* ——— Car Cards ——— */
.cars-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
}

.car-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateY(16px);
  animation: card-enter 0.4s ease forwards;
}

.car-card:nth-child(1) { animation-delay: 0.05s; }
.car-card:nth-child(2) { animation-delay: 0.10s; }
.car-card:nth-child(3) { animation-delay: 0.15s; }
.car-card:nth-child(4) { animation-delay: 0.20s; }
.car-card:nth-child(5) { animation-delay: 0.25s; }
.car-card:nth-child(6) { animation-delay: 0.30s; }

@keyframes card-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.car-card:active {
  transform: scale(0.98);
  border-color: var(--accent-dim);
}

.car-card.selected {
  border-color: var(--accent);
  background: var(--surface-raised);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px var(--accent-glow);
}

.car-image {
  width: 100px;
  height: 70px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}

.car-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.car-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.car-features {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.car-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}

.car-eta {
  font-size: 12px;
  color: var(--text-dim);
}

/* ——— Booking Summary ——— */
.summary-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
}

.summary-hero {
  width: 100%;
  height: 180px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
}

.summary-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.summary-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(8,8,8,0.85));
}

.summary-hero-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--text);
}

.summary-section {
  margin-bottom: 20px;
}

.summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.summary-journey {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.journey-point {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}

.journey-line {
  width: 2px;
  height: 16px;
  background: var(--border);
  margin: 6px 0 6px 3px;
  border-radius: 1px;
}

/* ——— Price Breakdown ——— */
.price-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
}

.price-row.price-total {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.price-amount {
  color: var(--accent);
}

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

/* ——— Confirm Button ——— */
.btn-confirm {
  margin-top: 24px;
}

.btn-confirm-text,
.btn-confirm-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner-icon {
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
}

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

/* ——— Confirmed Screen ——— */
.confirmed-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0;
}

.success-check {
  width: 80px;
  height: 80px;
  animation: check-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: scale(0);
}

.success-check svg {
  width: 100%;
  height: 100%;
}

.check-path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: check-draw 0.4s ease 0.3s forwards;
}

@keyframes check-pop {
  to { transform: scale(1); }
}

@keyframes check-draw {
  to { stroke-dashoffset: 0; }
}

.confirmed-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text);
}

.confirmed-ref {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ——— Driver Card ——— */
.driver-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}

.driver-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
}

.driver-info {
  flex: 1;
}

.driver-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.driver-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.driver-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ——— Confirmed Details ——— */
.confirmed-details {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin-top: 4px;
}

.confirmed-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.confirmed-detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 14px;
  color: var(--text-dim);
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.detail-price {
  color: var(--accent);
  font-weight: 600;
}

/* ——— Version Row ——— */
.version-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0 0;
}

.version-tag {
  text-align: center;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.btn-update {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-faint);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  transition: all 0.2s ease;
}

.btn-update:active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* ——— Install Banner ——— */
.install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  animation: banner-slide 0.35s ease;
}

@keyframes banner-slide {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.install-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.install-banner-text {
  flex: 1;
  min-width: 0;
}

.install-banner-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.install-banner-text span {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.share-icon-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  color: var(--accent);
  vertical-align: middle;
  flex-shrink: 0;
}

.install-banner-action {
  padding: 6px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-xs);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  flex-shrink: 0;
}

.install-banner-action:active {
  background: var(--accent-dim);
}

.install-banner-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  -webkit-appearance: none;
  flex-shrink: 0;
}

.install-banner-close svg {
  width: 14px;
  height: 14px;
}

/* ——— Settings Button ——— */
.btn-settings {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.btn-settings:active {
  background: var(--surface);
  color: var(--text);
}

.btn-settings svg {
  width: 18px;
  height: 18px;
}

/* ——— Settings Modal ——— */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal {
  transform: translateY(100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.04em;
}

.btn-modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  cursor: pointer;
  -webkit-appearance: none;
}

.btn-modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.key-input-row {
  display: flex;
  gap: 8px;
}

.key-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
}

.key-input:focus {
  border-color: var(--accent-dim);
}

.key-input::placeholder {
  color: var(--text-faint);
}

.btn-toggle-key {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  -webkit-appearance: none;
}

.btn-toggle-key svg {
  width: 18px;
  height: 18px;
}

.input-hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
}

.btn-save-key {
  margin-top: 4px;
  text-align: center;
}

/* ——— Utility ——— */
.hidden {
  display: none !important;
}

/* ——— Scrollbar ——— */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ——— Desktop ——— */
@media (min-width: 480px) {
  .screen {
    max-width: 440px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  .brand h1 {
    font-size: 50px;
  }

  .modal {
    border-radius: var(--radius);
    margin-bottom: 40px;
  }

  .modal-overlay {
    align-items: center;
  }
}

@media (min-width: 768px) {
  .screen {
    max-width: 520px;
  }
}
