/* ================================================================
   JempolJadiDuit — Design System
   Implementasi DESIGN-pinterest.md (Pinterest design system).
   Pin Sans bersifat proprietary → disubstitusi Inter, sesuai catatan
   "Note on Font Substitutes" di design.md.
   Mendukung mode terang & gelap.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---------- Tokens: mode terang (default) ---------- */
:root {
    /* Brand & accent */
    --primary: #e60023;
    --on-primary: #ffffff;
    --primary-pressed: #cc001f;

    /* Text */
    --ink: #000000;
    --ink-soft: #211922;
    --body: #33332e;
    --charcoal: #262622;
    --mute: #62625b;
    --ash: #91918c;
    --stone: #c8c8c1;

    /* Surface */
    --canvas: #ffffff;
    --surface-soft: #fbfbf9;
    --surface-card: #f6f6f3;
    --surface-elevated: #ffffff;
    --surface-dark: #262622;
    --secondary-bg: #e5e5e0;
    --secondary-pressed: #c8c8c1;
    --on-secondary: #000000;
    --hairline: #dadad3;
    --hairline-soft: #e5e5e0;

    /* On dark */
    --on-dark: #ffffff;
    --on-dark-mute: rgba(255, 255, 255, 0.7);

    /* Semantic */
    --focus-outer: #435ee5;
    --focus-inner: #ffffff;
    --accent-pressed-blue: #617bff;
    --accent-purple: #7e238b;
    --accent-purple-deep: #6845ab;
    --success-deep: #103c25;
    --success-pale: #c7f0da;
    --error: #9e0a0a;
    --error-deep: #cc001f;
    --error-pale: #ffe8e8;

    /* Radius — sistem hanya memakai 16 / 32 / pill */
    --r-none: 0px;
    --r-sm: 8px;
    --r-md: 16px;
    --r-lg: 32px;
    --r-full: 9999px;

    /* Spacing */
    --space-xxs: 4px;
    --space-xs: 6px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-xxl: 32px;
    --space-section: 64px;

    --font: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;

    --scrim: rgba(0, 0, 0, 0.5);
    --modal-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* ---------- Tokens: mode gelap ---------- */
[data-theme="dark"] {
    --ink: #ffffff;
    --ink-soft: #f2f0f0;
    --body: #e5e5e0;
    --charcoal: #e5e5e0;
    --mute: #a8a8a1;
    --ash: #7c7c76;
    --stone: #5a5a54;

    --canvas: #1a1a17;
    --surface-soft: #211f1c;
    --surface-card: #262622;
    --surface-elevated: #2f2f2a;
    --surface-dark: #121210;
    --secondary-bg: #33332e;
    --secondary-pressed: #45453f;
    --on-secondary: #ffffff;
    --hairline: #3d3d37;
    --hairline-soft: #33332e;

    --error: #ff7a7a;          /* merah dinaikkan agar terbaca di atas surface gelap */
    --error-pale: #3a1414;
    --success-pale: #12301f;
    --success-deep: #c7f0da;

    --scrim: rgba(0, 0, 0, 0.7);
    --modal-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Ikuti preferensi OS selama user belum memilih manual */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #ffffff;
        --ink-soft: #f2f0f0;
        --body: #e5e5e0;
        --charcoal: #e5e5e0;
        --mute: #a8a8a1;
        --ash: #7c7c76;
        --stone: #5a5a54;

        --canvas: #1a1a17;
        --surface-soft: #211f1c;
        --surface-card: #262622;
        --surface-elevated: #2f2f2a;
        --surface-dark: #121210;
        --secondary-bg: #33332e;
        --secondary-pressed: #45453f;
        --on-secondary: #ffffff;
        --hairline: #3d3d37;
        --hairline-soft: #33332e;

        --error: #ff7a7a;      /* merah dinaikkan agar terbaca di atas surface gelap */
        --error-pale: #3a1414;
        --success-pale: #12301f;
        --success-deep: #c7f0da;

        --scrim: rgba(0, 0, 0, 0.7);
        --modal-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--body);
    background: var(--surface-soft);
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* Fokus ring biru — signature design.md */
:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 2px; }

