/* ============================================================
   KALKULATOR ZAKAT
   Minimalis: satu kolom di mobile, dua kolom (form + hasil) di desktop.
   Hanya memakai token global.css. Breakpoint: 900px dan 600px.
============================================================ */

.zakat-page {
    background: var(--bg);
    color: var(--text-dark);
    /* clip (bukan hidden) agar position: sticky tetap berfungsi */
    overflow-x: clip;
}

.zakat-page h1,
.zakat-page h2,
.zakat-page h3,
.zakat-page h4,
.zakat-page p {
    overflow-wrap: break-word;
}


/* ============================================================
   1. HERO
   Desktop: teks kiri + tiga fakta kanan. Mobile: menumpuk.
============================================================ */

.z-hero {
    padding: var(--space-12) 0;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border-soft);
}

.z-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: var(--space-12);
    align-items: center;
}

.z-hero-copy {
    min-width: 0;
}

.z-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);

    margin-bottom: var(--space-4);
    padding: var(--space-1) var(--space-3);

    border-radius: var(--radius-full);
    background: var(--primary-light);

    color: var(--primary);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
}

.z-hero-copy h1 {
    margin: 0 0 var(--space-4);

    color: var(--text-dark);
    font-size: clamp(21px, 4vw, 30px);
    font-weight: var(--fw-bold);
    line-height: 1.2;
    letter-spacing: -.02em;

    text-wrap: balance;
}

.z-hero-copy p {
    max-width: 480px;
    margin: 0 0 var(--space-6);

    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.7;
}

.z-cta {
    min-height: 48px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 var(--space-8);

    border-radius: var(--radius-full);
    background: var(--primary);

    color: var(--bg);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    white-space: nowrap;

    transition: background .2s ease;
}

.z-cta:hover {
    background: var(--primary-hover);
    color: var(--bg);
}


/* ---------- Tiga fakta ringkas ---------- */

.z-hero-facts {
    margin: 0;
    padding: var(--space-2) var(--space-5);
    list-style: none;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
}

.z-fact {
    display: flex;
    align-items: center;
    gap: var(--space-4);

    padding: var(--space-4) 0;
}

.z-fact + .z-fact {
    border-top: 1px solid var(--border-soft);
}

.z-fact-icon {
    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;
    flex-shrink: 0;

    border-radius: var(--radius-full);
    background: var(--primary-light);

    color: var(--primary);
    font-size: var(--fs-md);
}

.z-fact-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.z-fact-text strong {
    color: var(--text-dark);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    line-height: 1.2;
}

.z-fact-text small {
    color: var(--muted);
    font-size: var(--fs-xs);
}


/* ---------- Hero: tablet & mobile ---------- */

@media (max-width: 900px) {

    .z-hero {
        padding: var(--space-8) 0;
    }

    .z-hero-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .z-hero-facts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: var(--space-4) var(--space-2);
    }

    .z-fact {
        flex-direction: column;
        gap: var(--space-2);
        padding: 0 var(--space-2);
        text-align: center;
    }

    .z-fact + .z-fact {
        border-top: 0;
        border-left: 1px solid var(--border-soft);
    }

    .z-fact-icon {
        width: 32px;
        height: 32px;
        font-size: var(--fs-sm);
    }

    .z-fact-text {
        align-items: center;
    }

    .z-fact-text strong {
        font-size: var(--fs-sm);
    }
}

@media (max-width: 600px) {

    .z-cta {
        width: 100%;
    }
}


/* ============================================================
   2. LAYOUT KALKULATOR
============================================================ */

.zakat-calculator-section {
    padding: var(--space-10) 0 var(--space-16);
    /* agar anchor "Mulai Hitung" tidak tertutup header sticky */
    scroll-margin-top: var(--space-20);
}

.zakat-calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: var(--space-8);
    align-items: start;
}

.zakat-panel,
.zakat-result-card,
.zakat-action-card {
    min-width: 0;

    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.z-ledger {
    padding: var(--space-8);
}

.z-ledger-header {
    margin-bottom: var(--space-5);
}

.z-ledger-header h2 {
    margin: 0 0 var(--space-1);
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
}

.z-ledger-header p {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-sm);
}


/* ---------- Tab jenis zakat (segmented control) ---------- */

.z-tabbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-1);

    margin-bottom: var(--space-6);
    padding: var(--space-1);

    border-radius: var(--radius-md);
    background: var(--bg-soft);
}

