/* === TweedeKans Main Stylesheet === */

:root {
  --color-primary: #004699;
  --color-accent: #ff6321;
  --color-bg: #f5f5f5;
  --color-white: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #333333;
  --color-text-muted: #6b7280;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.10);
  --radius: 8px;
}

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

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* === Utility === */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* === Buttons === */
.btn-primary {
  background-color: var(--color-primary);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.9; }

.btn-accent {
  background-color: var(--color-accent);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.btn-accent:hover { opacity: 0.9; }

.btn-outline {
  background: white;
  color: var(--color-text);
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  font-weight: 600;
  border: 1px solid var(--color-border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
}
.btn-outline:hover { background: #f3f4f6; }

/* === Navbar === */
.site-header {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .navbar { flex-direction: row; align-items: center; }
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-icon {
  background-color: var(--color-accent);
  padding: 0.375rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon svg { width: 24px; height: 24px; fill: none; stroke: white; stroke-width: 2; }
.navbar-brand h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; color: white; }

.navbar-search {
  flex: 1;
  position: relative;
  width: 100%;
}

.navbar-search input {
  width: 100%;
  background: white;
  color: #1f2937;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border-radius: 6px;
  border: none;
  outline: none;
  font-size: 0.95rem;
}

.navbar-search input:focus { box-shadow: 0 0 0 2px var(--color-accent); }

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.search-icon svg { width: 18px; height: 18px; stroke: #9ca3af; fill: none; stroke-width: 2; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .navbar-actions { justify-content: flex-end; }
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  font-weight: 500;
}

.navbar-user a { color: rgba(255,255,255,0.85); transition: color 0.15s; }
.navbar-user a:hover { color: white; }

/* === Layout === */
.site-main {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .site-main { grid-template-columns: 240px 1fr; }
}

/* === Sidebar === */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .sidebar { display: block; }
}

.sidebar-section { margin-bottom: 2rem; }
.sidebar-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }

.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 0.1rem; }

.sidebar-nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.sidebar-nav a:hover { background: #e5e7eb; color: var(--color-text); }
.sidebar-nav a.active { background: var(--color-primary); color: white; font-weight: 600; }

/* === Content Area === */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.content-header h2 { font-size: 1.25rem; font-weight: 700; }
.content-header .count { color: var(--color-text-muted); font-size: 0.875rem; }

/* === Listings Grid === */
.listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .listings-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1280px) {
  .listings-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === Listing Card === */
.listing-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}

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

.listing-card-image {
  aspect-ratio: 4/3;
  background: #f3f4f6;
  position: relative;
  overflow: hidden;
}

.listing-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.listing-card:hover .listing-card-image img { transform: scale(1.04); }

.listing-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
}

.listing-card-placeholder svg { width: 48px; height: 48px; }

.listing-price-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.92);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.sold-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: #ef4444;
  color: white;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
}

.listing-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; }

.listing-card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  transition: color 0.15s;
}

.listing-card:hover .listing-card-title { color: var(--color-primary); }

.listing-card-desc {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex: 1;
  margin-bottom: 0.75rem;
}

.listing-card-meta {
  border-top: 1px solid #f3f4f6;
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.listing-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.meta-item { display: flex; align-items: center; gap: 0.25rem; }
.meta-item svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

/* === Empty State === */
.empty-state {
  background: white;
  border-radius: var(--radius);
  border: 2px dashed #d1d5db;
  padding: 3rem;
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state svg { width: 48px; height: 48px; stroke: #d1d5db; fill: none; stroke-width: 1.5; margin: 0 auto 1rem; }

/* === Single Listing === */
.single-listing {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .single-listing { flex-direction: row; }
}

.single-listing-image {
  width: 100%;
  background: #f3f4f6;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .single-listing-image { width: 50%; min-height: 400px; }
}

.single-listing-image img { width: 100%; height: 100%; object-fit: contain; }

.single-listing-details { padding: 1.5rem 2rem; flex: 1; display: flex; flex-direction: column; }

.listing-category-badge {
  display: inline-block;
  background: rgba(255,99,33,0.1);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.single-listing h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.single-listing-price { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); margin-bottom: 1.25rem; }

.listing-info-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.listing-info-item { display: flex; align-items: center; gap: 0.5rem; color: var(--color-text-muted); font-size: 0.9rem; }
.listing-info-item svg { width: 18px; height: 18px; stroke: #9ca3af; fill: none; stroke-width: 2; flex-shrink: 0; }

.listing-description h3 { font-weight: 700; margin-bottom: 0.5rem; }
.listing-description p { color: var(--color-text-muted); line-height: 1.7; white-space: pre-wrap; }

.seller-box {
  border-top: 1px solid var(--color-border);
  padding-top: 1.25rem;
  margin-top: auto;
  padding-top: 1.5rem;
}

.seller-info { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }

.seller-avatar {
  width: 44px; height: 44px;
  background: rgba(0,70,153,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.seller-avatar svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }
.seller-name { font-weight: 700; }
.seller-label { font-size: 0.75rem; color: var(--color-text-muted); }

/* === Contact Form === */
.contact-form { margin-top: 0.5rem; }
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: box-shadow 0.15s;
  margin-bottom: 0.75rem;
}
.contact-form textarea:focus { box-shadow: 0 0 0 2px var(--color-primary); border-color: transparent; }

.contact-form-notice {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.contact-form-notice a { color: var(--color-primary); font-weight: 600; }

/* === Modal / Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

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

.modal-header h2 { font-size: 1.125rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--color-text); }
.modal-close svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

.modal-body { padding: 1.5rem; }

/* === Form Styles === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.3rem; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  box-shadow: 0 0 0 2px var(--color-primary);
  border-color: transparent;
}

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

.form-actions { display: flex; gap: 0.75rem; padding-top: 0.75rem; }
.form-actions .btn-accent,
.form-actions .btn-outline { flex: 1; justify-content: center; padding: 0.65rem 1rem; }

/* === Flash Messages === */
.flash-message {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.flash-message.success { background: #d1fae5; color: #065f46; }
.flash-message.error { background: #fee2e2; color: #991b1b; }

#ajax-flash { display: none; }
#ajax-flash.visible { display: block; }

/* === Pagination === */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text);
  transition: background 0.15s, color 0.15s;
}

.pagination a:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.pagination .current { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* === Footer === */
.site-footer {
  background: white;
  border-top: 1px solid var(--color-border);
  padding: 2rem 1rem;
  margin-top: 3rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.35rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Responsive Nav toggle for mobile === */
.mobile-search-bar { width: 100%; }

/* === WP Login page small tweaks === */
body.login { background: var(--color-bg); }