/* ---------- Ikon SVG ---------- */
/* Semua ikon mewarisi warna teks induknya, jadi otomatis ikut mode gelap. */
.icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: -0.15em;
    stroke: currentColor;
    fill: none;
}
.icon-inline { margin-right: var(--space-sm); }

/* Tombol tema: bulan tampil di mode terang, matahari di mode gelap. */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline-block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Tipografi ---------- */
.display-xl { font-size: 70px; font-weight: 600; line-height: 1.1; letter-spacing: -1.2px; color: var(--ink); }
.display-lg { font-size: 44px; font-weight: 700; line-height: 1.15; letter-spacing: -0.8px; color: var(--ink); }
.heading-xl { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -1.2px; color: var(--ink); }
.heading-lg { font-size: 22px; font-weight: 600; line-height: 1.25; color: var(--ink); }
.heading-md { font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.body-md { font-size: 16px; font-weight: 400; line-height: 1.4; }
.body-strong { font-size: 16px; font-weight: 600; line-height: 1.4; }
.body-sm { font-size: 14px; font-weight: 400; line-height: 1.4; }
.body-sm-strong { font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--ink); }
.caption-md { font-size: 12px; font-weight: 500; line-height: 1.5; }
.caption-sm { font-size: 12px; font-weight: 400; line-height: 1.4; }
.link-md { font-size: 16px; font-weight: 600; color: var(--ink-soft); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mute { color: var(--mute); }
.text-ash { color: var(--ash); }
.text-primary { color: var(--primary); }
.text-ink { color: var(--ink); }
.uppercase { text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Layout utilities ---------- */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--space-xl); }
.container-narrow { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-xxl { margin-top: var(--space-xxl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-xxl { margin-bottom: var(--space-xxl); }
.p-xl { padding: var(--space-xl); }
.w-full { width: 100%; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 14px;
    min-height: 40px;
    border-radius: var(--r-md);
    transition: background-color .15s ease, color .15s ease;
    text-align: center;
}

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:active { background: var(--primary-pressed); }

.btn-secondary { background: var(--secondary-bg); color: var(--on-secondary); }
.btn-secondary:active { background: var(--secondary-pressed); }

.btn-tertiary { background: transparent; color: var(--ink); }
.btn-tertiary:active { background: var(--surface-card); }

.btn-lg { min-height: 48px; padding: 12px 24px; font-size: 16px; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 12px; }
.btn-block { width: 100%; }

.btn:disabled, .btn.is-disabled {
    background: var(--surface-card);
    color: var(--ash);
    cursor: not-allowed;
    pointer-events: none;
}

.btn-icon-circular {
    width: 40px; height: 40px;
    border-radius: var(--r-full);
    background: var(--surface-card);
    color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center;
}

.theme-toggle {
    width: 40px; height: 40px;
    border-radius: var(--r-full);
    background: var(--surface-card);
    color: var(--ink);
    font-size: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color .15s ease;
}
.theme-toggle:active { background: var(--secondary-pressed); }

/* ---------- Pills, chips, badges ---------- */
.filter-chip, .filter-tab {
    display: inline-flex; align-items: center;
    padding: 8px 16px;
    min-height: 40px;
    font-size: 14px; font-weight: 700; line-height: 1;
    background: var(--surface-card);
    color: var(--ink);
    border-radius: var(--r-full);
    transition: background-color .15s ease, color .15s ease;
}
.filter-chip.active, .filter-tab.active { background: var(--ink); color: var(--canvas); }
.filter-tabs { display: flex; gap: var(--space-sm); flex-wrap: wrap; }

.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px;
    font-size: 12px; font-weight: 700; line-height: 1.4;
    border-radius: var(--r-full);
    background: var(--surface-card);
    color: var(--ink);
}
.badge-active { background: var(--success-pale); color: var(--success-deep); }
.badge-warning { background: var(--error-pale); color: var(--error); }
.badge-banned { background: var(--error-deep); color: var(--on-primary); }
.badge-admin, .admin-badge { background: var(--accent-purple); color: var(--on-dark); }

.pin-overlay-pill {
    display: inline-flex;
    padding: 6px 12px;
    font-size: 12px; font-weight: 700; line-height: 1;
    background: var(--canvas); color: var(--ink);
    border-radius: var(--r-full);
}

/* ---------- Cards ---------- */
.card {
    background: var(--canvas);
    color: var(--body);
    border-radius: var(--r-md);
    padding: var(--space-xl);
}
.card-lg { border-radius: var(--r-lg); padding: var(--space-xxl); }
.card-soft { background: var(--surface-card); }

.pin-card { background: var(--surface-card); border-radius: var(--r-md); padding: 0; overflow: hidden; }
.pin-card-content { padding: var(--space-lg); }
.pin-card-meta { border-top: 1px solid var(--hairline); padding-top: var(--space-sm); margin-top: var(--space-md); }

.feature-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xxl); align-items: center; }
.feature-image { width: 100%; border-radius: var(--r-lg); object-fit: cover; aspect-ratio: 4/5; }
.feature-content { padding: var(--space-xl) 0; }

