/* ============================================
   MapleMarket — CSS Design System
   ============================================ */

/* — Google Fonts — */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* — CSS Variables — */
:root {
  --white: #FFFFFF;
  --page: #F7F7F8;
  --primary: #FF7A00;
  --primary-hover: #E56D00;
  --accent: #FFF1E6;
  --foreground: #1A1A1A;
  --muted: #71717A;
  --border: #E4E4E7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
  --max-width: 1280px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: linear-gradient(180deg, #f8fafc 0%, #eef1f4 100%);
  color: #111827;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* — Layout — */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  background: #ffffff;
  border-radius: 20px;
  padding: 42px;
  margin-bottom: 36px;
  box-shadow:
    0 1px 2px rgba(0,0,0,.04),
    0 10px 30px rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.04);
}

/* — Typography — */
.text-xs { font-size: 0.73rem; }
.text-sm { font-size: 0.8rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.13rem; }
.text-xl { font-size: 1.33rem; }
.text-2xl { font-size: 1.6rem; }
.text-3xl { font-size: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }

/* — Card — */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

/* — Buttons — */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 600;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--white);
  color: var(--foreground);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--muted); background: var(--page); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--foreground); }

.btn-full { width: 100%; }

/* — Form Elements — */
.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  color: var(--foreground);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--muted); }

textarea.input-field { resize: vertical; min-height: 100px; }

.select-field {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  color: var(--foreground);
  background: var(--white);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.select-field:focus { border-color: var(--primary); }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 6px;
}

.form-group { margin-bottom: 16px; }

/* — Badge — */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.73rem;
  font-weight: 600;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  border-bottom: none;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
}

.logo {
  font-size: 1.33rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.logo span { color: var(--foreground); }

.header-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  gap: 0;
}
.header-search input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.87rem;
  outline: none;
}
.header-search input:focus { border-color: var(--primary); }
.header-search button {
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
}
.header-search button:hover { background: var(--primary-hover); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-nav {
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
.header-nav-inner {
  display: flex;
  gap: 0;
}
.header-nav a {
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s;
  border-bottom: 2px solid transparent;
}
.header-nav a:hover {
  color: var(--foreground);
  border-bottom-color: var(--primary);
}

/* — User Menu — */
.user-menu {
  position: relative;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.87rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.user-avatar:hover { border-color: var(--primary); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  min-width: 180px;
  z-index: 50;
  display: none;
}
.user-dropdown.show { display: block; }
.user-dropdown a,
.user-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--foreground);
  border: none;
  background: none;
  cursor: pointer;
}
.user-dropdown a:hover,
.user-dropdown button:hover { background: var(--page); }
.user-dropdown .divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 32px 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 24px;
}
.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.footer-col a {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 0;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  text-align: center;
  font-size: 0.73rem;
  color: var(--muted);
}

/* ============================================
   HOME PAGE — CLEAN HERO
   ============================================ */
