:root {
  --primary: #FF6B6B;
  --primary-dark: #EE5A5A;
  --green: #4ECDC4;
  --green-dark: #3CB8AF;
  --dark: #2C3E50;
  --gray: #95A5A6;
  --light: #ECF0F1;
  --bg: #F8F9FA;
  --card-radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== NAV ===== */
.navbar {
  background: white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.2rem;
}

.nav-brand svg { width: 28px; height: 28px; }

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

.nav-links a, .nav-links button {
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--dark);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-links a:hover, .nav-links button:hover { background: var(--light); }
.nav-links a.active { background: var(--primary); color: white; }

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: var(--green-dark); }
.btn-outline { background: white; color: var(--dark); border: 2px solid var(--light); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ===== SWIPE AREA ===== */
.swipe-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  max-width: 420px;
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

.cards-stack {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  max-height: 520px;
  margin-bottom: 20px;
}

.card {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.card:active { cursor: grabbing; }

.card-img {
  width: 100%;
  height: 60%;
  object-fit: cover;
  background: var(--light);
}

.card-body {
  padding: 16px;
  height: 40%;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-neighborhood {
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-desc {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
}

.card-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.card-price span { font-size: 0.8rem; font-weight: 400; color: var(--gray); }

.card-tags {
  display: flex;
  gap: 6px;
}

.tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--light);
  color: var(--dark);
}

.tag.coloc { background: #E8F5E9; color: #2E7D32; }
.tag.entier { background: #E3F2FD; color: #1565C0; }
.tag.meuble { background: #FFF3E0; color: #E65100; }

/* Swipe overlays */
.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
  z-index: 2;
}

.card-overlay-like {
  background: rgba(78, 205, 196, 0.3);
  border: 4px solid var(--green);
  border-radius: var(--card-radius);
}

.card-overlay-pass {
  background: rgba(255, 107, 107, 0.3);
  border: 4px solid var(--primary);
  border-radius: var(--card-radius);
}

.overlay-text {
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  transform: rotate(-20deg);
  padding: 10px 20px;
  border-radius: 10px;
}

.card-overlay-like .overlay-text { color: var(--green); border: 4px solid var(--green); }
.card-overlay-pass .overlay-text { color: var(--primary); border: 4px solid var(--primary); }

/* Flying card animation */
.card.fly-right {
  transition: transform 0.4s ease-out, opacity 0.4s;
  transform: translateX(150%) rotate(30deg) !important;
  opacity: 0;
}
.card.fly-left {
  transition: transform 0.4s ease-out, opacity 0.4s;
  transform: translateX(-150%) rotate(-30deg) !important;
  opacity: 0;
}

/* Action buttons */
.swipe-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
}

.action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.action-btn:hover { transform: scale(1.1); }
.action-btn:active { transform: scale(0.95); }

.btn-pass { background: white; color: var(--primary); }
.btn-pass:hover { background: var(--primary); color: white; }
.btn-like { background: white; color: var(--green); }
.btn-like:hover { background: var(--green); color: white; }
.btn-info { background: white; color: var(--dark); width: 44px; height: 44px; }
.btn-info:hover { background: var(--dark); color: white; }

.action-btn svg { width: 28px; height: 28px; }
.btn-info svg { width: 20px; height: 20px; }

/* ===== FILTERS ===== */
.filters-bar {
  width: 100%;
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--light);
  background: white;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.filter-chip:hover, .filter-chip.active { border-color: var(--primary); color: var(--primary); }

.filters-panel {
  width: 100%;
  background: white;
  border-radius: var(--card-radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: none;
}

.filters-panel.open { display: block; }

.filter-group { margin-bottom: 16px; }
.filter-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; }
.filter-group input, .filter-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--light);
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.filter-group input:focus, .filter-group select:focus { border-color: var(--primary); }

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

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state svg { width: 80px; height: 80px; color: var(--gray); margin-bottom: 20px; }
.empty-state h2 { font-size: 1.3rem; margin-bottom: 8px; }
.empty-state p { color: var(--gray); margin-bottom: 20px; }

/* ===== LISTING DETAIL MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
  position: sticky;
  top: 0;
  background: white;
  padding: 16px 20px;
  border-bottom: 1px solid var(--light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.modal-close {
  background: var(--light);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body { padding: 20px; }
.modal-body img { width: 100%; border-radius: 12px; margin-bottom: 16px; }
.modal-body h2 { margin-bottom: 8px; }
.modal-body .detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: #555;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--light);
}
.modal-body .detail-row svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ===== PUBLISH FORM ===== */
.page-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
}

.form-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--light);
  border-radius: 12px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 100px; }

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

.photo-upload {
  border: 2px dashed var(--light);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.photo-upload:hover { border-color: var(--primary); background: #FFF5F5; }
.photo-upload svg { width: 40px; height: 40px; color: var(--gray); }
.photo-upload p { color: var(--gray); font-size: 0.85rem; margin-top: 8px; }

.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--light);
}

/* ===== PROFILE / FAVORITES ===== */
.profile-header {
  text-align: center;
  padding: 30px 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  border-bottom: 2px solid var(--light);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.listing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.listing-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  cursor: pointer;
  transition: transform 0.2s;
}

.listing-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.listing-item img {
  width: 120px;
  height: 100px;
  object-fit: cover;
  flex-shrink: 0;
}

.listing-item-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.listing-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.listing-item-meta {
  font-size: 0.8rem;
  color: var(--gray);
  flex: 1;
}

.listing-item-price {
  font-weight: 800;
  color: var(--primary);
}

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

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.conversation-item:hover { background: var(--light); }

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--light);
}

.conversation-info { flex: 1; overflow: hidden; }
.conversation-name { font-weight: 700; font-size: 0.9rem; }
.conversation-preview { font-size: 0.8rem; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-time { font-size: 0.75rem; color: var(--gray); }
.conversation-unread {
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.message-mine {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-theirs {
  align-self: flex-start;
  background: var(--light);
  color: var(--dark);
  border-bottom-left-radius: 4px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  border-top: 1px solid var(--light);
}

.chat-input-bar input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--light);
  border-radius: 25px;
  outline: none;
  font-size: 0.9rem;
}

.chat-input-bar input:focus { border-color: var(--primary); }

.chat-input-bar button {
  background: var(--primary);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== LOGIN BANNER ===== */
.login-banner {
  background: linear-gradient(135deg, var(--primary), #FF8E53);
  color: white;
  padding: 14px 20px;
  text-align: center;
  font-size: 0.9rem;
}

.login-banner a { color: white; font-weight: 700; text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .navbar { padding: 0 12px; }
  .nav-links a, .nav-links button { padding: 6px 10px; font-size: 0.8rem; }
  .cards-stack { max-height: 450px; }
  .card-title { font-size: 1rem; }
  .action-btn { width: 52px; height: 52px; }
  .swipe-actions { gap: 12px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== LOADER ===== */
.loader {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.loader::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid var(--light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== NOTIFICATION BADGE ===== */
.badge {
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}
