/*
Theme Name: Portal Warga Theme
Description: Theme mobile-first untuk plugin Portal Warga. Hijau tua + krem, Plus Jakarta Sans, tombol besar, navigasi bawah.
Version: 0.2.0
Requires at least: 6.0
Requires PHP: 7.4
Author: Timur Adventour
License: GPLv2 or later
Text Domain: portal-warga-theme
*/

:root {
	--pw-ground: #F6F3EC;
	--pw-surface: #FFFFFF;
	--pw-ink: #1B2B24;
	--pw-muted: #5B665F;
	--pw-line: #E4DED0;
	--pw-line-soft: #EFEAE0;
	--pw-green: #1F4D3A;
	--pw-green-dark: #163828;
	--pw-green-mid: #3E6B57;
	--pw-green-tint: #E3EFE7;
	--pw-green-ok: #2E7D4F;
	--pw-on-dark: #F6F3EC;
	--pw-on-dark-muted: #CFE0D6;
	--pw-sand: #E7DFCC;
	--pw-red: #9C2119;
	--pw-red-tint: #FBEDEC;
	--pw-amber-tint: #FBF1D9;
	--pw-amber: #7A5200;
	--pw-radius: 16px;
	--pw-radius-lg: 20px;
	--pw-shadow: 0 6px 24px rgba(27, 43, 36, .08);
	--pw-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--pw-nav-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--pw-ground);
	color: var(--pw-ink);
	font-family: var(--pw-font);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