.hero-clean {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  padding: 50px 20px;
  text-align: center;
}
.hero-clean-inner {
  max-width: 650px;
  margin: 0 auto;
}
.hero-clean-title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  color: #111827;
}
.hero-highlight {
  color: #f97316;
}
.hero-clean-subtitle {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 28px;
  line-height: 1.5;
}
.hero-search-box {
  background: white;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
}
.hero-search-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 6px 0;
}
.hero-tab {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: #71717A;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s;
}
.hero-tab:hover {
  background: #f3f4f6;
}
.hero-tab.active {
  background: #f97316;
  color: white;
}
.hero-search-row {
  display: flex;
  gap: 4px;
  padding: 6px;
}
.hero-search-row input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  min-width: 0;
}
.hero-search-row input:focus {
  border-color: #f97316;
}
.hero-search-row select {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  color: #374151;
  outline: none;
  width: 160px;
  font-family: inherit;
  cursor: pointer;
  background: white;
}
.hero-search-row select:focus {
  border-color: #f97316;
}
.hero-search-btn {
  background: #f97316;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.hero-search-btn:hover {
  background: #ea580c;
}
.hero-popular-clean {
  margin-top: 16px;
  font-size: 0.8rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.hero-popular-clean span {
  margin-right: 4px;
  font-weight: 500;
  color: #6b7280;
}
.hero-popular-clean a {
  color: #6b7280;
  text-decoration: none;
  padding: 4px 12px;
  background: #f3f4f6;
  border-radius: 12px;
  transition: all 0.2s;
  font-size: 0.78rem;
}
.hero-popular-clean a:hover {
  background: #e5e7eb;
  color: #374151;
}

/* ============================================
   HOME PAGE — CATEGORY GRID
   ============================================ */
.section-categories {
  margin-top: 36px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-top: 20px;
}
.category-card {
  background: white;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #f97316;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  border-color: transparent;
}
.category-card:hover::before {
  transform: scaleX(1);
}
.category-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff7ed, #fff);
  margin-bottom: 4px;
}
.category-icon svg {
  width: 28px;
  height: 28px;
  stroke-width: 2;
  color: #f97316;
}
.category-card:hover .category-icon {
  transform: translateY(-2px);
  transition: transform 0.2s;
}
.category-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground);
}
.category-count {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ============================================
   HOME PAGE — FEATURED SECTION (CAROUSEL)
   ============================================ */
.section-featured {
  padding: 36px 0;
}
.section-featured .section-header {
  margin-bottom: 20px;
}
.featured-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
}
.featured-carousel::-webkit-scrollbar {
  height: 6px;
}
.featured-carousel::-webkit-scrollbar-track {
  background: transparent;
}
.featured-carousel::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
.featured-card {
  flex-shrink: 0;
  width: 280px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.25s ease;
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: start;
}
.featured-card:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  border-color: transparent;
}
.featured-card-img {
  width: 100%;
  height: 180px;
  position: relative;
  overflow: hidden;
  background: var(--page);
}
.featured-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.featured-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #f97316;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.featured-card-body {
  padding: 14px;
}
.featured-card-title {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.featured-card-price {
  font-size: 1.06rem;
  font-weight: 700;
  color: #f97316;
  margin-bottom: 8px;
}
.featured-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ============================================
   HOME PAGE — LATEST LISTINGS (GRID)
   ============================================ */
.section-latest {
  padding: 36px 0;
}
.section-latest .section-header {
  margin-bottom: 20px;
}
.latest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.latest-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.25s ease;
  text-decoration: none;
  cursor: pointer;
}
.latest-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  border-color: transparent;
}
.latest-card-img {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}
.latest-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.latest-card-body {
  padding: 14px;
}
.latest-card-title {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.latest-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f97316;
  margin-bottom: 6px;
}
.latest-card-meta {
  font-size: 0.73rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.latest-card-time {
  font-size: 0.7rem;
  color: #a1a1aa;
}

/* ============================================
   HOME PAGE — WHY SECTION
   ============================================ */
.section-why {
  background: #f8fafc;
  padding: 52px 0;
}
.section-why-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  color: var(--foreground);
}
.why-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.why-card {
  background: white;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  border: 1px solid #e5e7eb;
  transition: all 0.25s ease;
}
.why-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.why-icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
}
.why-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--foreground);
}
.why-card p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================
   HOME PAGE — CTA SECTION
   ============================================ */
.section-cta {
  padding: 36px 0 48px;
}
.cta-box {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  color: white;
}
.cta-box h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.cta-box p {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.cta-btn {
  display: inline-block;
  background: white;
  color: #f97316;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s;
}
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Section */
.section { margin: 40px 0; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.section-header a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}
.section-header a:hover { text-decoration: underline; }

/* ============================================
   LISTING CARDS
   ============================================ */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.listing-card {
  display: flex;
  gap: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: all .25s ease;
  text-decoration: none;
  cursor: pointer;
}
.listing-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,.14);
  border-color: transparent;
}
.listing-card-img {
  width: 140px;
  height: 110px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--page);
}
.listing-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.listing-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.listing-card-title {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing-card-price {
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.listing-card-meta {
  font-size: 0.73rem;
  color: var(--muted);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Grid layout for home page */
.listings-grid-home {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.listing-card-vertical {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  text-decoration: none;
  cursor: pointer;
}
.listing-card-vertical:hover {
  box-shadow: var(--shadow-hover);
  border-color: transparent;
  transform: translateY(-2px);
}
.listing-card-vertical .listing-card-img {
  width: 100%;
  height: 180px;
  border-radius: 0;
}
.listing-card-vertical .listing-card-body {
  padding: 14px;
}

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  margin: 24px 0;
}

/* Filter Sidebar */
.filter-sidebar {
  position: sticky;
  top: 110px;
  align-self: start;
}
.filter-section {
  margin-bottom: 20px;
}
.filter-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--foreground);
}
.filter-section .filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}
.filter-item:hover { background: var(--page); color: var(--foreground); }
.filter-item.active { background: var(--accent); color: var(--primary); font-weight: 600; }

