/* ═══════════════════════════════════════════════════════
   Dejan's Avto.net — Style Sheet
   Mobile-first, dark theme, Avto.net inspired
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Colors */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d28;
  --bg-card: #1e2130;
  --bg-card-hover: #252840;
  --accent: #e8651a;
  --accent-hover: #ff7a2e;
  --accent-glow: rgba(232, 101, 26, 0.3);
  --text-primary: #f0f0f5;
  --text-secondary: #9a9ab0;
  --text-muted: #6b6b80;
  --border: #2a2d3e;
  --success: #2ecc71;
  --danger: #e74c3c;
  --price-bg: rgba(232, 101, 26, 0.15);
  --price-text: #ff8c42;
  --overlay: rgba(10, 10, 20, 0.85);

  /* Spacing */
  --gap: 16px;
  --radius: 12px;
  --radius-sm: 8px;

  /* Transitions */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* ── Header ────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--gap);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #ff6b35);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--accent);
}

.nav-links {
  display: none;
  list-style: none;
  gap: 28px;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--text-primary);
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: none;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 17, 23, 0.97);
  backdrop-filter: blur(20px);
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu a {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* ── Hero / Stats Bar ──────────────────────────────────── */

.hero {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  border-bottom: 1px solid var(--border);
  padding: 32px var(--gap);
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-size: 28px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 500px;
  margin: 0 auto 24px;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Listings Grid ─────────────────────────────────────── */

.listings-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px var(--gap);
}

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

.section-header h2 {
  font-size: 20px;
  color: var(--text-primary);
}

.listing-count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

/* ── Car Card ──────────────────────────────────────────── */

.car-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.car-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

.car-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
  background: #000;
}

.car-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.car-card:hover .car-card-image img {
  transform: scale(1.05);
}

.car-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.car-card-content {
  padding: 16px;
}

.car-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.car-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.car-card-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--price-text);
  margin-bottom: 14px;
}

.car-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spec-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.spec-tag .icon {
  font-size: 14px;
}

/* ── Detail Modal ──────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--accent);
}

.modal-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #000;
}

.modal-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-body {
  padding: 24px;
}

.modal-title {
  font-size: 24px;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-price {
  font-size: 30px;
  font-weight: 800;
  color: var(--price-text);
  margin-bottom: 24px;
}

.modal-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.modal-spec {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.modal-spec-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.modal-spec-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Seller Card */
.seller-card {
  background: linear-gradient(135deg, rgba(232, 101, 26, 0.1), rgba(232, 101, 26, 0.05));
  border: 1px solid rgba(232, 101, 26, 0.2);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.seller-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.seller-info {
  flex: 1;
}

.seller-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 2px;
}

.seller-label {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-call {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-call:hover {
  background: var(--accent-hover);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* ── Footer ────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 32px var(--gap);
  margin-top: 48px;
  text-align: center;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer p {
  color: var(--text-muted);
  font-size: 13px;
}

.footer a {
  color: var(--accent);
}

/* ── Responsive ────────────────────────────────────────── */

@media (min-width: 640px) {
  .listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: 34px;
  }
}

@media (min-width: 960px) {
  .nav-links {
    display: flex;
  }

  .hamburger {
    display: none;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero {
    padding: 48px var(--gap);
  }

  .listings-section {
    padding: 32px var(--gap);
  }

  .modal-specs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Placeholder Image Styling ─────────────────────────── */

.placeholder-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.placeholder-img::after {
  content: attr(data-label);
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.placeholder-1 {
  background: linear-gradient(135deg, #1a1a1a 0%, #333 40%, #1a1a1a 100%);
}

.placeholder-2 {
  background: linear-gradient(135deg, #c0392b 0%, #2980b9 25%, #27ae60 50%, #f39c12 75%, #c0392b 100%);
}

.placeholder-3 {
  background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 40%, #7f8c8d 100%);
}

.placeholder-4 {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #1a1a2e 100%);
}

/* ── Scrollbar ─────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Animations ────────────────────────────────────────── */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.car-card {
  animation: fadeInUp 0.5s ease forwards;
}

.car-card:nth-child(1) {
  animation-delay: 0.05s;
}

.car-card:nth-child(2) {
  animation-delay: 0.1s;
}

.car-card:nth-child(3) {
  animation-delay: 0.15s;
}

.car-card:nth-child(4) {
  animation-delay: 0.2s;
}

/* ── Image Slider ──────────────────────────────────────── */
.image-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  width: 100%;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
  background: #000;
}

.image-slider::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari and Opera */
}

.image-slider img {
  scroll-snap-align: start;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Slider Navigation Arrows ──────────────────────────── */
.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background var(--transition);
  font-size: 18px;
}

.slider-nav:hover {
  background: var(--accent);
}

.slider-prev {
  left: 8px;
}

.slider-next {
  right: 8px;
}

.image-slider-wrapper {
  position: relative;
  width: 100%;
  /* no fixed height — let content define it */
}

/* ── Car Card Caption (name + year under image) ─────────── */
.car-card-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.car-card-caption-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-card-caption-year {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: 10px;
}

/* ── Mobile Optimisations (Samsung S24 / iPhone 15 ≈390px) ─ */
@media (max-width: 430px) {
  .header-inner {
    height: 56px;
  }

  .hero {
    padding: 20px var(--gap);
  }

  .hero h1 {
    font-size: 20px;
  }

  .hero p {
    font-size: 13px;
  }

  .stats-bar {
    gap: 20px;
  }

  .stat-value {
    font-size: 22px;
  }

  .listings-section {
    padding: 16px var(--gap);
  }

  .listings-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .car-card-price {
    font-size: 18px;
  }

  /* Bigger touch targets for arrows on mobile */
  .slider-nav {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  /* Full-screen modal on mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-title {
    font-size: 18px;
  }

  .modal-price {
    font-size: 24px;
  }

  .modal-specs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .seller-card {
    flex-wrap: wrap;
    gap: 12px;
  }

  .btn-call {
    width: 100%;
    justify-content: center;
  }
}