a { color: var(--pw-green); }
a:hover { color: var(--pw-green-dark); }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid #7FB89A; outline-offset: 2px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.pw-shell { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--pw-ground); position: relative; }
@media (min-width: 560px) {
	body { background: #E9E4D8; }
	.pw-shell { box-shadow: 0 0 0 1px var(--pw-line); }
}
body.pw-portal.logged-in .pw-shell { padding-bottom: calc(var(--pw-nav-h) + env(safe-area-inset-bottom) + 16px); }

.pw-page { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.pw-page--lift { margin-top: -44px; position: relative; }
.pw-page--withbar { padding-bottom: 120px; }
.pw-center { text-align: center; align-items: center; justify-content: center; min-height: 60vh; }
.pw-center .pw-card { width: 100%; }

.pw-top { padding: 24px 16px 4px; display: flex; gap: 12px; align-items: flex-start; }
.pw-top.pw-row-between { align-items: center; }

/* ---------- Type ---------- */
.pw-h1 { margin: 0; font-size: 23px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.pw-h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.pw-h3 { margin: 8px 0 0; font-size: 16px; font-weight: 700; }
.pw-muted { color: var(--pw-muted); }
.pw-small { font-size: 13px; }
.pw-xs { font-size: 12px; }
.pw-strong { font-weight: 700; }
.pw-green { color: var(--pw-green-ok); }
.pw-red { color: var(--pw-red); }
.pw-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.pw-minw0 { min-width: 0; }
.pw-pre { white-space: pre-line; margin: 0; }
.pw-mt { margin-top: 12px; }
.pw-muted.pw-small, .pw-muted.pw-xs { margin: 0; }
.pw-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--pw-muted); }
.pw-eyebrow--green { color: var(--pw-green); }
.pw-amount { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.pw-amount--xl { font-size: 30px; }
.pw-price { font-size: 20px; font-weight: 800; color: var(--pw-green); }
.pw-prose p { margin: 0 0 8px; }
.pw-prose p:last-child { margin: 0; }

/* ---------- Layout helpers ---------- */
.pw-stack { display: flex; flex-direction: column; gap: 14px; }
.pw-stack-sm { display: flex; flex-direction: column; gap: 6px; }
.pw-row { display: flex; align-items: center; gap: 10px; }
.pw-row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pw-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Hero ---------- */
.pw-hero { background: var(--pw-green); color: var(--pw-on-dark); padding: 28px 20px 64px; display: flex; flex-direction: column; gap: 8px; }
.pw-hero__hello { font-size: 13px; color: var(--pw-on-dark-muted); }
.pw-hero__name { margin: 2px 0 0; font-size: 21px; font-weight: 700; line-height: 1.25; }
.pw-hero__sub { margin: 0; font-size: 13px; color: var(--pw-on-dark-muted); }
.pw-hero__title { margin: 6px 0 0; font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.pw-hero--auth { padding-top: 48px; padding-bottom: 72px; }
.pw-hero .pw-eyebrow { color: var(--pw-on-dark-muted); }

/* ---------- Cards & lists ---------- */
.pw-card { background: var(--pw-surface); border-radius: var(--pw-radius); padding: 16px; }
.pw-page--lift > .pw-card:first-child { border-radius: var(--pw-radius-lg); box-shadow: var(--pw-shadow); padding: 18px; }
.pw-card--link { text-decoration: none; color: var(--pw-ink); }
.pw-card--link:hover { color: var(--pw-ink); box-shadow: var(--pw-shadow); }
.pw-card--green { background: var(--pw-green); color: var(--pw-on-dark); border-radius: var(--pw-radius-lg); padding: 20px; }
.pw-on-dark-muted { color: var(--pw-on-dark-muted); }

.pw-list { background: var(--pw-surface); border-radius: var(--pw-radius); overflow: hidden; }
.pw-list--flat { background: transparent; }
.pw-list__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--pw-line-soft); min-height: 52px; }
.pw-list__row:last-child { border-bottom: 0; }
.pw-list__row--top { align-items: flex-start; }
.pw-list__row--start { justify-content: flex-start; }
.pw-list__row--link { text-decoration: none; color: var(--pw-ink); }
.pw-list__row--link:hover { background: #FBFAF6; color: var(--pw-ink); }
.pw-list--flat .pw-list__row { padding: 10px 0; }

.pw-note { background: var(--pw-sand); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.5; margin: 0; }
.pw-note svg { flex-shrink: 0; color: var(--pw-green); }
.pw-empty { text-align: center; padding: 28px 16px; }
.pw-empty p { margin: 4px 0 0; }

.pw-flash { margin: 12px 16px 0; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; }
.pw-page .pw-flash, form .pw-flash { margin: 0; }
.pw-flash--ok { background: var(--pw-green-tint); color: var(--pw-green-dark); }
.pw-flash--err { background: var(--pw-red-tint); color: var(--pw-red); }

/* ---------- Status ---------- */
.pw-status { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.pw-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pw-green-ok); flex-shrink: 0; }
.pw-check { width: 40px; height: 40px; border-radius: 50%; background: var(--pw-green-tint); color: var(--pw-green); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pw-check--xl { width: 72px; height: 72px; }
.pw-w-time { min-width: 110px; }
.pw-badge { display: inline-block; font-size: 11px; font-weight: 700; color: var(--pw-green); background: var(--pw-green-tint); padding: 3px 8px; border-radius: 6px; text-decoration: none; }
.pw-status-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; flex-shrink: 0; }
.pw-status-pill--baru { background: var(--pw-amber-tint); color: var(--pw-amber); }
.pw-status-pill--diproses { background: #E4ECF6; color: #24497A; }
.pw-status-pill--selesai { background: var(--pw-green-tint); color: var(--pw-green-dark); }
.pw-reply { margin: 6px 0; padding: 8px 10px; background: var(--pw-ground); border-radius: 10px; font-size: 13px; }

.pw-progress { height: 8px; border-radius: 4px; background: var(--pw-green-mid); overflow: hidden; }
.pw-progress span { display: block; height: 100%; border-radius: 4px; background: var(--pw-sand); }
.pw-progress--light { background: var(--pw-line); }
.pw-progress--light span { background: var(--pw-green); }

.pw-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pw-stat { background: var(--pw-surface); border-radius: var(--pw-radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.pw-stat__n { font-size: 26px; font-weight: 800; color: var(--pw-green); line-height: 1.1; }
.pw-stat__l { font-size: 13px; color: var(--pw-muted); }

/* ---------- Buttons ---------- */
.pw-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 52px; padding: 0 18px; border-radius: 16px; border: 1px solid transparent;
	font: 700 15px/1 var(--pw-font); text-decoration: none; cursor: pointer; width: 100%;
	transition: background .15s ease, transform .05s ease;
}
.pw-btn:active { transform: scale(.99); }
.pw-btn:disabled { opacity: .6; cursor: wait; }
.pw-btn--primary { background: var(--pw-green); color: var(--pw-on-dark); }
.pw-btn--primary:hover { background: var(--pw-green-dark); color: var(--pw-on-dark); }
.pw-btn--ghost { background: var(--pw-surface); color: var(--pw-ink); border-color: var(--pw-line); }
.pw-btn--ghost:hover { border-color: var(--pw-green); color: var(--pw-green); }
.pw-btn--danger { background: var(--pw-red-tint); color: var(--pw-red); min-height: 48px; }
.pw-btn--danger:hover { background: #F6DCDA; color: var(--pw-red); }
.pw-btn--text-danger { background: transparent; color: var(--pw-red); min-height: 44px; }
.pw-btn--sm { min-height: 44px; width: auto; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.pw-btn--pill { border-radius: 999px; }
.pw-btn--grow { flex: 1; width: auto; }
.pw-link { font-size: 14px; font-weight: 600; text-align: center; }
.pw-icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--pw-line); background: var(--pw-surface); color: var(--pw-ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }
.pw-icon-btn--onDark { background: transparent; border-color: var(--pw-green-mid); color: var(--pw-on-dark); }
.pw-icon-btn--onDark:hover { color: #fff; }
.pw-chip-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }

/* ---------- Forms ---------- */
.pw-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--pw-muted); }
.pw-field input, .pw-field select, .pw-field textarea {
	width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--pw-line);
	background: var(--pw-ground); color: var(--pw-ink); font: 500 16px/1.4 var(--pw-font);
}
.pw-field textarea { min-height: 96px; resize: vertical; }
.pw-field input:focus, .pw-field select:focus, .pw-field textarea:focus { outline: none; border-color: var(--pw-green); background: #fff; box-shadow: 0 0 0 3px rgba(31, 77, 58, .15); }
.pw-field input[type=file] { padding: 10px; background: #fff; font-size: 14px; }
.pw-otp { letter-spacing: .5em; font-size: 22px !important; font-weight: 800 !important; text-align: center; }
.pw-fieldset { border: 1px solid var(--pw-line-soft); border-radius: 14px; padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pw-fieldset legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.pw-hp { position: absolute; left: -9999px; }
.pw-checks { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pw-checks legend, .pw-seg legend { font-size: 13px; font-weight: 600; color: var(--pw-muted); margin-bottom: 8px; padding: 0; }
.pw-checks label, .pw-switch { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 32px; }
.pw-checks input, .pw-switch input { width: 20px; height: 20px; accent-color: var(--pw-green); flex-shrink: 0; }

.pw-seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pw-seg legend { grid-column: 1 / -1; }
.pw-seg--wrap { display: flex; flex-wrap: wrap; }
.pw-seg label { position: relative; }
.pw-seg input { position: absolute; opacity: 0; inset: 0; }
.pw-seg span { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--pw-line); background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; }
.pw-seg input:checked + span { background: var(--pw-green); border-color: var(--pw-green); color: var(--pw-on-dark); }
.pw-seg input:focus-visible + span { outline: 3px solid #7FB89A; outline-offset: 2px; }

.pw-search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--pw-surface); border: 1px solid var(--pw-line); color: var(--pw-muted); }
.pw-search input { border: 0; outline: 0; background: transparent; font: 500 15px var(--pw-font); color: var(--pw-ink); flex: 1; min-width: 0; height: 46px; }

.pw-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.pw-chips::-webkit-scrollbar { display: none; }
.pw-chip { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--pw-line); background: var(--pw-surface); color: var(--pw-ink); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; flex-shrink: 0; }
.pw-chip.is-on { background: var(--pw-green); border-color: var(--pw-green); color: var(--pw-on-dark); }

/* ---------- Beranda quick actions ---------- */
.pw-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 6px 0; }
.pw-quick__item { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--pw-ink); font-size: 12px; font-weight: 600; text-align: center; }
.pw-quick__icon { width: 56px; height: 56px; border-radius: 18px; background: var(--pw-sand); color: var(--pw-green); display: flex; align-items: center; justify-content: center; }
.pw-quick__item:hover .pw-quick__icon { background: #DDD3BC; }
.pw-announce summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.pw-announce summary::-webkit-details-marker { display: none; }
.pw-announce[open] .pw-prose { margin-top: 10px; font-size: 14px; color: var(--pw-muted); }
details.pw-card > summary { cursor: pointer; }

/* ---------- Pasar ---------- */
.pw-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pw-product { background: var(--pw-surface); border-radius: var(--pw-radius); overflow: hidden; text-decoration: none; color: var(--pw-ink); display: flex; flex-direction: column; }
.pw-product:hover { color: var(--pw-ink); box-shadow: var(--pw-shadow); }
.pw-product__img { position: relative; aspect-ratio: 4 / 3; background: #EAD9A8; }
.pw-product__img img { width: 100%; height: 100%; object-fit: cover; }
.pw-product__ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--pw-green); opacity: .55; }
.pw-product__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.pw-product__name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.pw-product__price { font-size: 15px; font-weight: 800; color: var(--pw-green); }
.pw-tag { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; color: var(--pw-green); background: rgba(255, 255, 255, .9); padding: 4px 8px; border-radius: 8px; }
.pw-tag--lg { top: auto; bottom: 16px; left: 16px; font-size: 12px; }