/* ---------- Navigation ---------- */
.nav {
    background: var(--canvas);
    height: 64px;
    display: flex; align-items: center;
    position: sticky; top: 0; z-index: 50;
    border-bottom: 1px solid var(--hairline);
}
.nav-container {
    width: 100%; max-width: 1280px; margin: 0 auto;
    padding: 0 var(--space-xl);
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-lg);
}
.nav-logo { font-size: 16px; font-weight: 700; color: var(--primary); display: inline-flex; align-items: center; gap: var(--space-sm); }
.nav-right { display: flex; align-items: center; gap: var(--space-md); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: var(--space-lg); }
.form-label { display: block; font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: var(--space-sm); }
.form-input {
    width: 100%;
    padding: 11px 15px;
    min-height: 44px;
    font-size: 16px;
    color: var(--ink);
    background: var(--canvas);
    border: 1px solid var(--ash);
    border-radius: var(--r-md);
}
.form-input::placeholder { color: var(--ash); }
.form-input:focus {
    outline: 4px solid var(--focus-outer);
    outline-offset: 1px;
    border-color: var(--ink);
    border-width: 2px;
}
.form-select { appearance: none; }
.form-hint, small.caption-sm { display: block; margin-top: var(--space-xxs); font-size: 12px; color: var(--mute); }

.search-bar {
    display: flex; align-items: center; gap: var(--space-sm);
    background: var(--surface-card);
    border-radius: var(--r-full);
    padding: 11px 15px;
    min-height: 48px;
}
.search-bar input { flex: 1; border: none; background: transparent; color: var(--ink); font-size: 16px; outline: none; }
.search-icon { color: var(--mute); }

/* ---------- Alerts ---------- */
.alert { padding: var(--space-md) var(--space-lg); border-radius: var(--r-md); font-size: 14px; margin-bottom: var(--space-lg); }
.alert-danger { background: var(--error-pale); color: var(--error); font-weight: 700; }
.alert-success { background: var(--success-pale); color: var(--success-deep); font-weight: 700; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--scrim);
    display: none;
    align-items: center; justify-content: center;
    padding: var(--space-lg);
    z-index: 100;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--canvas);
    border-radius: var(--r-lg);
    padding: var(--space-xxl);
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--modal-shadow);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-xl); }
.modal-title { font-size: 22px; font-weight: 600; color: var(--ink); }
.modal-close { font-size: 24px; line-height: 1; color: var(--mute); width: 40px; height: 40px; border-radius: var(--r-full); }
.modal-close:active { background: var(--surface-card); }

