/* ============================================================
   Aircraft Marketplace – Design System Tokens & Component Styles
   Based on aircraft-marketplace-design-system.json
   ============================================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Brand */
  --brand-orange: #FF5000;
  --brand-orange-hover: #E74600;
  --accent-gold: #DC9542;

  /* Neutrals */
  --ink-900: #141515;
  --charcoal-850: #16191C;
  --slate-800: #242B31;
  --slate-700: #3A4044;
  --steel-400: #ABB7BD;
  --fog-200: #DFE1E2;
  --mist-100: #F4F5F6;
  --white: #FFFFFF;

  /* State */
  --success: #22C55E;
  --error: #EF4444;
  --warning: #F59E0B;

  /* Gradients */
  --scrim-strong: linear-gradient(to bottom, rgba(0,0,0,0) 55%, rgba(0,0,0,0.85) 100%);
  --scrim-soft: linear-gradient(to bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.7) 100%);

  /* Typography */
  --font-base: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;

  /* Spacing (8px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 40px;
  --sp-8: 48px;
  --sp-9: 64px;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 9999px;

  /* Sizing */
  --container-max: 1280px;
  --nav-height: 64px;
  --nav-height-mobile: 56px;
}

/* --- Base Reset & Typography --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* Display Typography */
.text-display1 { font-family: var(--font-display); font-size: 56px; font-weight: 800; line-height: 1.1; }
.text-h1 { font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1.15; }
.text-h2 { font-family: var(--font-display); font-size: 32px; font-weight: 800; line-height: 1.2; }
.text-h3 { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.25; }
.text-title { font-size: 18px; font-weight: 700; line-height: 1.4; }
.text-body { font-size: 16px; font-weight: 400; line-height: 1.5; }
.text-body-sm { font-size: 14px; font-weight: 400; line-height: 1.43; }
.text-caption { font-size: 12px; font-weight: 500; line-height: 1.33; }
.text-price-xl { font-family: var(--font-display); font-size: 48px; font-weight: 800; line-height: 1; }
.text-price-l { font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1.15; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.04em; }

/* --- Container --- */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 24px; }
@media (min-width: 768px) { .container { padding: 0 32px; } }

/* --- Navigation --- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  background: var(--ink-900);
  display: flex; align-items: center;
  transition: background 0.3s ease;
}
.nav.nav--transparent { background: transparent; }
.nav.nav--scrolled { background: var(--ink-900); }
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 24px;
}
.nav__logo { color: var(--white); font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.nav__logo span { color: var(--brand-orange); }
.nav__links { display: none; align-items: center; gap: 4px; margin-left: 32px; }
@media (min-width: 768px) { .nav__links { display: flex; } }
.nav__link {
  color: var(--steel-400); font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-pill);
  transition: color 0.15s, background 0.15s;
}
.nav__link:hover, .nav__link.active { color: var(--white); background: var(--slate-800); }
.nav__actions { display: flex; align-items: center; gap: 12px; }
.nav__cta {
  display: none; background: var(--brand-orange); color: var(--white);
  font-size: 14px; font-weight: 600; padding: 8px 20px;
  border-radius: var(--r-pill); border: none;
  transition: background 0.15s;
}
.nav__cta:hover { background: var(--brand-orange-hover); }
@media (min-width: 768px) { .nav__cta { display: inline-flex; } }
.nav__auth-btn {
  color: var(--steel-400); font-size: 14px; font-weight: 500;
  background: none; border: 1px solid var(--slate-700);
  padding: 7px 16px; border-radius: var(--r-pill);
  transition: color 0.15s, border-color 0.15s;
}
.nav__auth-btn:hover { color: var(--white); border-color: var(--steel-400); }
.nav__user { display: flex; align-items: center; gap: 8px; position: relative; }
.nav__avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--slate-700);
  object-fit: cover; cursor: pointer;
}
.nav__user-menu {
  display: none; position: absolute; top: 44px; right: 0;
  background: var(--white); border: 1px solid var(--fog-200);
  border-radius: var(--r-sm); box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  min-width: 180px; padding: 8px 0; z-index: 200;
}
.nav__user-menu.open { display: block; }
.nav__user-menu a {
  display: block; padding: 10px 16px; font-size: 14px; color: var(--ink-900);
  transition: background 0.1s;
}
.nav__user-menu a:hover { background: var(--mist-100); }
.nav__hamburger {
  display: flex; background: none; border: none; color: var(--white); padding: 8px;
}
@media (min-width: 768px) { .nav__hamburger { display: none; } }

/* Mobile menu */
.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: var(--ink-900);
  padding: var(--nav-height) 24px 24px;
  flex-direction: column; gap: 8px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  color: var(--white); font-size: 18px; font-weight: 500;
  padding: 12px 0; border-bottom: 1px solid var(--slate-800);
}
.mobile-menu .mobile-menu__cta {
  margin-top: 16px; background: var(--brand-orange); color: var(--white);
  text-align: center; padding: 14px; border-radius: var(--r-pill);
  font-weight: 600; font-size: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 15px; border: none; border-radius: var(--r-pill);
  padding: 12px 24px; transition: all 0.15s; cursor: pointer;
  min-height: 44px;
}
.btn-primary { background: var(--brand-orange); color: var(--white); }
.btn-primary:hover { background: var(--brand-orange-hover); }
.btn-primary:disabled { background: var(--fog-200); color: var(--steel-400); cursor: not-allowed; }
.btn-secondary {
  background: var(--white); color: var(--ink-900);
  border: 1px solid var(--fog-200);
}
.btn-secondary:hover { border-color: var(--steel-400); }
.btn-secondary-dark {
  background: transparent; color: var(--white);
  border: 1px solid var(--slate-700);
}
.btn-secondary-dark:hover { border-color: var(--steel-400); }
.btn-tertiary { background: none; color: var(--brand-orange); padding: 8px 4px; border: none; }
.btn-tertiary:hover { text-decoration: underline; }
.btn-lg { padding: 14px 32px; font-size: 16px; min-height: 52px; }
.btn-sm { padding: 8px 16px; font-size: 13px; min-height: 36px; }

