/* =========================================================
   PJSK — Design Tokens
   Palet terinspirasi tanah liat, sawah, dan anyaman bambu desa.
   ========================================================= */
:root {
    --clay: #A85C32;
    --clay-dark: #8A4A26;
    --leaf: #3F6B4A;
    --leaf-dark: #2E5038;
    --rice: #F1EBD9;
    --rice-soft: #E9E0C7;
    --soil: #2B241C;
    --soil-soft: #5C5142;
    --bamboo: #C9B896;
    --gold: #C8963E;
    --white: #FFFDF8;
    --danger: #B54B3F;
    --info: #2E6C99;

    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body: 'Work Sans', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --radius: 10px;
    --shadow-soft: 0 4px 16px rgba(43, 36, 28, 0.10);
    --shadow-lift: 0 10px 30px rgba(43, 36, 28, 0.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--rice);
    color: var(--soil);
    line-height: 1.6;
    font-size: 16px;
}

/* Scrollbar tipis menyatu dengan tema, menggantikan scrollbar bawaan browser */
html { scrollbar-width: thin; scrollbar-color: var(--clay) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--clay); border-radius: 999px; border: 2px solid var(--rice); }
::-webkit-scrollbar-thumb:hover { background-color: var(--clay-dark); }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--soil); line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 600; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--clay-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.anyaman-divider {
    height: 14px;
    background-image:
        repeating-linear-gradient(45deg, var(--clay) 0, var(--clay) 6px, transparent 6px, transparent 12px),
        repeating-linear-gradient(-45deg, var(--leaf) 0, var(--leaf) 6px, transparent 6px, transparent 12px);
    background-blend-mode: multiply;
    opacity: 0.85;
}
.anyaman-bg {
    background-image:
        repeating-linear-gradient(45deg, rgba(168,92,50,0.06) 0, rgba(168,92,50,0.06) 8px, transparent 8px, transparent 16px),
        repeating-linear-gradient(-45deg, rgba(63,107,74,0.06) 0, rgba(63,107,74,0.06) 8px, transparent 8px, transparent 16px);
}

/* Navbar */
.navbar { background: var(--soil); color: var(--rice); position: sticky; top: 0; z-index: 2000; box-shadow: var(--shadow-soft); }
.navbar .container { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--white); }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--clay), var(--gold)); display: flex; align-items: center; justify-content: center; color: var(--white); font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; }
.brand small { display: block; font-family: var(--font-body); font-size: 0.68rem; font-weight: 400; color: var(--bamboo); letter-spacing: 0.04em; }
.nav-links { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--rice-soft); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--gold); text-decoration: none; }
.nav-toggle { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 999px; font-weight: 600; font-size: 0.95rem; border: 2px solid transparent; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--clay); color: var(--white); }
.btn-primary:hover { background: var(--clay-dark); box-shadow: var(--shadow-soft); }
.btn-secondary { background: var(--leaf); color: var(--white); }
.btn-secondary:hover { background: var(--leaf-dark); box-shadow: var(--shadow-soft); }
.btn-outline { background: transparent; border-color: var(--soil); color: var(--soil); }
.btn-outline:hover { background: var(--soil); color: var(--white); }
.btn-outline-light { background: transparent; border-color: var(--rice-soft); color: var(--rice-soft); }
.btn-outline-light:hover { background: var(--rice-soft); color: var(--soil); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 7px 16px; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--soil) 0%, #3a3123 100%); color: var(--rice); padding: 72px 0 56px; position: relative; overflow: hidden; }
.hero .eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; color: var(--gold); margin-bottom: 14px; }
.hero h1 { color: var(--white); max-width: 780px; }
.hero .lede { max-width: 620px; color: var(--bamboo); font-size: 1.1rem; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px; border-top: 1px solid rgba(241,235,217,0.15); padding-top: 24px; }
.hero-stats .stat-num { font-family: var(--font-display); font-size: 2.1rem; color: var(--gold); display: block; }
.hero-stats .stat-label { font-size: 0.85rem; color: var(--bamboo); }

/* Sections */
.section { padding: 60px 0; }
.section-alt { background: var(--rice-soft); }
.section-head { max-width: 640px; margin: 0 auto 36px; text-align: center; }
.section-head .eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--clay-dark); margin-bottom: 10px; display: block; }

/* Cards */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-soft); border: 1px solid rgba(43,36,28,0.06); }
.card-icon { width: 46px; height: 46px; border-radius: 10px; background: var(--rice-soft); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 700; color: var(--clay-dark); margin-bottom: 16px; }