.pw-product-hero { position: relative; height: 240px; background: #EAD9A8; }
.pw-product-hero img { width: 100%; height: 100%; object-fit: cover; }
.pw-product-hero__back { position: absolute; top: 16px; left: 16px; border: 0; }
.pw-seller { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 14px; }
.pw-avatar { width: 38px; height: 38px; border-radius: 50%; background: #CFE0D6; color: var(--pw-green); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pw-stepper { display: flex; align-items: center; gap: 4px; }
.pw-stepper input { width: 48px; height: 44px; text-align: center; border: 0; font: 800 17px var(--pw-font); background: transparent; -moz-appearance: textfield; }
.pw-stepper input::-webkit-outer-spin-button, .pw-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pw-stepper__btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--pw-line); background: var(--pw-ground); font-size: 20px; color: var(--pw-ink); cursor: pointer; }
.pw-stepper__btn--on { background: var(--pw-green); border-color: var(--pw-green); color: var(--pw-on-dark); }
.pw-bubble { background: var(--pw-green-tint); border-radius: 14px 14px 14px 4px; padding: 12px 14px; font-size: 13px; line-height: 1.55; white-space: pre-line; }
.pw-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; background: var(--pw-surface); border-top: 1px solid var(--pw-line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; z-index: 20; }
.pw-bar__total { font-size: 19px; font-weight: 800; }

