/* ─── CSS Variables ─────────────────────────────────────────────── */
:root {
  --primary:    #1a1a2e;
  --accent:     #e94560;
  --gold:       #f5a623;
  --surface:    #ffffff;
  --surface2:   #f8f8fc;
  --text:       #1a1a2e;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
  --radius:     16px;
  --shadow:     0 8px 40px rgba(26,26,46,.10);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --card-h:       calc(100dvh - 120px);
}

/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--surface2);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ─── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
}
.site-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}
.site-logo span { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-header {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 50px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
}
.btn-login {
  background: transparent;
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.btn-login:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn-post {
  background: var(--accent);
  color: #fff;
}
.btn-post:hover { background: #c73752; }

/* ─── Category Tabs ────────────────────────────────────────────── */
.category-bar {
  background: var(--primary);
  padding: 0 16px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-tab {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  transition: all .2s;
  letter-spacing: .3px;
}
.cat-tab.active, .cat-tab:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── Filter Bar ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-select {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* ─── Card Swipe Container ─────────────────────────────────────── */
.swipe-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: var(--card-h);
  overflow: hidden;
  padding: 16px;
}

.card-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ─── Individual Listing Card ──────────────────────────────────── */
.listing-card {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom center;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s;
  touch-action: pan-y;
  user-select: none;
}
.listing-card.active    { z-index: 3; transform: translateY(0) scale(1); }
.listing-card.next      { z-index: 2; transform: translateY(16px) scale(0.97); opacity: .85; }
.listing-card.after     { z-index: 1; transform: translateY(28px) scale(0.94); opacity: .6; }
.listing-card.dismissed { z-index: 4; animation: swipe-up .35s forwards; }
.listing-card.drag      { transition: none !important; z-index: 4; }

@keyframes swipe-up {
  to { transform: translateY(-110%) rotate(-4deg); opacity: 0; }
}

/* Card image */
.card-image {
  flex: 0 0 52%;
  position: relative;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s;
}
.listing-card:hover .card-image img { transform: scale(1.03); }

.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 50px;
  backdrop-filter: blur(8px);
}
.badge-sale { background: var(--accent); color: #fff; }
.badge-rent { background: var(--gold); color: var(--primary); }

.card-save {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 16px;
  transition: transform .2s;
}
.card-save:hover { transform: scale(1.15); }
.card-save.saved { color: var(--accent); }

.price-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(26,26,46,.9) 0%, transparent 100%);
  padding: 24px 16px 14px;
  color: #fff;
}
.price-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.price-meta { font-size: 12px; opacity: .8; margin-top: 2px; }

/* Card body */
.card-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
}
.card-location svg { flex-shrink: 0; }
.card-specs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.spec-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 8px;
}
.card-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* Card action buttons */
.card-actions {
  display: flex;
  border-top: 1px solid var(--border);
}
.card-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all .18s;
  letter-spacing: .2px;
}
.card-action-btn:hover { background: var(--surface2); }
.card-action-btn.call  { color: #16a34a; }
.card-action-btn.wp    { color: #25D366; }
.card-action-btn.share { color: var(--accent); }
.action-sep { width: 1px; background: var(--border); }

/* ─── Swipe Hint ───────────────────────────────────────────────── */
.swipe-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ─── Card Counter ─────────────────────────────────────────────── */
.card-counter {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px;
  letter-spacing: .3px;
}

/* ─── Loading / Empty ──────────────────────────────────────────── */
.cards-loading, .cards-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-muted);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Auth Pages (Login / Register) ────────────────────────────── */
.auth-page {
  min-height: calc(100dvh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #16213e 100%);
}
.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-logo {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 6px;
}
.auth-logo span { color: var(--accent); }
.auth-tagline {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.auth-tabs {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all .2s;
}
.auth-tab.active { background: var(--primary); color: #fff; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface2);
  color: var(--text);
  transition: border-color .2s;
}
.form-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.form-input::placeholder { color: #aaa; }

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .3px;
}
.btn-primary:hover { background: #c73752; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-switch a { color: var(--accent); font-weight: 600; }

.form-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.form-success {
  background: #dcfce7;
  color: #166534;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ─── Submit Listing Page ──────────────────────────────────────── */
.submit-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px;
}
.submit-page h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin-bottom: 6px;
}
.submit-page .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}
.submit-form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface2);
  color: var(--text);
}
.form-select:focus { outline: none; border-color: var(--accent); }
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface2);
  color: var(--text);
  resize: vertical;
  min-height: 100px;
}
.form-textarea:focus { outline: none; border-color: var(--accent); }
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s;
}
.upload-area:hover { border-color: var(--accent); }
.upload-icon { font-size: 36px; margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--text-muted); }
.upload-text strong { color: var(--accent); }

/* ─── Dashboard ────────────────────────────────────────────────── */
.dashboard-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.dashboard-header h1 {
  font-family: var(--font-display);
  font-size: 24px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.listing-table-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.table-title { font-weight: 700; font-size: 15px; }
.listing-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.listing-row:hover { background: var(--surface2); }
.listing-row:last-child { border-bottom: none; }
.listing-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.listing-info { flex: 1; min-width: 0; }
.listing-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listing-detail { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.listing-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}
.status-publish { background: #dcfce7; color: #166534; }
.status-pending { background: #fef9c3; color: #713f12; }
.status-draft   { background: #f3f4f6; color: #374151; }

/* ─── Single Listing Page ──────────────────────────────────────── */
.single-listing {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}
.listing-gallery {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  height: 300px;
}
.listing-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.listing-detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.listing-price-big {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}
.listing-title-big {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0;
}
.specs-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 16px 0;
}
.spec-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}
.spec-big .val { font-size: 20px; font-weight: 700; }
.spec-big .lbl { font-size: 11px; color: var(--text-muted); }
.contact-box {
  background: linear-gradient(135deg, var(--primary) 0%, #16213e 100%);
  border-radius: 14px;
  padding: 20px;
  color: #fff;
}
.contact-title { font-size: 14px; font-weight: 600; opacity: .75; margin-bottom: 12px; }
.contact-buttons { display: flex; gap: 10px; }
.contact-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: transform .2s;
}
.contact-btn:hover { transform: translateY(-2px); }
.contact-btn.call  { background: #16a34a; color: #fff; }
.contact-btn.wp    { background: #25D366; color: #fff; }

/* ─── Toast Notification ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  z-index: 9999;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Footer ───────────────────────────────────────────────────── */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 20px;
  font-size: 12px;
  margin-top: 40px;
}
.site-footer a { color: var(--gold); }

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
  .form-row  { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  .swipe-wrapper {
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    background: var(--surface2);
  }
  .card-image { flex: 0 0 48%; }
}
