/* ============================================================
   NordAds – Blocket-inspirert design
   ============================================================ */

:root {
  --primary:     #1a6ebc;
  --primary-dark:#155a9e;
  --accent:      #e8a020;
  --bg:          #f4f4f2;
  --surface:     #ffffff;
  --border:      #ddd;
  --text:        #1a1a1a;
  --muted:       #777;
  --map-fill:    #c8dff0;
  --map-hover:   #1a6ebc;
  --danger:      #c0392b;
  --success:     #27ae60;
  --radius:      6px;
  --shadow:      0 1px 4px rgba(0,0,0,.1);
  --header-h:    56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.narrow    { max-width: 560px; }
.section   { padding: 36px 0; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  height: var(--header-h);
}
.logo {
  font-size: 1.5rem; font-weight: 800;
  color: #fff; letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.main-nav {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.main-nav a { color: rgba(255,255,255,.9); font-size: .9rem; }
.main-nav a:hover { color: #fff; text-decoration: none; }

.hamburger {
  display: none;
  background: none; border: none; color: #fff;
  font-size: 1.5rem; cursor: pointer; margin-left: auto;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--primary-dark);
  padding: 8px 16px 16px;
}
.mobile-nav a {
  color: rgba(255,255,255,.9); padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-size: 1rem;
}
.mobile-nav.open { display: flex; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #d08e10; border-color: #d08e10; text-decoration: none; }
.btn-ghost    { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }
.btn-ghost:hover { background: rgba(255,255,255,.25); text-decoration: none; }
.btn-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #a93226; text-decoration: none; }
.btn-block { display: flex; width: 100%; }
.btn-lg    { padding: 12px 28px; font-size: 1rem; }
.btn-sm    { padding: 4px 10px; font-size: .8rem; }
.btn-fav   { background: var(--surface); color: var(--muted); border-color: var(--border); }
.btn-fav.active { color: #e74c3c; border-color: #e74c3c; }
.mt { margin-top: 12px; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
  color: #fff; padding: 48px 0;
  text-align: center;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); margin-bottom: 8px; }
.hero-sub { opacity: .85; margin-bottom: 24px; font-size: 1.05rem; }
.hero-search {
  display: flex; max-width: 560px; margin: 0 auto;
  background: #fff; border-radius: 40px;
  overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.hero-search input {
  flex: 1; border: none; padding: 14px 20px;
  font-size: 1rem; outline: none; color: var(--text);
}
.hero-search button {
  background: var(--accent); color: #fff; border: none;
  padding: 14px 24px; font-size: 1rem; font-weight: 700;
  cursor: pointer; border-radius: 0 40px 40px 0;
}
.hero-search button:hover { background: #d08e10; }

/* ============================================================
   COUNTRY / MAP SECTION
   ============================================================ */
.country-section { background: var(--surface); }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.see-all { font-size: .9rem; }

.country-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px;
}
.country-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px;
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; font-size: .9rem; font-weight: 600;
  transition: all .15s;
}
.country-tab:hover, .country-tab.active {
  border-color: var(--primary); background: var(--primary); color: #fff;
}
.flag { font-size: 1.2rem; }

.map-panel { display: none; }
.map-panel.active { display: block; }

.map-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px; align-items: start;
}

.map-wrap {
  background: var(--bg); border-radius: var(--radius);
  padding: 8px; border: 1px solid var(--border);
}
.map-wrap svg { width: 100%; height: auto; display: block; }

/* SVG region interactivity */
.country-map .region { fill: var(--map-fill); stroke: #fff; stroke-width: 1.5; cursor: pointer; transition: fill .15s; }
.country-map .region:hover { fill: var(--map-hover); }
.country-map .region.selected { fill: var(--primary-dark); }

.map-placeholder {
  height: 300px; display: flex; align-items: center;
  justify-content: center; color: var(--muted);
}

.region-list h3 { font-size: 1rem; margin-bottom: 12px; color: var(--muted); font-weight: 600; }
.region-list ul { list-style: none; columns: 2; column-gap: 16px; }
.region-list li a {
  display: block; padding: 5px 0;
  font-size: .9rem; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.region-list li a:hover { color: var(--primary); text-decoration: none; padding-left: 4px; }

/* ============================================================
   CATEGORY GRID
   ============================================================ */
.category-section { background: var(--bg); }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.category-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; color: var(--text);
  transition: box-shadow .15s, transform .15s;
}
.category-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.cat-icon { font-size: 2rem; }
.cat-name { font-size: .85rem; font-weight: 600; }

/* ============================================================
   LISTING GRID / CARDS
   ============================================================ */
.recent-section { background: var(--surface); }

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.listing-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  color: var(--text); display: flex; flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.listing-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); text-decoration: none; }

.listing-thumb { aspect-ratio: 4/3; overflow: hidden; background: var(--bg); }
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--muted); }

