/* ===== VARIABLES ===== */
:root {
  --navy: #2c3e6b;
  --navy-light: #3d5291;
  --rose: #c9a0a0;
  --rose-light: #f0dede;
  --rose-dark: #a07878;
  --cream: #faf7f2;
  --white: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --border: #e8e0d8;
  --shadow: 0 2px 12px rgba(44, 62, 107, 0.08);
  --shadow-hover: 0 6px 24px rgba(44, 62, 107, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.2;
}

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

img { max-width: 100%; height: auto; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
}

/* ===== UTILITY ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ===== HEADER / NAV ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-light);
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--navy);
}

.nav-links .btn-sell {
  background: var(--navy);
  color: white !important;
  padding: 8px 20px;
  border-radius: 100px;
  font-weight: 600;
  transition: background var(--transition);
}

.nav-links .btn-sell:hover {
  background: var(--navy-light);
}

/* Mobile menu */
.menu-toggle {
  display: none;
  background: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
  transition: var(--transition);
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: white;
  text-align: center;
  padding: 60px 20px;
}

.hero h1 {
  font-size: 2.6rem;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 520px;
  margin: 0 auto 28px;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 16px 52px 16px 20px;
  border-radius: 100px;
  font-size: 1rem;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.hero-search input::placeholder { color: var(--text-muted); }

.hero-search button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--navy);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.hero-search button:hover { background: var(--navy-light); }

/* ===== FILTERS BAR ===== */
.filters-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.filters-inner {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}

.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--navy);
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.chip {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.chip.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.filter-clear {
  background: none;
  color: var(--rose-dark);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 12px;
  white-space: nowrap;
}

.filter-clear:hover { text-decoration: underline; }

/* ===== LISTINGS GRID ===== */
.listings-section {
  padding: 32px 0 60px;
  flex: 1;
}

.listings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.listings-header h2 {
  font-size: 1.5rem;
}

.results-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* ===== LISTING CARD ===== */
.listing-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.listing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  color: inherit;
}

.card-image {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--rose-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-image .placeholder-icon {
  font-size: 48px;
  color: var(--rose-dark);
  opacity: 0.4;
}

.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--navy);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}

.card-body {
  padding: 16px;
}

.card-body h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== LISTING DETAIL PAGE ===== */
.listing-detail {
  padding: 32px 0 60px;
}

.listing-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.listing-back:hover { color: var(--navy); }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.detail-gallery {
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-main-image {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--rose-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-main-image .placeholder-icon {
  font-size: 80px;
  color: var(--rose-dark);
  opacity: 0.4;
}

.detail-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.detail-thumbs .thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--rose-light);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}

.detail-thumbs .thumb.active,
.detail-thumbs .thumb:hover {
  border-color: var(--navy);
}

.detail-thumbs .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.detail-price {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
}

.detail-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.spec-item {
  background: var(--cream);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.spec-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.spec-value {
  font-weight: 600;
  font-size: 0.95rem;
}

.detail-description {
  margin-bottom: 24px;
}

.detail-description h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-description p {
  color: var(--text-light);
  line-height: 1.7;
}

.detail-seller {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.seller-name {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.seller-location {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.btn-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25d366;
  color: white !important;
  padding: 12px 28px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
  justify-content: center;
  border: none;
}

.btn-contact:hover { background: #1fb855; }

.btn-contact-alt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  color: var(--navy) !important;
  border: 2px solid var(--navy);
  padding: 10px 28px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

.btn-contact-alt:hover {
  background: var(--navy);
  color: white !important;
}

/* Related listings */
.related-section {
  margin-top: 60px;
}

.related-section h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
}

/* ===== SELLER DASHBOARD ===== */
.seller-page {
  padding: 40px 0 60px;
}

.auth-container {
  max-width: 420px;
  margin: 60px auto;
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-container h2 {
  margin-bottom: 8px;
}

.auth-container .auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
}

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

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color var(--transition);
  background: var(--white);
}

.form-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(44, 62, 107, 0.1);
}

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

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

.btn-primary {
  background: var(--navy);
  color: white;
  padding: 12px 28px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  width: 100%;
}

.btn-primary:hover { background: var(--navy-light); }

.btn-secondary {
  background: var(--cream);
  color: var(--navy);
  padding: 10px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--navy);
  color: white;
}

.btn-danger {
  background: none;
  color: #c0392b;
  border: 1px solid #c0392b;
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: #c0392b;
  color: white;
}

.auth-toggle {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--navy);
  font-weight: 600;
}

.auth-error {
  background: #fef0f0;
  color: #c0392b;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

/* Dashboard */
.dashboard {
  display: none;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-header h2 {
  font-size: 1.6rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-logout {
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: all var(--transition);
}

.btn-logout:hover {
  border-color: #c0392b;
  color: #c0392b;
}

/* Listing form */
.listing-form-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.listing-form-container h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition);
  margin-bottom: 16px;
}

.image-upload-area:hover {
  border-color: var(--navy);
}

.image-upload-area p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.image-upload-area .upload-icon {
  font-size: 36px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.image-previews {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.image-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--rose-light);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview .remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* My listings table */
.my-listings {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.my-listings h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 24px 24px 16px;
}

.my-listing-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  transition: background var(--transition);
}

.my-listing-item:hover {
  background: var(--cream);
}

.my-listing-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--rose-light);
  flex-shrink: 0;
}

.my-listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-listing-info {
  flex: 1;
}

.my-listing-info h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
}

.my-listing-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.my-listing-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--text-light);
}

.btn-icon:hover { background: var(--navy); color: white; border-color: var(--navy); }
.btn-icon.delete:hover { background: #c0392b; border-color: #c0392b; }

.no-listings {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 40px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
  gap: 32px;
}

.footer-brand .logo {
  color: white;
  margin-bottom: 8px;
}

.footer-brand p {
  font-size: 0.85rem;
  max-width: 280px;
}

.footer-links h4 {
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.footer-links ul {
  list-style: none;
}

.footer-links li { margin-bottom: 6px; }

.footer-links a {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: color var(--transition);
}

.footer-links a:hover { color: white; }

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
}

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

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

.empty-state h3 {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  margin-bottom: 8px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error { background: #c0392b; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  padding: 32px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .menu-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  }

  .nav-links.open { display: flex; }

  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 1rem; }

  .filters-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .listings-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .detail-specs {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-inner {
    flex-direction: column;
  }

  .my-listing-item {
    flex-wrap: wrap;
  }

  .my-listing-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .hero { padding: 40px 16px; }
  .hero h1 { font-size: 1.5rem; }

  .listings-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .card-body { padding: 12px; }
  .card-body h3 { font-size: 0.9rem; }
  .card-price { font-size: 1rem; }
  .card-meta { font-size: 0.75rem; }

  .listing-form-container { padding: 20px; }
  .auth-container { padding: 24px; margin: 40px auto; }
}