.price-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.price-range input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  outline: none;
  width: 100%;
}
.price-range input:focus { border-color: var(--primary); }

/* Search results header */
.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.search-header h1 {
  font-size: 1.13rem;
  font-weight: 700;
}
.search-header .results-count {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 8px;
  font-weight: 400;
}
.sort-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--white);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  outline: none;
}

/* ============================================
   LISTING DETAIL
   ============================================ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  margin: 24px 0;
}

/* Gallery */
.gallery {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--page);
}
.gallery-main {
  width: 100%;
  height: 420px;
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f0f0f0;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--foreground);
}
.gallery-nav:hover { background: var(--white); }
.gallery-nav.prev { left: 12px; }
.gallery-nav.next { right: 12px; }
.gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.gallery-thumb {
  width: 64px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  opacity: 0.6;
  transition: all 0.15s;
}
.gallery-thumb.active, .gallery-thumb:hover { border-color: var(--primary); opacity: 1; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Detail info */
.detail-info { padding: 20px; }
.detail-title {
  font-size: 1.33rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.detail-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
}

.detail-section {
  padding: 20px;
  border-top: 1px solid var(--border);
}
.detail-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.detail-description {
  font-size: 0.93rem;
  color: rgba(26,26,26,0.85);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* Attributes grid */
.attrs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.attr-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--page);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.attr-key { color: var(--muted); text-transform: capitalize; }
.attr-val { font-weight: 600; }

/* Contact sidebar */
.contact-card { position: sticky; top: 110px; }
.contact-card .card { padding: 20px; }

.seller-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.seller-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}
.seller-name { font-weight: 600; font-size: 0.93rem; }
.seller-since { font-size: 0.73rem; color: var(--muted); }

.contact-buttons { display: flex; flex-direction: column; gap: 8px; }

.btn-whatsapp {
  color: #15803d !important;
  border-color: #bbf7d0 !important;
}
.btn-whatsapp:hover { background: #f0fdf4 !important; }

/* ============================================
   CREATE LISTING
   ============================================ */
.create-container { max-width: 720px; margin: 24px auto; }

/* Progress steps */
.steps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.73rem;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--muted);
  transition: all 0.2s;
}
.step-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.step-dot.done {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  transition: background 0.2s;
}
.step-line.done { background: var(--primary); }
.step-label {
  font-size: 0.87rem;
  font-weight: 600;
  margin-bottom: 24px;
}

/* Category selector */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover { border-color: var(--muted); }
.cat-btn.selected { border-color: var(--primary); background: var(--accent); }
.cat-btn .cat-icon { font-size: 1.6rem; }
.cat-btn .cat-name { font-size: 0.8rem; font-weight: 600; }

.subcat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.subcat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s;
  text-align: left;
}
.subcat-btn:hover { border-color: var(--muted); }
.subcat-btn.selected { border-color: var(--primary); background: var(--accent); }

/* Form navigation */
.form-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

/* Review items */
.review-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
}
.review-row .label { color: var(--muted); }
.review-row .value { font-weight: 600; }

/* ============================================
   AUTH PAGE
   ============================================ */
.auth-container {
  max-width: 420px;
  margin: 60px auto;
}
.auth-card {
  padding: 32px;
}
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--primary); }
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================
   MAP
   ============================================ */