.zakat-tab {
    min-width: 0;
    min-height: 56px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);

    padding: var(--space-2) var(--space-1);

    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;

    color: var(--muted);
    font-family: inherit;
    cursor: pointer;

    -webkit-tap-highlight-color: transparent;

    transition:
        background .2s ease,
        color .2s ease,
        box-shadow .2s ease;
}

.zakat-tab i {
    font-size: var(--fs-md);
    line-height: 1;
}

.zakat-tab-content {
    max-width: 100%;
}

.zakat-tab-content strong {
    display: block;
    overflow: hidden;

    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1.2;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.zakat-tab:hover {
    color: var(--text-dark);
}

.zakat-tab.active {
    background: var(--bg);
    color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.zakat-tab.active .zakat-tab-content strong {
    font-weight: var(--fw-bold);
}


/* ---------- Kepala form ---------- */

.z-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);

    margin-bottom: var(--space-5);
}

.z-form-head h3 {
    margin: 0;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}

.z-nisab {
    text-align: right;
}

.z-nisab span {
    display: block;
    color: var(--muted);
    font-size: var(--fs-xs);
}

.z-nisab strong {
    color: var(--secondary-hover);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}


/* ---------- Field (dirender oleh JS) ---------- */

.zakat-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

.zakat-field {
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.zakat-field-full {
    grid-column: 1 / -1;
}

.zakat-field label,
.zakat-field-title {
    color: var(--text-dark);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
}

.zakat-field small {
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1.5;
}

.zakat-input-wrap {
    position: relative;
    min-width: 0;
}

.zakat-input-prefix {
    position: absolute;
    top: 50%;
    left: var(--space-4);
    transform: translateY(-50%);

    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);

    pointer-events: none;
}

.zakat-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 48px;

    padding: 0 var(--space-4);

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);

    color: var(--text-dark);
    font-family: inherit;
    font-size: var(--fs-sm);

    outline: none;

    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

.zakat-input-wrap.has-prefix input {
    padding-left: 44px;
}

.zakat-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}


/* ---------- Estimasi langsung ---------- */

.zakat-live-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);

    margin-top: var(--space-6);
    padding: var(--space-5);

    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}

.zakat-live-preview span {
    display: block;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
}

.zakat-live-preview strong {
    color: var(--primary);
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    overflow-wrap: break-word;
}

.zakat-live-preview p {
    max-width: 260px;
    margin: 0;

    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1.5;
    text-align: right;
}

.zakat-submit-button {
    width: 100%;
    min-height: 50px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);

    margin-top: var(--space-5);

    border: 0;
    border-radius: var(--radius-full);
    background: var(--primary);

    color: var(--bg);
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    cursor: pointer;

    transition: background .2s ease;
}

.zakat-submit-button:hover {
    background: var(--primary-hover);
}


/* ---------- Catatan estimasi ---------- */

.z-note {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);

    margin: var(--space-5) 0 0;

    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1.6;
}

.z-note i {
    margin-top: 2px;
    flex-shrink: 0;
    color: var(--secondary-hover);
}

.z-note a {
    color: var(--primary);
    font-weight: var(--fw-bold);
}

.z-note a:hover {
    text-decoration: underline;
}


/* ============================================================
   3. HASIL
============================================================ */

.zakat-result-area {
    position: sticky;
    top: 104px;

    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.zakat-result-card {
    padding: var(--space-6);
}

.zakat-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);

    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);

    border-bottom: 1px solid var(--border-soft);
}

.zakat-result-header h2 {
    margin: 0;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}

.zakat-result-badge {
    height: 28px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 var(--space-3);

    border-radius: var(--radius-full);
    background: var(--secondary-light);

    color: var(--secondary-hover);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    white-space: nowrap;
}

.zakat-empty-state {
    min-height: 200px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);

    text-align: center;
}

.zakat-empty-state i {
    color: var(--border);
    font-size: 36px;
}

.zakat-empty-state p {
    max-width: 220px;
    margin: 0;

    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.6;
}

.zakat-result-title {
    margin: 0 0 var(--space-1);
    color: var(--muted);
    font-size: var(--fs-sm);
}

.zakat-result-amount {
    margin: 0 0 var(--space-1);

    color: var(--primary);
    font-size: clamp(28px, 6vw, 36px);
    font-weight: var(--fw-bold);
    letter-spacing: -.02em;
    overflow-wrap: break-word;
}

.zakat-result-status:empty,
.zakat-result-detail:empty {
    display: none;
}

.zakat-result-status {
    margin-bottom: var(--space-3);
    font-size: var(--fs-xs);
}

.zakat-result-subtitle {
    margin: 0 0 var(--space-4);
    color: var(--muted);
    font-size: var(--fs-xs);
}