.listing-info { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.listing-title { font-weight: 600; font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.listing-price { font-weight: 700; font-size: 1rem; color: var(--text); margin-top: auto; }
.listing-price.free { color: var(--success); }
.listing-price.muted { color: var(--muted); font-weight: 400; }

/* ============================================================
   BROWSE PAGE
   ============================================================ */
.browse-wrap {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 24px; padding-top: 24px; padding-bottom: 40px;
  align-items: start;
}

.filter-sidebar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: sticky; top: calc(var(--header-h) + 12px);
}
.filter-group { margin-bottom: 16px; }
.filter-group label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filter-group input, .filter-group select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .9rem; background: var(--bg);
}
.filter-group input:focus, .filter-group select:focus { outline: none; border-color: var(--primary); }
.price-range { display: flex; align-items: center; gap: 8px; }
.price-range input { flex: 1; }

.results-header { margin-bottom: 16px; }
.result-count { font-size: .9rem; color: var(--muted); }

.pagination { display: flex; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .85rem; color: var(--text);
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state p { margin-bottom: 16px; }

/* ============================================================
   LISTING DETAIL
   ============================================================ */
.listing-detail { padding: 24px 0 48px; }

/* Layout grid: main column + sticky sidebar */
.detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.detail-col-main { min-width: 0; }

/* Gallery */
.detail-gallery {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 12px;
	box-shadow: var(--shadow); margin-bottom: 16px;
}
.gallery-main { border-radius: 4px; overflow: hidden; }
.gallery-stage {
	background: var(--bg); border-radius: 4px; overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	min-height: 300px; max-height: 460px;
}
.gallery-stage img { max-height: 460px; width: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumb {
	width: 80px; height: 60px; object-fit: cover; border-radius: 4px;
	cursor: pointer; border: 2px solid transparent; opacity: .7;
	transition: opacity .15s, border-color .15s;
}
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.active { border-color: var(--primary); opacity: 1; }
.no-image {
	height: 200px; background: var(--bg); border-radius: var(--radius);
	display: flex; align-items: center; justify-content: center; color: var(--muted);
}

/* Breadcrumb */
.detail-breadcrumb {
	font-size: .82rem; color: var(--muted); margin-bottom: 14px;
	display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.detail-breadcrumb a { color: var(--muted); }
.detail-breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.bc-sep { color: var(--border); }

/* Header card: title + price + fav */
.detail-header-card {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 20px 20px 16px;
	box-shadow: var(--shadow); margin-bottom: 12px;
}
.listing-h1 { font-size: 1.6rem; margin-bottom: 10px; }
.listing-price-big { font-size: 1.6rem; font-weight: 800; color: var(--text); display: flex; align-items: baseline; gap: 10px; }
.listing-price-big .free { color: var(--success); }
.listing-price-big .badge { font-size: .75rem; background: var(--bg); border: 1px solid var(--border); padding: 2px 8px; border-radius: 20px; vertical-align: middle; font-weight: 500; }
.detail-header-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Meta chips */
.listing-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tag { background: var(--bg); border: 1px solid var(--border); padding: 4px 10px; border-radius: 20px; font-size: .8rem; }
.tag.muted { color: var(--muted); }
.tag-location { background: #eaf3fb; border-color: #aacde8; color: #1a5276; }
.tag-condition { background: #fef9ec; border-color: #f0d080; color: #7a5800; }
.tag-meta { color: var(--muted); background: var(--bg); }

/* Shared card style for content blocks */
.detail-card {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 20px;
	box-shadow: var(--shadow); margin-bottom: 14px;
}
.detail-card-title {
	font-size: .75rem; font-weight: 700; text-transform: uppercase;
	letter-spacing: .06em; color: var(--muted);
	margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

/* Description */
.listing-description { line-height: 1.8; color: #333; }

/* Attributes table */
.attr-list { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.attr-row { display: contents; }
.attr-list dt {
	color: var(--muted); font-size: .82rem;
	padding: 7px 12px 7px 0; border-bottom: 1px solid var(--border);
}
.attr-list dd {
	font-weight: 600; font-size: .88rem; margin: 0;
	padding: 7px 0; border-bottom: 1px solid var(--border);
}
.attr-row:last-child dt,
.attr-row:last-child dd { border-bottom: none; }

/* Seller card */
.seller-card {
	background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
	position: sticky; top: calc(var(--header-h) + 12px);
}
.seller-card h3 {
	font-size: .75rem; font-weight: 700; text-transform: uppercase;
	letter-spacing: .06em; color: var(--muted);
	margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.seller-avatar {
	width: 44px; height: 44px; border-radius: 50%;
	background: var(--primary); color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.1rem; font-weight: 700; margin-bottom: 10px;
}
.seller-name { font-weight: 700; font-size: 1.05rem; }
.seller-since { font-size: .8rem; color: var(--muted); margin-bottom: 16px; }

.msg-form textarea {
	width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
	padding: 10px; font-size: .9rem; resize: vertical;
	font-family: inherit; margin-bottom: 10px;
}
.msg-form textarea:focus { outline: none; border-color: var(--primary); }

/* Related listings */
.related-section { margin-top: 40px; padding-top: 28px; border-top: 2px solid var(--border); }
.related-section .section-title { font-size: 1.15rem; }

/* ============================================================
   FORMS
   ============================================================ */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; margin-top: 20px;
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .95rem; font-family: inherit;
  background: var(--bg);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.flex-wrap { display: flex; flex-wrap: wrap; gap: 16px; }
.form-row.flex-wrap .form-group { flex: 1 1 200px; }
.section-label { font-size: 1rem; font-weight: 700; margin: 0 0 16px; }
.form-row .form-group:nth-child(3) { grid-column: span 1; }

.file-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  color: var(--muted); transition: border-color .15s;
  position: relative;
}
.file-drop:hover, .file-drop.drag { border-color: var(--primary); color: var(--primary); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.img-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.img-preview img { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; }

.page-title { font-size: 1.6rem; margin: 24px 0 4px; }

/* ============================================================
   AUTH
   ============================================================ */
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; margin: 40px auto;
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 24px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: .9rem; color: var(--muted); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-error   { background: #fdf0ef; border: 1px solid #e74c3c; color: #922b21; }
.alert-success { background: #eafaf1; border: 1px solid #27ae60; color: #1e8449; }
.alert-info    { background: #eaf3fb; border: 1px solid #2980b9; color: #1a5276; }
.alert p { margin-bottom: 4px; }
.alert p:last-child { margin-bottom: 0; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 0 20px; }
.dashboard-header h1 { font-size: 1.6rem; }

.dashboard-table-wrap { overflow-x: auto; }
.dashboard-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dashboard-table th {
  text-align: left; padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.dashboard-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dashboard-table tr:hover td { background: var(--bg); }
.dashboard-table tr.status-sold td { opacity: .6; }

.dash-listing-title { display: flex; align-items: center; gap: 10px; }
.dash-thumb { width: 50px; height: 38px; object-fit: cover; border-radius: 4px; }
.dash-actions { display: flex; gap: 6px; white-space: nowrap; }

.status-badge { padding: 3px 8px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.status-active  { background: #eafaf1; color: #1e8449; }
.status-sold    { background: #eaf3fb; color: #1a5276; }
.status-deleted { background: #fdf0ef; color: #922b21; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: #222; color: rgba(255,255,255,.6); padding: 20px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: rgba(255,255,255,.6); font-size: .85rem; }
.site-footer a:hover { color: #fff; text-decoration: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-wrap { max-width: 320px; margin: 0 auto; }
  .region-list ul { columns: 1; }
  .detail-layout { grid-template-columns: 1fr; }
  .seller-card { position: static; }
  .browse-wrap { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main-nav { display: none; }
  .hamburger { display: block; }
  .listing-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 32px 0; }
  .dashboard-table { font-size: .8rem; }
  .dashboard-table th:nth-child(4),
  .dashboard-table td:nth-child(4),
  .dashboard-table th:nth-child(6),
  .dashboard-table td:nth-child(6) { display: none; }
}

@media (max-width: 400px) {
  .listing-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}