/* --- Cards --- */
.card {
  background: var(--white); border-radius: var(--r-lg);
  overflow: hidden; position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* Hero Listing Card (variant A — tall, image-forward, dark scrim) */
.hero-card {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  aspect-ratio: 9/14; min-width: 280px; flex-shrink: 0;
  cursor: pointer;
}
.hero-card__img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s;
}
.hero-card:hover .hero-card__img { transform: scale(1.03); }
.hero-card__overlay {
  position: absolute; inset: 0;
  background: var(--scrim-strong);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px;
}
.hero-card__brand {
  display: inline-block; background: var(--brand-orange); color: var(--white);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: var(--r-pill); margin-bottom: 8px;
  align-self: flex-start;
}
.hero-card__location { color: var(--steel-400); font-size: 12px; margin-bottom: 4px; }
.hero-card__price { color: var(--white); font-family: var(--font-display); font-size: 32px; font-weight: 800; }
.hero-card__title { color: var(--white); font-size: 16px; font-weight: 600; margin-top: 4px; }
.hero-card__desc { color: var(--steel-400); font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-card__cta { color: var(--brand-orange); font-size: 14px; font-weight: 600; margin-top: 12px; }
.hero-card__cta:hover { text-decoration: underline; }

/* Result Card (variant B — grid card) */
.result-card {
  display: flex; flex-direction: column;
  background: var(--white); border-radius: var(--r-lg);
  border: 1px solid var(--fog-200); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.result-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.result-card__img-wrap {
  position: relative; aspect-ratio: 4/3; overflow: hidden;
  background: var(--mist-100);
}
.result-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.result-card:hover .result-card__img { transform: scale(1.03); }
.result-card__badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--success); color: var(--white);
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-xs); text-transform: uppercase; letter-spacing: 0.04em;
}
.result-card__badge--new { background: var(--brand-orange); }
.result-card__badge--price-drop { background: var(--error); }
.result-card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.result-card__make { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--steel-400); }
.result-card__title { font-size: 16px; font-weight: 700; color: var(--ink-900); line-height: 1.3; }
.result-card__specs { display: flex; flex-wrap: wrap; gap: 6px; }
.result-card__location { font-size: 12px; color: var(--steel-400); display: flex; align-items: center; gap: 4px; }
.result-card__price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 8px; }
.result-card__price { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--ink-900); }
.result-card__price-currency { font-size: 13px; color: var(--steel-400); font-weight: 500; }

/* No-image placeholder */
.no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--mist-100); color: var(--steel-400);
}
.no-img svg { width: 48px; height: 48px; opacity: 0.4; }

