/* Persian Marketplace - Shared UI */
:root {
  --bg: #0b1220;
  --bg-2: #111827;
  --card: #1a2332;
  --border: #2a3548;
  --text: #e8eef7;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-2: #6366f1;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.25);
  --font: Vazirmatn, Tahoma, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: #60a5fa; text-decoration: none; transition: color .15s; }
a:hover { color: #93c5fd; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* Layout */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(17,24,39,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo {
  font-weight: 800; font-size: 1.15rem; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.logo span { color: var(--primary); }
.nav-desktop { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-desktop a {
  color: var(--muted); padding: 8px 12px; border-radius: 10px;
  font-size: .9rem; font-weight: 500;
}
.nav-desktop a:hover, .nav-desktop a.active {
  color: var(--text); background: rgba(59,130,246,.12);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; border: none;
  font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.35);
}
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #475569; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 10px; }
.btn-block { width: 100%; }

.site-main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; min-height: 60vh; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 40px 16px 24px;
}
.footer-inner {
  max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px;
}
.footer-brand h3 { font-size: 1.1rem; margin-bottom: 10px; }
.footer-brand p { color: var(--muted); font-size: .9rem; }
.footer-col h4 { font-size: .95rem; margin-bottom: 12px; color: var(--text); }
.footer-col a { display: block; color: var(--muted); font-size: .88rem; padding: 4px 0; }
.footer-bottom {
  max-width: 1120px; margin: 28px auto 0;
  padding-top: 16px; border-top: 1px solid var(--border);
  text-align: center; color: var(--muted); font-size: .82rem;
}

/* Cards & forms */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-hover:hover { border-color: #3b82f6; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .88rem; color: var(--muted); }
.form-control {
  width: 100%; padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
textarea.form-control { min-height: 110px; resize: vertical; }

.alert {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: .92rem;
}
.alert-success { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.25); }
.alert-error { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.alert-info { background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-primary { background: rgba(59,130,246,.2); color: #93c5fd; }
.badge-success { background: rgba(34,197,94,.2); color: #86efac; }
.badge-warning { background: rgba(245,158,11,.2); color: #fcd34d; }
.badge-danger { background: rgba(239,68,68,.2); color: #fca5a5; }

.page-title { font-size: 1.45rem; font-weight: 800; margin-bottom: 8px; }
.page-sub { color: var(--muted); margin-bottom: 24px; font-size: .95rem; }

/* Listing cards */
.listing-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s, transform .15s;
  display: flex; flex-direction: column;
}
.listing-card:hover { border-color: #3b82f6; transform: translateY(-2px); }
.listing-card .thumb {
  aspect-ratio: 16/10; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 2rem; overflow: hidden;
}
.listing-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-card .body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.listing-card .title {
  font-weight: 700; font-size: .98rem; color: var(--text);
  margin-bottom: 6px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.listing-card .meta { font-size: .82rem; color: var(--muted); margin-top: auto; }
.listing-card .price { color: #4ade80; font-weight: 700; margin-top: 8px; font-size: 1rem; }

/* Hero */
.hero {
  background: linear-gradient(145deg, #1e3a5f 0%, #0f172a 50%, #1a1040 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 28px;
  margin-bottom: 36px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(59,130,246,.25), transparent 50%);
  pointer-events: none;
}
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 900; margin-bottom: 10px; position: relative; }
.hero p { color: #cbd5e1; max-width: 520px; margin-bottom: 22px; position: relative; }
.hero-search {
  display: flex; gap: 10px; max-width: 560px; position: relative; flex-wrap: wrap;
}
.hero-search input {
  flex: 1; min-width: 200px; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--border);
  background: rgba(15,23,42,.8); color: var(--text); font-size: 1rem;
}
.hero-search button { padding: 14px 24px; border-radius: 14px; }

.section-title {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title a { font-size: .88rem; font-weight: 500; }

/* Mobile nav */
.nav-toggle {
  display: none; background: none; border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 10px; cursor: pointer;
}
.mobile-nav {
  display: none; padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block; padding: 12px 8px; color: var(--muted);
  border-bottom: 1px solid var(--border); font-size: .95rem;
}
.mobile-nav a:last-child { border-bottom: none; }

@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .nav-desktop { display: none; }
  .nav-toggle { display: inline-flex; }
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 28px 18px; }
  .site-main { padding: 20px 14px 48px; }
}

/* Empty state */
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: var(--card); border-radius: var(--radius); border: 1px dashed var(--border);
}
.empty p { margin-bottom: 16px; }

/* Chat bubbles already in messages - keep compatibility */
.ltr { direction: ltr; text-align: left; }
