/* ════════════════════════════════════════════════════════════════════════════
   topup.css — Halaman Top Up (Pulsa & Data, Game, Token PLN)
   Memakai token yang sama dengan halaman toko lain (globals.css).
   ════════════════════════════════════════════════════════════════════════════ */

/* Atribut hidden harus selalu menang atas display:flex/grid di file ini
   (mis. tombol Muat lebih banyak, tab top up yang dimatikan). */
[hidden] {
    display: none !important;
}


.tp-main {
    padding: calc(var(--header-height) + 24px) 0 56px;
}

.tp-container {
    max-width: 1080px;
}

.tp-head {
    margin-bottom: 18px;
}

.tp-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tp-desc {
    margin-top: 4px;
    color: var(--text-2);
    font-size: 0.9rem;
    max-width: 62ch;
}

/* ── Tab utama ── */
.tp-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tp-tabs::-webkit-scrollbar {
    display: none;
}

.tp-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.tp-tab svg {
    width: 18px;
    height: 18px;
}

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

.tp-tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}

/* ── Tata letak: panel + ringkasan ── */
.tp-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.tp-panel,
.tp-checkout {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
}

.tp-checkout {
    position: sticky;
    top: calc(var(--header-height) + 16px);
}

.tp-label {
    display: block;
    margin: 14px 0 8px;
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--text-2);
}

.tp-panel > .tp-label:first-child,
.tp-panel > .tp-alert + .tp-label {
    margin-top: 0;
}

.tp-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.tp-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.tp-input-lg {
    height: 50px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

select.tp-input {
    cursor: pointer;
}

.tp-phone-wrap {
    position: relative;
}

.tp-op {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--brand-soft);
    color: var(--brand-text);
    font-size: 0.76rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity var(--duration-fast);
    pointer-events: none;
}

.tp-op.show {
    opacity: 1;
}

.tp-help {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-3);
    white-space: pre-line;
}

.tp-list {
    margin-top: 16px;
}

.tp-empty {
    padding: 28px 8px;
    text-align: center;
    color: var(--text-2);
    font-size: 0.88rem;
}

.tp-alert {
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--warning-text);
    font-size: 0.84rem;
    font-weight: 600;
}

.tp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 36px 8px;
    color: var(--text-2);
    font-size: 0.88rem;
}

.tp-spin {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-2);
    border-top-color: var(--brand);
    animation: tp-spin 0.8s linear infinite;
    display: inline-block;
}

.tp-spin-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes tp-spin {
    to { transform: rotate(360deg); }
}

/* ── Sub-tab Pulsa / Data ── */
.tp-subtabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tp-subtab {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-2);
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.tp-subtab.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-text);
}

/* ── Pilihan nominal ── */
.tp-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tp-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-height: 82px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-2);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--duration-fast), background var(--duration-fast);
}

.tp-item:hover {
    border-color: var(--brand-ring);
}

.tp-item.is-selected {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.tp-item-name {
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.3;
}

.tp-item-desc {
    font-size: 0.72rem;
    color: var(--text-3);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tp-item-price {
    margin-top: auto;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--brand-text);
    font-variant-numeric: tabular-nums;
}

/* ── Daftar game ── */
.tp-games {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.tp-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    transition: border-color var(--duration-fast), background var(--duration-fast);
}

.tp-game:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.tp-game-logo {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--brand-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.tp-game-logo b {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--brand-text);
}

.tp-game-logo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--surface);
}

.tp-game-name {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tp-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--brand-text);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.tp-back svg {
    width: 16px;
    height: 16px;
}

.tp-game-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 4px;
}

.tp-game-head h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.tp-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 12px;
}

/* ── Ringkasan & bayar ── */
.tp-co-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.tp-sum {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.tp-sum > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.86rem;
}

.tp-sum dt {
    color: var(--text-2);
    flex-shrink: 0;
}

.tp-sum dd {
    text-align: right;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.tp-sum-total dd {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-text);
}

.tp-co-field .tp-label {
    margin-top: 14px;
}

.tp-via {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.tp-via-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 8px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-2);
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}

.tp-via-btn input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tp-via-btn.is-selected {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-text);
}

.tp-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.74rem;
    color: var(--text-3);
}

.tp-confirm {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 16px 0 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text);
    cursor: pointer;
}

.tp-confirm input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    flex-shrink: 0;
}

.tp-co-note {
    margin-top: 10px;
    font-size: 0.76rem;
    color: var(--text-3);
    text-align: center;
}

.tp-co-note a {
    color: var(--brand-text);
    font-weight: 600;
}

/* ── Layar hasil di modal ── */
.tp-result {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.tp-result .tp-sum {
    text-align: left;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.tp-result-ic {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.tp-result-ic svg {
    width: 52px;
    height: 52px;
}

.tp-result.is-ok .tp-result-ic { color: var(--success); }
.tp-result.is-fail .tp-result-ic { color: var(--danger); }

.tp-result h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.tp-result-ref {
    font-size: 0.78rem;
    color: var(--text-3);
}

.tp-result-note {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.5;
}

.tp-sn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--success-soft);
}

.tp-sn > span {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--success-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tp-sn code {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
    letter-spacing: 0.04em;
}

/* ── Responsif ── */
@media (max-width: 900px) {
    .tp-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .tp-checkout {
        position: static;
        scroll-margin-top: calc(var(--header-height) + 12px);
    }

    .tp-games {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .tp-main {
        padding-top: calc(var(--header-height) + 16px);
    }

    .tp-title {
        font-size: 1.3rem;
    }

    .tp-panel,
    .tp-checkout {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .tp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .tp-tab {
        padding: 9px 12px;
        font-size: 0.82rem;
    }

    .tp-games {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .tp-game-logo {
        width: 48px;
        height: 48px;
    }
}