/* ---------- Tabel ---------- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left; font-size: 14px; font-weight: 700; color: var(--ink);
    padding: var(--space-md); border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
td { padding: var(--space-md); border-bottom: 1px solid var(--hairline-soft); color: var(--body); }
tr:last-child td { border-bottom: none; }

.cpm-warning { color: var(--error); font-weight: 700; }
.cpm-ok { color: var(--ink); }

/* ================================================================
   PANEL ADMIN — kerangka sidebar
   Desktop: sidebar menetap di kiri.
   Tablet & HP: sidebar jadi laci geser yang dibuka ikon hamburger.
   ================================================================ */

.admin-layout { display: flex; align-items: flex-start; }
.admin-main { flex: 1; min-width: 0; }

.hamburger {
    display: none;
    width: 40px; height: 40px;
    border-radius: var(--r-full);
    color: var(--ink);
    align-items: center; justify-content: center;
}
.hamburger:active { background: var(--surface-card); }

.nav-left { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--canvas);
    border-right: 1px solid var(--hairline);
    padding: var(--space-lg);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.sidebar-head {
    display: none;
    align-items: center; justify-content: space-between;
    margin-bottom: var(--space-lg);
}
.sidebar-title {
    font-size: 12px; font-weight: 700; color: var(--mute);
    text-transform: uppercase; letter-spacing: .08em;
    padding: 0 var(--space-md) var(--space-sm);
}

.sidebar-nav { display: flex; flex-direction: column; gap: var(--space-xxs); }

.sidebar-item {
    display: flex; align-items: center; gap: var(--space-md);
    width: 100%;
    padding: var(--space-md) var(--space-md);
    min-height: 48px;
    border-radius: var(--r-md);
    font-size: 14px; font-weight: 600; line-height: 1.2;
    color: var(--ink);
    text-align: left;
    transition: background-color .15s ease, color .15s ease;
}
.sidebar-item:hover { background: var(--surface-card); }
.sidebar-item:active { background: var(--secondary-bg); }
.sidebar-item .icon { color: var(--mute); }

/* Aksi utama tetap merah supaya jelas mana tindakan pokoknya */
.sidebar-item.is-primary { background: var(--primary); color: var(--on-primary); }
.sidebar-item.is-primary .icon { color: var(--on-primary); }
.sidebar-item.is-primary:hover { background: var(--primary); }
.sidebar-item.is-primary:active { background: var(--primary-pressed); }

.sidebar-sep { height: 1px; background: var(--hairline); margin: var(--space-md) var(--space-md); }

.sidebar-scrim {
    display: none;
    position: fixed; inset: 0;
    background: var(--scrim);
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

/* Filter tanggal di daftar user */
.filter-tanggal {
    background: var(--surface-card);
    border-radius: var(--r-md);
    padding: var(--space-lg);
}
.filter-tanggal-row {
    display: flex; align-items: center; gap: var(--space-sm);
    flex-wrap: wrap;
}
.filter-tanggal-row .form-input {
    width: auto; min-width: 150px;
    min-height: 40px; padding: 8px 12px;
    font-size: 14px;
}
.filter-pintasan {
    display: flex; gap: var(--space-sm); flex-wrap: wrap;
    margin-top: var(--space-md);
}
.filter-pintasan .filter-chip { min-height: 32px; padding: 6px 14px; font-size: 12px; }

@media (max-width: 640px) {
    .filter-tanggal-row .form-input { flex: 1; min-width: 130px; }
}

/* Slug & link share di daftar user */
.slug-chip {
    display: inline-block;
    margin-left: var(--space-xs);
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--surface-card);
    color: var(--mute);
    font-size: 11px; font-weight: 600;
}
.share-row {
    display: flex; align-items: center; gap: var(--space-sm);
    margin-top: var(--space-sm);
    flex-wrap: wrap;
}
.share-url {
    flex: 1; min-width: 0;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--r-md);
    background: var(--surface-card);
    color: var(--ink);
    font-size: 12px;
    word-break: break-all;
}

/* Pratinjau banner di modal Pengaturan */
.banner-preview {
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface-card);
    margin-bottom: var(--space-sm);
}
.banner-preview img { width: 100%; height: auto; display: block; }