/* ---------- Bottom nav ---------- */
.pw-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; height: calc(var(--pw-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--pw-surface); border-top: 1px solid var(--pw-line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); z-index: 30; }
.pw-nav__item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--pw-muted); font-size: 11px; font-weight: 600; }
.pw-nav__item.is-active { color: var(--pw-green); font-weight: 800; }
.pw-nav__item.is-active svg { stroke-width: 2.3; }

/* ---------- Halaman biasa (non-portal) ---------- */
.pw-content { padding: 24px 16px 48px; }
.pw-content h1 { font-size: 24px; line-height: 1.25; }
.pw-site-head { padding: 16px; display: flex; align-items: center; justify-content: space-between; }
.pw-site-head a { font-weight: 800; text-decoration: none; color: var(--pw-green); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Ajakan pasang aplikasi (PWA) ---------- */
.pw-install { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(27, 43, 36, .45); padding: 12px; }
.pw-install[hidden] { display: none; }
.pw-install__card { position: relative; width: 100%; max-width: 496px; background: var(--pw-surface); border-radius: 22px; padding: 20px 18px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 -8px 32px rgba(27, 43, 36, .18); }
.pw-install__head { display: flex; gap: 14px; align-items: center; padding-right: 32px; }
.pw-install__head img { border-radius: 14px; flex-shrink: 0; }
.pw-install__head strong { display: block; font-size: 16px; }
.pw-install__head span { display: block; font-size: 13px; color: var(--pw-muted); line-height: 1.4; }
.pw-install__close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 26px; color: var(--pw-muted); cursor: pointer; border-radius: 50%; }
.pw-install__steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.pw-install__hint { margin: 10px 0; font-size: 12px; color: var(--pw-muted); background: var(--pw-ground); border-radius: 12px; padding: 10px 12px; }
.pw-install__later { border: 0; background: transparent; color: var(--pw-muted); font: 600 14px var(--pw-font); min-height: 44px; cursor: pointer; }
[data-pw-mode] .pw-btn { margin-top: 4px; }