.map-container {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--page);
}

/* ============================================
   MEDIA UPLOADER
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--white);
}
.upload-zone:hover { border-color: var(--primary); background: var(--accent); }
.upload-zone .upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-zone p { font-size: 0.87rem; color: var(--muted); }

.upload-previews {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.upload-preview {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  font-size: 0.73rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.2rem;
}
.modal-close:hover { color: var(--foreground); }

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
}
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb .current { color: var(--foreground); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}
.empty-state .icon { font-size: 2.4rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.06rem; font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 0.87rem; color: var(--muted); }

/* ============================================
   LOADING
   ============================================ */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  justify-content: center;
  padding: 48px;
}

/* ============================================
   TOAST / ALERTS
   ============================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 16px;
}
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .search-layout { grid-template-columns: 220px 1fr; }
  .detail-layout { grid-template-columns: 1fr 300px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .latest-grid { grid-template-columns: repeat(3, 1fr); }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header-search { display: none; }
  .search-layout { grid-template-columns: 1fr; }
  .filter-sidebar {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 150;
    background: var(--white);
    padding: 20px;
    overflow-y: auto;
    display: none;
  }
  .filter-sidebar.open { display: block; }
  .detail-layout { grid-template-columns: 1fr; }
  .gallery-main { height: 280px; }
  .contact-card { position: static; }
  .listings-grid { grid-template-columns: 1fr; }
  .listings-grid-home { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-previews { grid-template-columns: repeat(3, 1fr); }
  .attrs-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }

  /* Hero Clean — mobile */
  .hero-clean {
    padding: 32px 16px;
  }
  .hero-clean-title {
    font-size: 2rem;
  }
  .hero-search-row select {
    display: none;
  }

  /* Category Grid — mobile */
  .category-grid { grid-template-columns: repeat(3, 1fr); }

  /* Latest Grid — mobile */
  .latest-grid { grid-template-columns: repeat(2, 1fr); }

  /* Why Grid — mobile */
  .why-grid { grid-template-columns: repeat(2, 1fr); }

  /* CTA — mobile */
  .cta-box {
    padding: 32px 20px;
  }

  .mobile-filter-btn {
    display: flex !important;
  }

  /* Hero search — nearme button smaller on mobile */
  .hero-nearme-btn {
    padding: 0 10px;
    font-size: 1rem;
  }

  /* Hero search button smaller */
  .hero-search-btn {
    padding: 12px 16px;
    font-size: 0.82rem;
  }

  /* Hero tabs scrollable */
  .hero-search-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .listings-grid-home { grid-template-columns: 1fr; }
  .listing-card { flex-direction: column; }
  .listing-card-img { width: 100%; height: 160px; }
  .upload-previews { grid-template-columns: repeat(2, 1fr); }

  /* Latest — single column */
  .latest-grid { grid-template-columns: 1fr; }

  /* Why — single column */
  .why-grid { grid-template-columns: 1fr; }

  /* Hero — smaller */
  .hero-clean-title {
    font-size: 1.7rem;
  }
  .hero-clean-subtitle {
    font-size: 0.88rem;
  }

  /* Nearme button hidden on very small screens */
  .hero-nearme-btn { display: none; }
  .hero-search-btn { flex: 1; }
}

/* Mobile filter toggle - hidden by default */
.mobile-filter-btn { display: none; }

/* ============================================
   LEGAL PAGES
   ============================================ */
.legal-page {
  max-width: 820px;
  margin: 40px auto;
  padding: 0 16px;
}
.legal-header {
  border-bottom: 2px solid #f97316;
  padding-bottom: 20px;
  margin-bottom: 32px;
}
.legal-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}
.legal-date {
  font-size: 0.85rem;
  color: #6b7280;
}
.legal-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}
.legal-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  margin: 20px 0 8px;
}
.legal-content p {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.7;
  margin-bottom: 12px;
}
.legal-content ul {
  padding-left: 20px;
  margin-bottom: 12px;
}
.legal-content ul li {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.7;
  margin-bottom: 6px;
}

/* ============================================
   UTILITY
   ============================================ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