/* ---------- Dashboard ---------- */
.dashboard { padding: var(--space-xxl) var(--space-xl) var(--space-section); }
.admin-main .dashboard { max-width: 1180px; }
.dashboard-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-lg); flex-wrap: wrap; margin-bottom: var(--space-xxl);
}
.dashboard-title { margin: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); margin-bottom: var(--space-xxl); }
.stat-card { background: var(--canvas); border-radius: var(--r-md); padding: var(--space-xl); text-align: center; }
.stat-card.warning { background: var(--error-pale); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1.2px; color: var(--ink); }
.stat-card.warning .stat-value { color: var(--error); }
.stat-label { font-size: 12px; font-weight: 500; color: var(--mute); margin-top: var(--space-xxs); }

/* ---------- Leaderboard ---------- */
.leaderboard-item {
    display: flex; align-items: center; gap: var(--space-lg);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--hairline-soft);
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: var(--r-full);
    background: var(--surface-card); color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
}
.leaderboard-rank.gold { background: #f5c518; color: #000; }
.leaderboard-rank.silver { background: var(--stone); color: #000; }
.leaderboard-rank.bronze { background: #cd7f32; color: #fff; }
.leaderboard-info { flex: 1; min-width: 0; }
.leaderboard-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.leaderboard-detail { font-size: 12px; color: var(--mute); }
.leaderboard-value { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ---------- Halaman See Another Offer (leaderboard) ---------- */
.offer-card {
    background: var(--surface-dark);
    color: var(--on-dark);
    border-radius: var(--r-md);
    padding: var(--space-xxl);
    text-align: center;
    margin-bottom: var(--space-xxl);
}
.offer-card h2 { color: var(--on-dark); margin-bottom: var(--space-sm); }
.offer-card p { color: var(--on-dark-mute); margin-bottom: var(--space-xl); }
.offer-link {
    display: inline-flex; align-items: center; gap: var(--space-sm);
    background: var(--canvas); color: var(--primary);
    padding: var(--space-md) var(--space-xxl);
    border-radius: var(--r-full);
    font-size: 14px; font-weight: 700;
}
.offer-link:active { background: var(--secondary-bg); }

.user-card {
    background: var(--surface-card);
    border-radius: var(--r-md);
    padding: var(--space-lg);
    display: flex; align-items: center; gap: var(--space-lg);
    margin-bottom: var(--space-sm);
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 16px; font-weight: 600; color: var(--ink); }
.user-revenue { font-size: 20px; font-weight: 700; color: var(--primary); }
.user-stats { font-size: 12px; color: var(--mute); margin-top: var(--space-xxs); }

.rank-badge {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: var(--r-full);
    background: var(--surface-soft); color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
}
.rank-badge.top-1 { background: #f5c518; color: #000; }
.rank-badge.top-2 { background: var(--stone); color: #000; }
.rank-badge.top-3 { background: #cd7f32; color: #fff; }

/* Podium tiga besar — ikon medali, bukan emoji */
.podium-medal { display: flex; justify-content: center; margin-bottom: var(--space-sm); }
.podium-gold   { color: #f5c518; }
.podium-silver { color: var(--stone); }
.podium-bronze { color: #cd7f32; }

.section-title {
    display: flex; align-items: center; gap: var(--space-md);
    font-size: 22px; font-weight: 600; color: var(--ink);
    margin-bottom: var(--space-lg);
}
.total-pool { background: var(--surface-dark); color: var(--on-dark); border-radius: var(--r-md); padding: var(--space-xxl); text-align: center; }
.total-pool .stat-value { color: var(--on-dark); font-size: 44px; }
.total-pool .stat-label { color: var(--on-dark-mute); }

/* ---------- Hero & CTA (marketing) ---------- */
.hero { background: var(--surface-soft); padding: var(--space-section) 0; text-align: center; }
.hero-title { margin-bottom: var(--space-lg); }
.hero-subtitle { font-size: 16px; color: var(--body); max-width: 560px; margin: 0 auto var(--space-xl); }
.cta-section { background: var(--surface-dark); color: var(--on-dark); padding: 48px var(--space-xxl); text-align: center; }
.cta-section .heading-xl { color: var(--on-dark); }

/* ================================================================
   HALAMAN PUBLIC — Campaign Viewer
   Tata letak mengikuti contoh di "buat boby.docx";
   warna, bentuk, dan tipografi mengikuti DESIGN-pinterest.md.
   ================================================================ */

.campaign-page { min-height: 100vh; background: var(--surface-soft); padding: var(--space-lg) 0 var(--space-xxl); }

.campaign-shell {
    width: 100%; max-width: 640px; margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex; flex-direction: column; gap: var(--space-md);
}

.campaign-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-md); margin-bottom: var(--space-xxs);
}
.campaign-brand { display: inline-flex; align-items: center; gap: var(--space-sm); font-size: 14px; font-weight: 700; color: var(--primary); }

/* Banner gelap (hero-cta-strip dengan radius kartu) */
.campaign-hero {
    background: var(--surface-dark);
    color: var(--on-dark);
    border-radius: var(--r-md);
    padding: var(--space-xxl) var(--space-xl);
    text-align: center;
}
.campaign-hero h1 {
    font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -1.2px;
    color: var(--on-dark); text-transform: uppercase;
}
.campaign-hero p { margin-top: var(--space-sm); font-size: 14px; color: var(--on-dark-mute); }

/* Banner berupa gambar unggahan admin: tanpa padding, gambar penuh */
.campaign-hero.is-image { padding: 0; overflow: hidden; background: var(--surface-card); }
.campaign-hero.is-image img { width: 100%; height: auto; display: block; }

/* Banner yang bisa diklik (link website admin) */
.campaign-hero-link { display: block; }
.campaign-hero-link:active .campaign-hero { opacity: .9; }

/* Sisa waktu tunggu */
.hitung-mundur { font-variant-numeric: tabular-nums; }

/* Kartu promo */
.promo-card { background: var(--canvas); border-radius: var(--r-md); padding: var(--space-xl); text-align: center; }
.promo-card h2 {
    font-size: 18px; font-weight: 700; color: var(--ink);
    text-transform: uppercase;
    display: inline-flex; align-items: center; gap: var(--space-sm);
}
.promo-card p { margin-top: var(--space-xxs); font-size: 14px; color: var(--mute); }

/* Kartu campaign aktif */
.campaign-card { background: var(--canvas); border-radius: var(--r-md); padding: var(--space-xl); text-align: center; }
.campaign-label { font-size: 12px; font-weight: 500; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; }
.campaign-name {
    margin-top: var(--space-xxs);
    font-size: 28px; font-weight: 700; letter-spacing: -1.2px;
    color: var(--primary); word-break: break-word;
}
.campaign-owner { margin-top: var(--space-xxs); font-size: 12px; color: var(--mute); }

/* CTA utama */
.btn-unlock {
    width: 100%; min-height: 56px;
    font-size: 16px; font-weight: 700;
    background: var(--primary); color: var(--on-primary);
    border-radius: var(--r-md);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
    text-transform: uppercase; letter-spacing: .02em;
    transition: background-color .15s ease;
}
.btn-unlock:active { background: var(--primary-pressed); }
.btn-unlock[disabled], .btn-unlock.is-disabled {
    background: var(--surface-card); color: var(--ash);
    cursor: not-allowed; pointer-events: none;
}

/* Navigasi prev / next */
.campaign-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.campaign-nav .btn {
    min-width: 0;                 /* cegah teks panjang melebarkan kolom grid */
    min-height: 48px;
    padding: 8px 10px;
    font-size: 14px; line-height: 1.2;
    text-transform: uppercase;
}

/* Grid statistik */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.stat-tile { background: var(--canvas); border-radius: var(--r-md); padding: var(--space-lg); text-align: center; }
.stat-tile.is-wide { grid-column: 1 / -1; }
.stat-tile .label { font-size: 12px; font-weight: 500; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; }
.stat-tile .value { margin-top: var(--space-xxs); font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-tile.is-alert { background: var(--error-pale); }
.stat-tile.is-alert .value, .stat-tile.is-alert .label { color: var(--error); }

/* Ringkasan total keseluruhan */
.total-strip {
    background: var(--surface-card);
    border-radius: var(--r-md);
    padding: var(--space-lg);
}
.total-strip-head {
    display: flex; align-items: center; gap: var(--space-sm);
    font-size: 12px; font-weight: 700; color: var(--ink);
    text-transform: uppercase; letter-spacing: .06em;
}
.total-strip-head span {
    margin-left: auto;
    font-weight: 500; letter-spacing: 0; text-transform: none;
    color: var(--mute);
}
.total-strip .stat-tile { background: var(--canvas); }

/* Meter limit klik */
.click-meter { background: var(--canvas); border-radius: var(--r-md); padding: var(--space-lg); }
.click-meter-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--mute); }
.click-meter-head strong { color: var(--ink); font-size: 14px; }
.click-meter-track { margin-top: var(--space-sm); height: 8px; border-radius: var(--r-full); background: var(--surface-card); overflow: hidden; }
.click-meter-fill { height: 100%; border-radius: var(--r-full); background: var(--primary); transition: width .3s ease; }
.click-meter-fill.is-full { background: var(--error); }

/* Banner peringatan */
.notice { border-radius: var(--r-md); padding: var(--space-lg); font-size: 14px; text-align: center; }
.notice-danger { background: var(--error-pale); color: var(--error); font-weight: 700; }
.notice-info { background: var(--surface-card); color: var(--body); }
.notice strong { display: block; margin-bottom: var(--space-xxs); }

/* Baris kepercayaan */
.trust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.trust-item {
    background: var(--canvas); border-radius: var(--r-md); padding: var(--space-lg) var(--space-md);
    text-align: center; font-size: 14px; font-weight: 600; color: var(--ink);
    display: flex; align-items: center; justify-content: center; gap: var(--space-sm);
    min-height: 56px;             /* tinggi seragam walau teksnya membungkus */
}

.page-footnote { text-align: center; font-size: 12px; color: var(--mute); padding: var(--space-lg) 0 0; }
.page-footnote a { color: var(--ink-soft); font-weight: 600; }

.empty-state { background: var(--canvas); border-radius: var(--r-lg); padding: var(--space-xxl); text-align: center; }

/* ---------- Footer ---------- */
.footer { background: var(--canvas); border-top: 1px solid var(--hairline); padding: var(--space-xxl) var(--space-xl); }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xl); }
.footer-col h4 { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: var(--space-md); }
.footer-col ul li { margin-bottom: var(--space-sm); }
.footer-col a { font-size: 14px; color: var(--mute); }
.footer-bottom {
    margin-top: var(--space-xl); padding-top: var(--space-lg);
    border-top: 1px solid var(--hairline);
    font-size: 12px; color: var(--mute); text-align: center;
}

/* ---------- Loading & toast ---------- */
.loading {
    width: 24px; height: 24px; margin: var(--space-xl) auto;
    border: 3px solid var(--hairline);
    border-top-color: var(--primary);
    border-radius: var(--r-full);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    background: var(--surface-dark); color: var(--on-dark);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--r-full);
    font-size: 14px; font-weight: 600;
    z-index: 200;
    box-shadow: var(--modal-shadow);
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Sidebar berubah jadi laci geser di bawah 1024px */
@media (max-width: 1023px) {
    .hamburger { display: inline-flex; }

    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 284px; max-width: 86vw;
        height: 100vh;
        z-index: 120;
        padding: var(--space-lg);
        border-right: 1px solid var(--hairline);
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.is-open { transform: none; }

    .sidebar-head { display: flex; }
    .sidebar-scrim { display: block; }
    .sidebar-scrim.is-open { opacity: 1; pointer-events: auto; }

    body.sidebar-open { overflow: hidden; }
}

@media (max-width: 768px) {
    .display-xl { font-size: 44px; letter-spacing: -0.8px; }
    .display-lg { font-size: 32px; }
    .heading-xl { font-size: 24px; letter-spacing: -0.8px; }

    .container, .dashboard { padding-left: var(--space-lg); padding-right: var(--space-lg); }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .feature-row { grid-template-columns: 1fr; gap: var(--space-xl); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .hero { padding: 48px 0; }
    .nav-container { padding: 0 var(--space-lg); }
    .dashboard-header { flex-direction: column; align-items: stretch; }
    .dashboard-header .flex { flex-wrap: wrap; }

    /* Tabel user berubah jadi kartu bertumpuk — 10 kolom tidak terbaca di HP.
       Label kolom diambil dari atribut data-label tiap sel. */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr {
        background: var(--surface-card);
        border-radius: var(--r-md);
        padding: var(--space-md) var(--space-lg);
        margin-bottom: var(--space-md);
    }
    .table-cards td {
        display: flex; align-items: center; justify-content: space-between;
        gap: var(--space-md);
        padding: var(--space-xs) 0;
        border: none;
        text-align: right;
    }
    .table-cards td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: 12px; font-weight: 500; color: var(--mute);
        text-align: left;
        text-transform: uppercase; letter-spacing: .04em;
    }
    .table-cards td[data-label="Nama"] {
        padding-bottom: var(--space-sm);
        margin-bottom: var(--space-xs);
        border-bottom: 1px solid var(--hairline);
        font-size: 16px;
    }
    .table-cards td[data-label="Nama"]::before { display: none; }
    .table-cards td[data-label="Aksi"] {
        justify-content: flex-end;
        padding-top: var(--space-md);
        margin-top: var(--space-xs);
        border-top: 1px solid var(--hairline);
    }
    .table-cards td[data-label="Aksi"]::before { display: none; }
    .table-container { overflow-x: visible; }

    /* Judul kartu + pencarian menumpuk, bukan berdesakan */
    .card > .flex.justify-between { flex-wrap: wrap; gap: var(--space-md); }
    .card > .flex.justify-between .search-bar { width: 100%; }
}

@media (max-width: 480px) {
    .display-xl { font-size: 36px; }
    .heading-xl { font-size: 22px; }

    .campaign-hero { padding: var(--space-xl) var(--space-lg); }
    .campaign-hero h1 { font-size: 22px; letter-spacing: -0.6px; }
    .campaign-name { font-size: 24px; }
    .campaign-shell { padding: 0 var(--space-md); gap: var(--space-sm); }
    .campaign-nav .btn { font-size: 12px; padding: 8px; }
    .trust-item { font-size: 13px; padding: var(--space-md) var(--space-sm); }
    .btn-unlock { font-size: 14px; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .modal { padding: var(--space-xl); border-radius: var(--r-lg); }
    .card { padding: var(--space-lg); }
    .card-lg { padding: var(--space-xl); }

    /* Statistik tetap 2 kolom di HP — lebih padat dan tidak perlu scroll jauh */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
    .stat-card { padding: var(--space-lg) var(--space-md); }
    .stat-value { font-size: 22px; letter-spacing: -0.6px; }

    .dashboard { padding: var(--space-xl) var(--space-lg) var(--space-xxl); }
    .dashboard-title { font-size: 22px; }

    /* Leaderboard: nama & angka tidak berdesakan */
    .leaderboard-item { gap: var(--space-md); }
    .leaderboard-rank { width: 32px; height: 32px; font-size: 12px; }
    .leaderboard-value { font-size: 14px; }

    .user-card { padding: var(--space-md); gap: var(--space-md); }
    .user-revenue { font-size: 16px; }
    .offer-card { padding: var(--space-xl) var(--space-lg); }
    .offer-link { padding: var(--space-md) var(--space-xl); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
