@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;1,9..144,400&family=Heebo:wght@300;400;500;700&family=Satoshi:wght@400;500;700&display=swap');

:root {
  --bg: #F7F3EE;
  --bg-card: #FFFFFF;
  --bg-warm: #F0EAE0;
  --primary: #B85C38;
  --primary-hover: #9C4D30;
  --primary-light: rgba(184,92,56,0.08);
  --secondary: #2C3639;
  --accent: #D4A574;
  --accent-light: rgba(212,165,116,0.15);
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted: #9E9E9E;
  --border: #E8E0D6;
  --border-light: #F0EAE0;
  --success: #4CAF50;
  --warning: #F5A623;
  --danger: #E74C3C;
  --shadow: 0 2px 12px rgba(44,54,57,0.06);
  --shadow-lg: 0 8px 32px rgba(44,54,57,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-heading: 'Fraunces', 'Heebo', serif;
  --font-body: 'Satoshi', 'Heebo', sans-serif;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

[dir="rtl"] { font-family: 'Heebo', var(--font-body), sans-serif; }

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

/* ========== NAVBAR ========== */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.nav-brand-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.nav-brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
}

.nav-link:hover { background: var(--primary-light); color: var(--primary); }
.nav-link.active { background: var(--primary-light); color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); color: white; transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-warm);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.lang-toggle {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ========== HERO ========== */
.hero {
  padding: 48px 24px 32px;
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
}

/* ========== SEARCH/FILTER BAR ========== */
.filter-bar {
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 0 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  min-width: 140px;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

[dir="rtl"] .search-input,
[dir="rtl"] .filter-select { font-family: 'Heebo', var(--font-body), sans-serif; }

/* ========== LISTINGS GRID ========== */
.listings-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.listing-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.listing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.listing-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--bg-warm);
  display: block;
}

.listing-card-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--bg-warm) 0%, var(--border-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.listing-card-body {
  padding: 14px 16px;
}

.listing-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-card-price {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

.listing-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.listing-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

[dir="rtl"] .listing-card-badge { right: auto; left: 12px; }

.listing-card-badge.free { background: var(--success); color: white; }
.listing-card-badge.swap { background: var(--accent); color: white; }

.listing-fav-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
}
[dir="rtl"] .listing-fav-btn { left: auto; right: 12px; }
[dir="rtl"] .listing-card-badge { left: 12px; right: auto; }
.listing-fav-btn:hover { transform: scale(1.1); }
.listing-fav-btn.active { color: var(--danger); }

/* ========== LISTING DETAIL ========== */
.listing-detail {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.listing-images {
  border-radius: var(--radius);
  overflow: hidden;
}

.listing-main-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-warm);
}

.listing-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
}

.listing-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}
.listing-thumb.active, .listing-thumb:hover { border-color: var(--primary); }

.listing-info { padding-top: 8px; }

.listing-info h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 8px;
}

.listing-price-tag {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}

.listing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--accent-light);
  color: var(--primary);
  font-weight: 500;
}

.listing-desc {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.7;
}

.listing-seller-card {
  background: var(--bg-warm);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.seller-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.2rem;
  overflow: hidden;
}
.seller-avatar img { width: 100%; height: 100%; object-fit: cover; }

.listing-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ========== FORMS ========== */
.form-page {
  max-width: 480px;
  margin: 48px auto;
  padding: 0 24px;
}

.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}

.form-card h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: var(--secondary);
  text-align: center;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-card);
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

[dir="rtl"] .form-control { font-family: 'Heebo', var(--font-body), sans-serif; }

textarea.form-control { min-height: 100px; resize: vertical; }

select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  background: rgba(231,76,60,0.1);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.form-error.show { display: block; }

.form-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.form-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  transition: var(--transition);
}
.form-tab.active { background: var(--bg-card); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* ========== CREATE LISTING PAGE ========== */
.create-page {
  max-width: 720px;
  margin: 32px auto;
  padding: 0 24px;
}

.create-page h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 24px;
  color: var(--secondary);
}

.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 20px;
}
.photo-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.photo-upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }

.photo-upload-icon { font-size: 2.5rem; margin-bottom: 8px; }

.photo-previews {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  position: relative;
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-tag-banner {
  background: linear-gradient(135deg, var(--accent-light), rgba(184,92,56,0.08));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-tag-banner .icon { font-size: 1.5rem; }

.ai-suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.ai-suggestion-item {
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid var(--border-light);
}

.ai-suggestion-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* ========== PROFILE ========== */
.profile-header {
  max-width: 800px;
  margin: 32px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  overflow: hidden;
  flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--secondary);
}

.profile-stats {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}

.profile-stat {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.profile-stat strong {
  color: var(--text);
  font-size: 1.1rem;
  display: block;
}

.profile-listings {
  max-width: 800px;
  margin: 24px auto;
  padding: 0 24px;
}

/* ========== ADMIN DASHBOARD ========== */
.admin-page {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
}

.admin-page h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-light);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
}

.stat-card-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.admin-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
}