/* Forms */
.form-panel { background: var(--white); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-soft); max-width: 680px; margin: 0 auto; }
@media (min-width: 900px) {
    .form-panel { max-width: 820px; padding: 44px; }
}
@media (min-width: 1200px) {
    .form-panel { max-width: 960px; padding: 48px; }
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"],
input[type="number"], input[type="file"], select, textarea {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--bamboo); border-radius: 8px;
    font-family: var(--font-body); font-size: 0.95rem; background: var(--rice); color: var(--soil);
}
textarea { resize: vertical; min-height: 110px; }
input:focus, select:focus, textarea:focus { border-color: var(--clay); }
.helper-text { font-size: 0.8rem; color: var(--soil-soft); margin-top: 4px; }
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 0.92rem; }
.alert-success { background: #E6EFE7; color: var(--leaf-dark); border: 1px solid var(--leaf); }
.alert-error { background: #F6E7E4; color: var(--danger); border: 1px solid var(--danger); }

/* Badges */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; font-family: var(--font-mono); }
.badge-tunggu { background: #F6E7C9; color: #7A5A16; }
.badge-proses { background: #DCE8F2; color: #1E5580; }
.badge-selesai { background: #DCEEDD; color: var(--leaf-dark); }

/* Timeline riwayat status */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 22px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before {
    content: ''; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: var(--rice-soft);
}
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--bamboo); }
.timeline-dot-tunggu { background: #C8963E; }
.timeline-dot-proses { background: #2E6C99; }
.timeline-dot-selesai { background: #3F6B4A; }
.timeline-content { flex: 1; }
.timeline-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.timeline-date { font-size: 0.8rem; color: var(--soil-soft); font-family: var(--font-mono); }
.timeline-note { font-size: 0.9rem; margin: 0; color: var(--soil); }

/* Peta */
.map-wrap { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); border: 1px solid rgba(43,36,28,0.08); position: relative; z-index: 0; isolation: isolate; }
#peta-sebaran { height: 520px; width: 100%; }
#peta-pilih-lokasi { height: 280px; width: 100%; border-radius: 8px; }
@media (min-width: 900px) {
    #peta-pilih-lokasi { height: 360px; }
}
.map-legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; font-size: 0.85rem; }
.map-legend span { display: inline-flex; align-items: center; gap: 8px; }
.map-legend .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.leaflet-popup-content h4 { margin: 0 0 6px; font-family: var(--font-body); font-size: 0.95rem; }
.leaflet-popup-content p { margin: 0 0 4px; font-size: 0.85rem; }

/* Footer */
.site-footer { background: var(--soil); color: var(--bamboo); padding: 48px 0 24px; margin-top: 40px; }
.site-footer h4 { color: var(--white); font-family: var(--font-body); font-size: 1rem; }
.site-footer a { color: var(--bamboo); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-bottom { border-top: 1px solid rgba(241,235,217,0.12); padding-top: 20px; font-size: 0.82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Tables (admin) */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
thead { background: var(--rice-soft); }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--rice-soft); }
tbody tr:hover { background: rgba(168,92,50,0.04); }

/* Admin layout */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: var(--soil); color: var(--rice-soft); padding: 24px 0; flex-shrink: 0; }
.admin-sidebar .brand { padding: 0 24px 24px; border-bottom: 1px solid rgba(241,235,217,0.12); margin-bottom: 12px; }
.admin-sidebar nav a { display: block; padding: 12px 24px; color: var(--bamboo); font-weight: 500; font-size: 0.92rem; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(241,235,217,0.06); color: var(--gold); text-decoration: none; border-left: 3px solid var(--gold); padding-left: 21px; }
.admin-main { flex: 1; padding: 32px 40px; background: var(--rice); }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-soft); }
.stat-card .num { font-family: var(--font-display); font-size: 2rem; color: var(--clay-dark); }
.stat-card .label { font-size: 0.85rem; color: var(--soil-soft); }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--soil); background-image: repeating-linear-gradient(45deg, rgba(200,150,62,0.04) 0, rgba(200,150,62,0.04) 10px, transparent 10px, transparent 20px); padding: 24px; }
.login-card { background: var(--white); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow-lift); width: 100%; max-width: 380px; }
input:disabled, .password-toggle:disabled { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 420px) { .login-card { padding: 28px 22px; } }

/* Utility */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--soil-soft); }
.empty-state .glyph { font-family: var(--font-mono); font-size: 2.4rem; color: var(--bamboo); margin-bottom: 12px; }

@media (max-width: 860px) {
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .hero-stats { grid-template-columns: 1fr; gap: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .admin-main { padding: 24px 16px; }
    #peta-sebaran { height: 380px; }
    .nav-links { position: absolute; top: 100%; left: 0; right: 0; background: var(--soil); flex-direction: column; padding: 16px 24px; display: none; gap: 16px; }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; background: none; border: none; color: var(--white); font-size: 1.4rem; cursor: pointer; }
}
@media (max-width: 600px) { .stat-cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Password field with show/hide toggle */
.password-field { position: relative; }
.password-field input[type="password"],
.password-field input[type="text"] { padding-right: 46px; }
.password-toggle {
    position: absolute; top: 0; right: 2px; bottom: 0; width: 42px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; padding: 0;
    color: var(--clay); line-height: 1;
}
.password-toggle svg { width: 20px; height: 20px; display: block; }
.password-toggle:hover { color: var(--clay-dark); }
.password-toggle:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; border-radius: 4px; }