/* --- Chips --- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--fog-200); background: var(--white); color: var(--ink-900);
  transition: all 0.15s; cursor: pointer;
}
.chip:hover { border-color: var(--steel-400); }
.chip.active { background: var(--ink-900); color: var(--white); border-color: var(--ink-900); }
.chip-sm { height: 26px; padding: 0 8px; font-size: 12px; }
.spec-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 10px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--mist-100); color: var(--slate-800);
  border: none;
}

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.form-input {
  height: 44px; padding: 0 14px; border: 1px solid var(--fog-200);
  border-radius: var(--r-sm); font-size: 15px; color: var(--ink-900);
  background: var(--white); transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus { outline: none; border-color: var(--brand-orange); box-shadow: 0 0 0 3px rgba(255,80,0,0.12); }
.form-input::placeholder { color: var(--steel-400); }
.form-textarea {
  padding: 12px 14px; min-height: 100px; resize: vertical;
  border: 1px solid var(--fog-200); border-radius: var(--r-sm);
  font-size: 15px; font-family: var(--font-base); color: var(--ink-900);
  width: 100%; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-textarea:focus { outline: none; border-color: var(--brand-orange); box-shadow: 0 0 0 3px rgba(255,80,0,0.12); }
.form-select {
  height: 44px; padding: 0 14px; border: 1px solid var(--fog-200);
  border-radius: var(--r-sm); font-size: 15px; color: var(--ink-900);
  background: var(--white); width: 100%; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23ABB7BD' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}
.form-select:focus { outline: none; border-color: var(--brand-orange); box-shadow: 0 0 0 3px rgba(255,80,0,0.12); }
.form-toggle-wrap { display: flex; align-items: center; gap: 12px; }
.form-toggle {
  position: relative; width: 44px; height: 24px; border-radius: 12px;
  background: var(--fog-200); border: none; cursor: pointer; transition: background 0.2s;
}
.form-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--white); transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.form-toggle.on { background: var(--brand-orange); }
.form-toggle.on::after { transform: translateX(20px); }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-xs); text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-verified { background: rgba(34,197,94,0.12); color: #16a34a; }
.badge-new { background: var(--brand-orange); color: var(--white); }
.badge-price-drop { background: rgba(239,68,68,0.12); color: var(--error); }

/* --- Footer --- */
.footer {
  background: var(--ink-900); color: var(--steel-400);
  padding: 64px 0 32px; margin-top: 80px;
}
.footer__grid {
  display: grid; grid-template-columns: 1fr; gap: 40px;
}
@media (min-width: 768px) { .footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer__brand { }
.footer__logo { color: var(--white); font-family: var(--font-display); font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.footer__logo span { color: var(--brand-orange); }
.footer__tagline { font-size: 14px; line-height: 1.5; max-width: 280px; }
.footer__col-title { color: var(--white); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }
.footer__links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer__links a { font-size: 14px; transition: color 0.15s; }
.footer__links a:hover { color: var(--white); }
.footer__bottom {
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--slate-800);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 13px;
}
.footer__sources { font-size: 12px; color: var(--slate-700); }

/* --- Skeleton Loaders --- */
.skeleton { background: var(--mist-100); border-radius: var(--r-sm); animation: skeleton-pulse 1.5s ease-in-out infinite; }
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.skeleton-card { border-radius: var(--r-lg); overflow: hidden; }
.skeleton-card .skeleton-img { aspect-ratio: 4/3; background: var(--fog-200); }
.skeleton-card .skeleton-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.skeleton-card .skeleton-line { height: 14px; border-radius: 4px; }
.skeleton-card .skeleton-line.w-60 { width: 60%; }
.skeleton-card .skeleton-line.w-40 { width: 40%; }
.skeleton-card .skeleton-line.w-80 { width: 80%; }

/* --- Toast Notifications --- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink-900); color: var(--white);
  padding: 12px 20px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: toast-in 0.3s ease-out;
  max-width: 360px;
}
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--error); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* --- Section helpers --- */
.section { padding: 64px 0; }
.section-dark { background: var(--ink-900); color: var(--white); }
.section-mist { background: var(--mist-100); }

/* --- Scrollbar hide for horizontal carousels --- */
.scroll-x { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { scroll-snap-align: start; }

/* --- Responsive helpers --- */
.hide-mobile { display: none !important; }
@media (min-width: 768px) {
  .hide-mobile { display: flex !important; }
  .hide-desktop { display: none !important; }
}

/* --- Page body offset for fixed nav --- */
.page-body { padding-top: var(--nav-height); }

/* --- Empty state --- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; text-align: center; color: var(--steel-400);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--ink-900); margin: 0 0 8px; }
.empty-state p { margin: 0; max-width: 360px; }
