/* ===================================================================
   HX Africa — properties page (grid + detail + map + buy/sell).
   =================================================================== */
:root {
  --bg: #07090c; --bg-1: #0b0e13; --bg-2: #10141b; --bg-3: #171d28;
  --line: rgba(255,255,255,0.08); --line-2: rgba(255,255,255,0.14);
  --text: #f4f6f9; --text-dim: #9aa4b2; --text-faint: #626b78;
  --gold: #f0b90b; --gold-2: #ffd75e; --up: #2ebd85; --up-bg: rgba(46,189,133,.12);
  --down: #f6465d; --down-bg: rgba(246,70,93,.12);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "Roboto Mono", ui-monospace, Menlo, monospace;
  --maxw: 1160px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.up { color: var(--up); } .down { color: var(--down); }

/* Nav */
.nav { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 22px; background: var(--bg-1); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.nav-left { display: flex; align-items: center; gap: 30px; }
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand-mark { font-weight: 800; font-size: 19px; color: #1a1400; background: linear-gradient(120deg, var(--gold), var(--gold-2)); padding: 2px 7px; border-radius: 6px; }
.brand-name { font-weight: 700; font-size: 18px; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--text-dim); font-weight: 500; transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.btn { border: none; border-radius: 8px; padding: 9px 15px; font-weight: 600; font-size: 13px; cursor: pointer; transition: all .15s; }
.btn-ghost { background: var(--bg-3); color: var(--text); }
.btn-ghost:hover { color: var(--gold); }
.btn-primary { background: linear-gradient(120deg, var(--gold), var(--gold-2)); color: #1a1400; }
.btn-primary:hover { filter: brightness(1.06); }
.acct { display: flex; align-items: center; gap: 8px; }
.acct-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(120deg, var(--gold), var(--gold-2)); color: #1a1400; display: grid; place-items: center; font-weight: 800; }
.acct-out { background: var(--bg-3); border: 1px solid var(--line-2); color: var(--text-dim); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 40px 22px 80px; }

/* Grid head */
.ph-head { margin-bottom: 30px; max-width: 720px; }
.kicker { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; }
.ph-head h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.ph-head p { color: var(--text-dim); margin-top: 12px; font-size: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.filters button { background: var(--bg-2); border: 1px solid var(--line); color: var(--text-dim); padding: 7px 14px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s; }
.filters button:hover { color: var(--text); }
.filters button.active { background: rgba(240,185,11,.12); border-color: rgba(240,185,11,.4); color: var(--gold); }

/* Grid */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pcard { background: var(--bg-1); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.pcard:hover { transform: translateY(-5px); box-shadow: 0 26px 60px rgba(0,0,0,.5); border-color: var(--line-2); }
.pcard-img { position: relative; aspect-ratio: 16/10; }
.pcard-img svg { width: 100%; height: 100%; display: block; }
.pcard-tag { position: absolute; top: 12px; left: 12px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; background: rgba(0,0,0,.45); border: 1px solid var(--line-2); padding: 4px 10px; border-radius: 20px; backdrop-filter: blur(6px); }
.pcard-chg { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 700; font-family: var(--mono); background: rgba(0,0,0,.45); padding: 4px 9px; border-radius: 20px; backdrop-filter: blur(6px); }
.pcard-body { padding: 16px; }
.pcard-name { font-size: 17px; font-weight: 700; }
.pcard-loc { color: var(--text-faint); font-size: 12px; margin: 3px 0 14px; }
.pcard-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.pcard-metrics > div { background: var(--bg-2); border-radius: 9px; padding: 8px; text-align: center; }
.pcard-metrics .k { font-size: 10px; color: var(--text-faint); display: block; }
.pcard-metrics .v { font-size: 14px; font-weight: 700; font-family: var(--mono); margin-top: 3px; display: block; }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; }
.pcard-price { font-family: var(--mono); font-weight: 800; font-size: 18px; }
.pcard-price small { color: var(--text-faint); font-size: 11px; font-weight: 500; }
.pcard-btn { font-size: 13px; font-weight: 700; color: var(--gold); }

/* Detail */
.back { display: inline-block; color: var(--text-dim); margin-bottom: 20px; font-size: 14px; }
.back:hover { color: var(--gold); }
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 26px; align-items: start; }
.detail-main { min-width: 0; }
.gallery { }
.hero { border-radius: 16px; overflow: hidden; aspect-ratio: 16/8; border: 1px solid var(--line); }
.hero svg { width: 100%; height: 100%; display: block; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.thumb { border-radius: 10px; overflow: hidden; aspect-ratio: 16/10; border: 1px solid var(--line); cursor: pointer; transition: border-color .15s; }
.thumb:hover, .thumb.active { border-color: var(--gold); }
.thumb svg { width: 100%; height: 100%; display: block; }

.d-titlebar { display: flex; align-items: center; gap: 16px; margin: 22px 0; flex-wrap: wrap; }
.d-titlebar h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.d-badge { font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--gold); border: 1px solid rgba(240,185,11,.4); padding: 3px 9px; border-radius: 20px; }
.d-loc { color: var(--text-dim); font-size: 13px; }
.d-titlebar .spacer { flex: 1; }
.d-price { text-align: right; }
.d-price .p { font-size: 24px; font-weight: 800; font-family: var(--mono); }
.d-price .c { font-size: 13px; font-family: var(--mono); font-weight: 700; }

.d-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.d-card h3 { font-size: 16px; margin-bottom: 14px; }
.d-desc { color: var(--text-dim); line-height: 1.7; font-size: 14.5px; margin-bottom: 18px; }
.d-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.d-metrics > div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.d-metrics .k { font-size: 11px; color: var(--text-faint); }
.d-metrics .v { font-size: 16px; font-weight: 700; font-family: var(--mono); margin-top: 5px; }
.d-loc-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 14px; }
.d-loc-sub b { color: var(--text); }

/* Map */
.mapwrap { position: relative; background: radial-gradient(circle at 50% 30%, #0f1620, #0a0d12); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mapwrap svg { width: 100%; height: auto; display: block; }
.map-africa { fill: rgba(255,255,255,0.04); stroke: rgba(255,255,255,0.14); stroke-width: 1.2; }
.map-grid { stroke: rgba(255,255,255,0.04); stroke-width: 0.5; }
.map-dot { fill: var(--text-faint); }
.map-pin { fill: var(--gold); }
.map-ring { fill: none; stroke: var(--gold); opacity: .7; }
.map-label { fill: var(--text); font: 700 13px var(--sans); }
.map-coord { fill: var(--text-dim); font: 11px var(--mono); }

/* Trade widget */
.trade-widget { position: sticky; top: 76px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.tw-price { display: flex; justify-content: space-between; align-items: flex-start; }
.tw-last { font-size: 30px; font-weight: 800; font-family: var(--mono); letter-spacing: -1px; }
.tw-usd { font-size: 11px; color: var(--text-faint); }
.tw-chg { font-size: 15px; font-weight: 700; font-family: var(--mono); }
.tw-spark { width: 100%; height: 60px; display: block; margin: 10px 0 16px; }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-3); border-radius: 8px; padding: 3px; margin-bottom: 14px; }
.side-tab { padding: 9px; border: none; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 14px; background: transparent; color: var(--text-dim); transition: all .15s; }
.side-tab.buy.active { background: var(--up); color: #052015; }
.side-tab.sell.active { background: var(--down); color: #2a0810; }
.type-tabs { display: flex; gap: 18px; margin-bottom: 14px; }
.type-tabs button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; font-weight: 600; padding-bottom: 5px; border-bottom: 2px solid transparent; }
.type-tabs button.active { color: var(--text); border-bottom-color: var(--gold); }
.tw-avail { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
#tw-form { display: flex; flex-direction: column; gap: 11px; }
.tw-field span { font-size: 11px; color: var(--text-dim); display: block; margin-bottom: 5px; }
.tw-field .inp { display: flex; align-items: center; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; }
.tw-field .inp:focus-within { border-color: var(--gold); }
.tw-field .inp input { background: none; border: none; color: var(--text); outline: none; padding: 10px 0; width: 100%; font-family: var(--mono); font-size: 13px; }
.tw-field .inp input::-webkit-outer-spin-button, .tw-field .inp input::-webkit-inner-spin-button { -webkit-appearance: none; }
.tw-field .inp em { color: var(--text-dim); font-style: normal; font-size: 12px; }
.tw-pct { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tw-pct button { background: var(--bg-3); border: 1px solid var(--line); color: var(--text-dim); border-radius: 6px; padding: 7px; cursor: pointer; font-size: 12px; }
.tw-pct button:hover { border-color: var(--gold); color: var(--text); }
.tw-submit { margin-top: 4px; padding: 13px; border: none; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 15px; }
.tw-submit.buy { background: var(--up); color: #052015; }
.tw-submit.sell { background: var(--down); color: #2a0810; }
.tw-submit:hover { filter: brightness(1.07); }
.tw-advanced { display: block; text-align: center; margin-top: 14px; color: var(--gold); font-size: 13px; font-weight: 600; }

.foot { border-top: 1px solid var(--line); padding: 24px 22px; text-align: center; color: var(--text-faint); font-size: 12px; }

/* Toasts */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--up); border-radius: 8px; padding: 12px 16px; min-width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: slideIn .2s; }
.toast.err { border-left-color: var(--down); }
.toast .t-title { font-weight: 700; font-size: 13px; text-transform: capitalize; }
.toast .t-body { font-size: 12px; color: var(--text-dim); margin-top: 3px; font-family: var(--mono); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: #1a2029; border-radius: 4px; }

@media (max-width: 1000px) { .pgrid { grid-template-columns: repeat(2, 1fr); } .detail { grid-template-columns: 1fr; } .trade-widget { position: static; } }
@media (max-width: 640px) { .pgrid { grid-template-columns: 1fr; } .nav-links { display: none; } .d-metrics { grid-template-columns: repeat(2, 1fr); } }