.zakat-result-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);

    padding: var(--space-3) 0;

    border-top: 1px solid var(--border-soft);
    font-size: var(--fs-sm);
}

.zakat-result-row span {
    color: var(--muted);
}

.zakat-result-row strong {
    color: var(--text-dark);
    font-weight: var(--fw-bold);
    text-align: right;
    overflow-wrap: anywhere;
}

.zakat-result-row.total {
    border-top-color: var(--border);
}

.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--success) !important;
}

.zakat-law-card {
    display: flex;
    gap: var(--space-3);

    margin-top: var(--space-4);
    padding: var(--space-4);

    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}

.zakat-law-card i {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--primary);
}

.zakat-law-card h4 {
    margin: 0 0 var(--space-1);
    color: var(--text-dark);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}

.zakat-law-card p {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1.6;
}


/* ---------- Ajakan menyalurkan ---------- */

.zakat-action-card {
    padding: var(--space-6);
    animation: zakatFadeIn .25s ease;
}

@keyframes zakatFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.zakat-action-card h3 {
    margin: 0 0 var(--space-1);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}

.zakat-action-card p {
    margin: 0 0 var(--space-4);
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.6;
}

.zakat-pay-button,
.zakat-print-button {
    width: 100%;
    min-height: 46px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);

    border-radius: var(--radius-full);

    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    cursor: pointer;

    transition:
        background .2s ease,
        border-color .2s ease;
}

.zakat-pay-button {
    margin-bottom: var(--space-3);

    border: 0;
    background: var(--primary);
    color: var(--bg);
}

.zakat-pay-button:hover {
    background: var(--primary-hover);
    color: var(--bg);
}

.zakat-print-button {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--primary);
}

.zakat-print-button:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}


/* ============================================================
   4. SYARAT WAJIB ZAKAT
============================================================ */

.z-terms-section {
    padding: var(--space-12) 0 var(--space-16);
    border-top: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

.z-terms-heading {
    max-width: 520px;
    margin: 0 auto var(--space-8);
    text-align: center;
}

.z-terms-heading h2 {
    margin: 0 0 var(--space-1);
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
}

.z-terms-heading p {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-sm);
}

.z-terms-list {
    max-width: 760px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5) var(--space-8);
}

.z-term-row {
    min-width: 0;

    display: flex;
    gap: var(--space-3);
}

.z-term-row i {
    width: 24px;
    height: 24px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    margin-top: 1px;

    border-radius: var(--radius-full);
    background: var(--success-light);

    color: var(--success);
    font-size: var(--fs-sm);
}

.z-term-row strong {
    display: block;
    margin-bottom: var(--space-1);

    color: var(--text-dark);
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
}

.z-term-row p {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: 1.6;
}


/* ============================================================
   RESPONSIVE — TABLET (<= 900px)
   Form dan hasil menumpuk jadi satu kolom.
============================================================ */

@media (max-width: 900px) {

    .zakat-calculator-layout {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .zakat-result-area {
        position: static;
    }
}


/* ============================================================
   RESPONSIVE — MOBILE (<= 600px)
============================================================ */

@media (max-width: 600px) {
    .zakat-calculator-section {
        padding: var(--space-5) 0 var(--space-10);
    }

    .z-ledger,
    .zakat-result-card,
    .zakat-action-card {
        padding: var(--space-5);
    }

    .z-ledger-header h2 {
        font-size: var(--fs-md);
    }

    .z-ledger-header p {
        font-size: var(--fs-xs);
    }

    .z-form-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .z-nisab {
        text-align: left;
    }

    .zakat-fields {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    /* 16px mencegah iOS Safari melakukan auto-zoom saat input difokuskan */
    .zakat-input-wrap input {
        font-size: 16px;
    }

    .zakat-live-preview {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
        padding: var(--space-4);
    }

    .zakat-live-preview p {
        max-width: 100%;
        text-align: left;
    }

    .z-terms-section {
        padding: var(--space-10) 0;
    }

    .z-terms-heading {
        margin-bottom: var(--space-6);
    }

    .z-terms-heading h2 {
        font-size: var(--fs-md);
    }

    .z-terms-list {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}


/* ============================================================
   DESKTOP KECIL KE ATAS (>= 601px)
   Tab: ikon dan label sejajar, lebih lega.
============================================================ */

@media (min-width: 601px) {

    .zakat-tab {
        flex-direction: row;
        gap: var(--space-2);
        min-height: 48px;
    }

    .zakat-tab-content strong {
        font-size: var(--fs-sm);
    }
}