/* Nattu Chantha – Kerala theme: banana-leaf greens, kasavu gold, cream, laterite red */
:root {
  --leaf-dark: #1b5e20;
  --leaf: #2e7d32;
  --leaf-mid: #4caf50;
  --leaf-light: #c5e1a5;
  --mint: #f1f8e9;
  --cream: #fffaf0;
  --kasavu: #c9a227;
  --kasavu-light: #f3e2a9;
  --laterite: #b5523b;
  --ink: #23331f;
  --muted: #6b7a64;
  --card: #ffffff;
  --shadow: 0 6px 20px rgba(27, 94, 32, 0.12);
  --radius: 16px;
  --ml: "Manjari", "Noto Sans Malayalam", sans-serif;
  --sans: "Poppins", "Noto Sans Malayalam", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #e8f5e9 0, transparent 40%),
    radial-gradient(circle at 90% 20%, #fff8e1 0, transparent 35%),
    var(--mint);
  min-height: 100vh;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Kasavu border – the gold stripe of a Kerala mundu */
.kasavu {
  height: 10px;
  background:
    linear-gradient(var(--cream), var(--cream)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--kasavu), var(--kasavu)) 0 2px / 100% 4px no-repeat,
    linear-gradient(var(--cream), var(--cream)) 0 6px / 100% 1px no-repeat,
    linear-gradient(var(--kasavu), var(--kasavu)) 0 7px / 100% 2px no-repeat,
    var(--cream);
}

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 1000; background: var(--leaf); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-logo { width: 62px; height: 62px; flex: none; border-radius: 50%; background: var(--cream); filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-ml { font-family: var(--ml); font-weight: 700; font-size: 1.9rem; color: var(--kasavu-light); }
.brand-en { font-size: 0.78rem; letter-spacing: .04em; opacity: .9; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  border: 0; border-radius: 999px; padding: 10px 16px; font: 600 0.9rem var(--sans);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--kasavu); color: #2b2205; box-shadow: 0 3px 0 #8a6d14; }
.btn-green { background: var(--leaf); color: #fff; box-shadow: 0 3px 0 var(--leaf-dark); }
.btn-ghost { background: rgba(255,255,255,.14); color: inherit; border: 1px solid rgba(255,255,255,.35); }
.btn-outline { background: #fff; color: var(--leaf); border: 1.5px solid var(--leaf); }
.btn-wa { background: #25d366; color: #fff; box-shadow: 0 3px 0 #128c4a; }

/* Hero */
.hero { padding: 36px 0 20px; }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; }
.hero-date { font-family: var(--ml); color: var(--laterite); font-weight: 700; margin: 0 0 6px; font-size: 1.05rem; }
.hero h1 { font-family: var(--ml); font-size: clamp(2rem, 4vw, 3rem); margin: 0; color: var(--leaf-dark); line-height: 1.15; }
.hero h1 span { display: block; font-family: var(--sans); font-size: 0.45em; color: var(--leaf); letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
.hero-sub { font-size: 1.02rem; max-width: 560px; color: #3d4d37; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.stat { background: var(--cream); border: 1px solid var(--kasavu-light); border-left: 5px solid var(--kasavu); border-radius: 12px; padding: 10px 16px; min-width: 130px; }
.stat b { display: block; font-size: 1.5rem; color: var(--leaf-dark); }
.stat span { font-size: .8rem; color: var(--muted); }
.hero-art { display: grid; place-items: center; }
/* Hero: real banana leaf with a black & white market photo laid on it (turns colour on hover) */
.hero-photo { position: relative; width: min(400px, 88vw); aspect-ratio: 1.25; }
.leaf-bg {
  position: absolute; inset: 0; transform: rotate(-7deg);
  background: url("https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Banana_Leaf_%2B_Sun_3.jpg/960px-Banana_Leaf_%2B_Sun_3.jpg") center / cover, var(--leaf);
  border-radius: 55% 45% 50% 50% / 48% 52% 48% 52%; box-shadow: var(--shadow); border: 3px solid var(--kasavu-light);
}
.bw-photo {
  position: absolute; inset: 14% 12% 12% 14%; margin: 0; background: var(--cream);
  padding: 8px 8px 34px; transform: rotate(3deg); box-shadow: 0 10px 24px rgba(0,0,0,.28);
  border-bottom: 4px solid var(--kasavu); transition: transform .3s;
}
.bw-photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.12) brightness(1.02); transition: filter .5s; }
.bw-photo:hover { transform: rotate(0deg) scale(1.03); }
.bw-photo:hover img { filter: none; }
.bw-photo figcaption { position: absolute; left: 0; right: 12px; bottom: 6px; text-align: right; font-family: var(--ml); font-weight: 700; color: var(--leaf-dark); font-size: 1.05rem; }
.hero-logo {
  position: absolute; z-index: 2; left: -9%; bottom: -12%; width: 46%; aspect-ratio: 1;
  border-radius: 50%; background: var(--cream); filter: drop-shadow(0 8px 16px rgba(0,0,0,.3)); transition: transform .3s;
}
.hero-logo:hover { transform: scale(1.08) rotate(-3deg); }
.bw-photo figcaption span { font-family: var(--sans); font-weight: 500; font-size: .75rem; color: var(--muted); }

/* Notice */
.notice { background: var(--cream); border: 1px dashed var(--kasavu); color: #5b4a12; padding: 10px 14px; border-radius: 12px; margin: 6px 0 12px; font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notice button { margin-left: auto; }

/* Categories */
.cats { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 14px; scrollbar-width: thin; }
.cat {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff; border: 1.5px solid var(--leaf-light); border-radius: 14px; padding: 10px 14px; min-width: 104px;
  cursor: pointer; font-family: var(--sans); color: var(--ink); transition: all .15s;
}
.cat:hover { border-color: var(--leaf-mid); transform: translateY(-2px); }
.cat .e { font-size: 1.6rem; }
.cat .m { font-family: var(--ml); font-weight: 700; font-size: .98rem; }
.cat .n { font-size: .7rem; color: var(--muted); }
.cat .c { font-size: .68rem; background: var(--mint); border-radius: 999px; padding: 0 7px; color: var(--leaf); font-weight: 600; }
.cat.active { background: var(--leaf); border-color: var(--leaf); color: #fff; box-shadow: 0 4px 0 var(--kasavu); }
.cat.active .n { color: #dcedc8; }
.cat.active .c { background: var(--kasavu); color: #2b2205; }

/* Toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.search { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--leaf-light); border-radius: 999px; padding: 4px 16px; }
.search input { border: 0; outline: 0; font: 1rem var(--sans); padding: 8px 0; width: 100%; background: transparent; }
.toolbar-right { display: flex; gap: 10px; align-items: center; }
select { font: .9rem var(--sans); padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--leaf-light); background: #fff; color: var(--ink); }
.view-toggle { display: flex; background: #fff; border: 1.5px solid var(--leaf-light); border-radius: 999px; overflow: hidden; }
.view-toggle button { border: 0; background: transparent; padding: 9px 14px; font: 600 .85rem var(--sans); cursor: pointer; color: var(--leaf); }
.view-toggle button.active { background: var(--leaf); color: #fff; }

/* Grid & cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; padding-bottom: 40px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; cursor: pointer; transition: transform .15s, box-shadow .15s;
  border: 1px solid #e3efd9; animation: pop .35s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(27,94,32,.18); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.photo { position: relative; aspect-ratio: 4/3; background: linear-gradient(135deg, #dcedc8, #f1f8e9); overflow: hidden; }
.photo img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.photo .badge { z-index: 2; }
.detail-photo img { z-index: 1; }
.detail-photo .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 6rem; }
.detail-photo .fallback small { position: absolute; bottom: 14px; font-family: var(--ml); font-size: 1.2rem; color: var(--leaf-dark); }
.card:hover .photo img { transform: scale(1.05); }
.photo .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; }
.photo .fallback small { position: absolute; bottom: 10px; font-family: var(--ml); font-size: 1rem; color: var(--leaf-dark); }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.95); color: var(--leaf-dark); font-size: .72rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; display: flex; gap: 6px; align-items: center; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #43a047; box-shadow: 0 0 0 0 rgba(67,160,71,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(67,160,71,0); } 100% { box-shadow: 0 0 0 0 rgba(67,160,71,0); } }
.badge-dist { left: auto; right: 10px; background: var(--leaf); color: #fff; }
.badge-new { top: auto; bottom: 10px; background: var(--laterite); color: #fff; }
.low { color: var(--laterite); font-weight: 600; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-ml { font-family: var(--ml); font-weight: 700; font-size: 1.2rem; color: var(--leaf-dark); line-height: 1.2; }
.card-en { font-size: .85rem; color: var(--muted); }
.price { font-weight: 700; font-size: 1.15rem; color: var(--ink); margin-top: 4px; }
.price small { font-weight: 500; color: var(--muted); font-size: .8rem; }
.card-foot { display: flex; align-items: center; gap: 8px; border-top: 1px dashed #dfe9d6; margin-top: 8px; padding-top: 10px; font-size: .8rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--kasavu-light); color: #5b4a12; display: grid; place-items: center; font-weight: 700; flex: none; border: 2px solid var(--kasavu); }
.card-foot .who { line-height: 1.2; flex: 1; min-width: 0; }
.card-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 40px; color: var(--muted); font-family: var(--ml); font-size: 1.1rem; }

.market-map { height: 70vh; min-height: 420px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 40px; border: 3px solid var(--kasavu-light); }

/* Map markers */
.pin { background: var(--leaf); color: #fff; border: 2px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); width: 34px; height: 34px; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.pin span { transform: rotate(45deg); font-size: 16px; }
.pin.me { background: #1e88e5; }
.popup-list { margin: 6px 0 0; padding-left: 16px; font-size: .82rem; }
.popup-list a { color: var(--leaf); font-weight: 600; cursor: pointer; }

/* Dialogs */
.dlg { border: 0; padding: 0; border-radius: 20px; width: min(980px, 94vw); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.35); background: var(--cream); color: var(--ink); }
.dlg-narrow { width: min(620px, 94vw); }
.dlg::backdrop { background: rgba(20, 50, 20, .55); backdrop-filter: blur(3px); }
.dlg-close { position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 5; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; font-size: 1rem; }
.detail { display: grid; grid-template-columns: 1fr 1fr; }
.detail-photo { position: relative; min-height: 320px; background: linear-gradient(135deg, #dcedc8, #f1f8e9); }
.detail-photo img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.detail-info { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.detail-info h2 { font-family: var(--ml); margin: 0; font-size: 1.8rem; color: var(--leaf-dark); line-height: 1.2; }
.detail-info h2 small { display: block; font-family: var(--sans); font-size: .95rem; color: var(--muted); font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--mint); color: var(--leaf-dark); border: 1px solid var(--leaf-light); padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 500; }
.chip.gold { background: var(--kasavu-light); border-color: var(--kasavu); color: #5b4a12; }
.seller-card { background: #fff; border-radius: 14px; padding: 12px; display: flex; gap: 12px; align-items: center; border: 1px solid #e3efd9; border-left: 5px solid var(--kasavu); }
.seller-card .avatar { width: 48px; height: 48px; font-size: 1.2rem; }
.seller-card .s-ml { font-family: var(--ml); font-weight: 700; font-size: 1.1rem; }
.seller-card .s-meta { font-size: .8rem; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-map-wrap { grid-column: 1 / -1; padding: 0 24px 24px; }
.distance-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.distance-bar .big { font-size: 1.4rem; font-weight: 700; color: var(--leaf-dark); }
.detail-map { height: 320px; border-radius: 14px; border: 3px solid var(--kasavu-light); }
.more-from { margin-top: 14px; }
.more-from h4 { margin: 0 0 8px; font-family: var(--ml); color: var(--leaf-dark); }
.mini-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.mini { flex: none; width: 120px; background: #fff; border-radius: 12px; overflow: hidden; cursor: pointer; border: 1px solid #e3efd9; font-size: .78rem; }
.mini .photo { aspect-ratio: 1; }
.mini .photo .fallback { font-size: 2.2rem; }
.mini div.t { padding: 6px 8px; font-family: var(--ml); font-weight: 700; }

/* Sell form */
.sell-form { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.sell-form h2 { font-family: var(--ml); color: var(--leaf-dark); margin: 0; }
.sell-form h2 small { display: block; font-family: var(--sans); font-size: .9rem; color: var(--muted); font-weight: 500; }
.sell-form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: #3d4d37; flex: 1; }
.sell-form input, .sell-form textarea, .sell-form select { font: .95rem var(--sans); padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--leaf-light); background: #fff; }
.sell-form input:focus, .sell-form textarea:focus { outline: 2px solid var(--leaf-mid); }
.row2, .row3 { display: flex; gap: 10px; }
.file input { padding: 8px; }
.photo-preview { max-height: 160px; border-radius: 12px; object-fit: cover; align-self: flex-start; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-actions .btn-ghost { color: var(--leaf); border-color: var(--leaf-light); }

/* Footer & toast */
.footer { background: var(--leaf-dark); color: #dcedc8; margin-top: 20px; }
.footer-inner { padding: 18px 20px 24px; font-size: .88rem; }
.footer .muted { color: #a5c79a; font-size: .78rem; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--leaf-dark); color: #fff; padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); z-index: 3000; border: 2px solid var(--kasavu); }

@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { margin: 10px 0 30px; }
  .hero-photo { width: min(330px, 80vw); }
  .detail { grid-template-columns: 1fr; }
  .detail-photo { min-height: 240px; }
  .brand-en { display: none; }
  .row2, .row3 { flex-direction: column; }
  #locLabel { display: none; }
  .toolbar-right { width: 100%; justify-content: space-between; }
}