.admin-section h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--secondary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: start;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 10px 12px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-light);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-personal { background: #E3F2FD; color: #1565C0; }
.badge-shop { background: #FFF3E0; color: #E65100; }
.badge-pending { background: #FFF9C4; color: #F57F17; }
.badge-resolved { background: #E8F5E9; color: #2E7D32; }
.badge-dismissed { background: #ECEFF1; color: #546E7A; }

/* ========== MY LISTINGS ========== */
.my-listings-page {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 24px;
}

.my-listings-page h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 8px;
}

.listing-limit-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.limit-progress {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  flex: 1;
  margin: 0 16px;
  max-width: 200px;
}

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

.my-listing-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  display: flex;
  gap: 16px;
  align-items: center;
  transition: var(--transition);
}
.my-listing-item:hover { box-shadow: var(--shadow); }

.my-listing-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-warm);
  flex-shrink: 0;
}

.my-listing-info { flex: 1; }
.my-listing-title { font-weight: 600; margin-bottom: 4px; }
.my-listing-meta { font-size: 0.8rem; color: var(--text-muted); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-inline-end: 4px;
}
.status-dot.active { background: var(--success); }
.status-dot.sold { background: var(--text-muted); }
.status-dot.flagged { background: var(--danger); }
.status-dot.archived { background: var(--warning); }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ========== GATED BANNER ========== */
.gated-banner {
  background: linear-gradient(135deg, var(--secondary), #1a2326);
  color: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gated-banner p { font-size: 0.9rem; opacity: 0.9; }
.gated-banner .btn { margin-inline-start: 12px; }

/* ========== FOOTER ========== */
.footer {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-light);
  margin-top: 48px;
}

/* ========== LOADING ========== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247,243,238,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .nav-brand-sub { display: none; }
  .hero h1 { font-size: 2rem; }
  .listing-detail { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .search-input { width: 100%; }
  .listings-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 0 16px; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; }
  .listing-limit-bar { flex-direction: column; gap: 8px; text-align: center; }
  .limit-progress { max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 8px 6px; }

  /* Map responsive */
  .map-page { padding: 16px; }
  .map-controls { flex-direction: column; align-items: stretch; }
  .map-header h1 { font-size: 1.5rem; }
  #map-container { height: 350px !important; }

  /* Chat responsive */
  .chat-page { height: calc(100vh - 64px); }
  .chat-header { padding: 12px 16px; }
  .chat-messages { padding: 12px 16px; }
  .chat-input-bar { padding: 12px 16px; }
  .chat-bubble { max-width: 85%; }

  /* Billing responsive */
  .billing-page { padding: 0 16px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .earnings-grid { grid-template-columns: 1fr; gap: 16px; }
  .earnings-value { font-size: 1.8rem; }

  /* Conversations responsive */
  .conversation-thumb { width: 48px; height: 48px; }
  .conversation-avatar { width: 40px; height: 40px; font-size: 1rem; }

  /* Nav links wrapping */
  .nav-links { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .nav-link { padding: 6px 10px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .listings-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .listing-card-body { padding: 10px 12px; }
  .listing-card-title { font-size: 0.85rem; }
  .form-card { padding: 24px 20px; }
  .pricing-card { padding: 20px 16px; }
  .pricing-price { font-size: 1.6rem; }
  .conversation-item { padding: 12px; gap: 10px; }
}

/* ========== MAP PAGE ========== */
.map-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.map-header {
  margin-bottom: 20px;
}

.map-header h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 4px;
}

.map-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.map-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.radius-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radius-control label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

#map-container {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ========== MESSAGING ========== */
.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.conversation-item:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
}
.conversation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.conversation-listing {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 2px;
}

.conversation-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  position: relative;
  top: -1px;
  margin-inline-start: 4px;
}

.msg-nav-link {
  position: relative;
}

.unread-dot {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 8px;
}

/* ========== CHAT ========== */
.chat-page {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.chat-bubble {
  max-width: 75%;
  display: flex;
  flex-direction: column;
}

.chat-bubble.mine {
  align-self: flex-end;
}

.chat-bubble.theirs {
  align-self: flex-start;
}

.chat-bubble-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.mine .chat-bubble-content {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
[dir="rtl"] .chat-bubble.mine .chat-bubble-content {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-bubble.theirs .chat-bubble-content {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}
[dir="rtl"] .chat-bubble.theirs .chat-bubble-content {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}

.chat-bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-bubble.mine .chat-bubble-time {
  text-align: right;
}
[dir="rtl"] .chat-bubble.mine .chat-bubble-time {
  text-align: left;
}

.chat-bubble.theirs .chat-bubble-time {
  text-align: left;
}
[dir="rtl"] .chat-bubble.theirs .chat-bubble-time {
  text-align: right;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.chat-input-bar .form-control {
  flex: 1;
}

/* ========== BILLING ========== */
.billing-page {
  max-width: 1000px;
  margin: 32px auto;
  padding: 0 24px;
}

.billing-page h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--secondary);
  margin-bottom: 24px;
}

.earnings-card {
  background: linear-gradient(135deg, var(--secondary) 0%, #1a2326 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: white;
  margin-bottom: 32px;
}

.earnings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.earnings-item {
  text-align: center;
}

.earnings-label {
  font-size: 0.8rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.earnings-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.pricing-card {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.pricing-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.pricing-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.pricing-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 12px;
}

.pricing-price {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  line-height: 1;
}

.pricing-period {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  flex: 1;
}

.pricing-features li {
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.pricing-features li:last-child {
  border-bottom: none;
}

/* ========== ESCROW ========== */
.escrow-status-card {
  background: var(--bg-warm);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.escrow-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.badge-pending { background: #FFF9C4; color: #F57F17; }
.badge-paid { background: #E3F2FD; color: #1565C0; }
.badge-confirmed, .badge-released { background: #E8F5E9; color: #2E7D32; }
.badge-disputed { background: #FFEBEE; color: #C62828; }

/* ========== TRANSACTIONS ========== */
.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transaction-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.transaction-item:hover {
  box-shadow: var(--shadow);
}

.transaction-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.transaction-info {
  flex: 1;
  min-width: 0;
}

.transaction-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.transaction-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.transaction-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.fade-in { animation: fadeIn 0.3s ease forwards; }

.view-container { min-height: calc(100vh - 64px); }
