/**
 * Halaman upgrade premium — konsep tiket (DEW-610)
 * Dipakai: upgrade.php. Light + dark mode (body.dark-mode-active), versi webview (body.is-webview).
 * Warna = token brand (me.css / dark-mode-custom.css). Jangan inline di PHP.
 */

.tkp,
.tkp-wrap {
    --tk-page: #eceff1;
    --tk-paper: #fff;
    --tk-ink: #1f2937;
    --tk-muted: #6b7280;
    --tk-line: rgba(31, 41, 55, 0.1);
    --tk-perf: rgba(31, 41, 55, 0.2);
    --tk-shadow: rgba(31, 41, 55, 0.08);
    --tk-red: #e53935;
    --tk-red-press: #c62828;
    --tk-sel-bg: #e53935;
    --tk-sel-ink: #fff;
    --tk-sel-muted: rgba(255, 255, 255, 0.82);
    --tk-sel-perf: rgba(255, 255, 255, 0.5);
    --tk-stamp: #fff;
    --tk-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--tk-ink);
}
body.dark-mode-active .tkp,
body.dark-mode-active .tkp-wrap {
    --tk-page: var(--dm-page-bg, #0c1624);
    --tk-paper: var(--dm-surface, #0F1C2F);
    --tk-ink: var(--dm-ink, #fff);
    --tk-muted: var(--dm-muted, #8195a6);
    --tk-line: var(--dm-line, #1B283B);
    --tk-perf: #2a3d56;
    --tk-shadow: rgba(0, 0, 0, 0.35);
    --tk-red: #f44336;
    --tk-red-press: #e53935;
    /* tiket terpilih tetap merah penuh (versi Merah), cuma latar yang ikut gelap */
    --tk-sel-bg: #e53935;
    --tk-sel-ink: #fff;
    --tk-sel-muted: rgba(255, 255, 255, 0.82);
    --tk-sel-perf: rgba(255, 255, 255, 0.5);
    --tk-stamp: #fff;
}

#appCapsule .tkp-wrap {
    background: var(--tk-page);
    padding-bottom: calc(170px + env(safe-area-inset-bottom, 0px));
    margin-bottom: 0;
}
body.is-webview #appCapsule .tkp-wrap {
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}
.tkp-wrap .tkp { padding-top: 18px; padding-bottom: 8px; }
.tkp .num { font-variant-numeric: tabular-nums; }

/* ---------- Kepala ---------- */
.tkp-kicker {
    margin: 0 0 8px;
    font-family: var(--tk-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tk-muted);
}
.tkp-title {
    margin: 0;
    font-size: 25px;
    line-height: 1.18;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--tk-ink);
    text-wrap: balance;
}

/* ---------- Popup promo (dari getPopupData) ---------- */
.tkp-promo {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--tk-paper);
    box-shadow: inset 0 0 0 1.5px var(--tk-red);
}
.tkp-promo h2 { margin: 0 0 4px; font-size: 15px; font-weight: 800; color: var(--tk-red); }
.tkp-promo p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--tk-muted); }
.tkp-promo a {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
    border-radius: 10px; background: var(--tk-red); color: #fff !important;
    font-size: 14px; font-weight: 700; text-decoration: none;
}

/* ---------- Tiket ---------- */
.tkp-list { display: grid; gap: 10px; margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.tk {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
    filter: drop-shadow(0 1px 0 var(--tk-shadow)) drop-shadow(0 4px 10px var(--tk-shadow));
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
    -webkit-tap-highlight-color: transparent;
}
.tk:active { transform: scale(0.985); }
.tk-input { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tk-body {
    --stub: 96px;
    position: relative;
    display: grid;
    grid-template-columns: 1fr var(--stub);
    min-height: 80px;
    border-radius: 10px;
    background: var(--tk-paper);
    color: var(--tk-ink);
    transition: background-color 160ms ease-out;
    -webkit-mask:
        radial-gradient(circle 10px at calc(100% - var(--stub)) 0, #0000 97%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle 10px at calc(100% - var(--stub)) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat;
    mask:
        radial-gradient(circle 10px at calc(100% - var(--stub)) 0, #0000 97%, #000) top / 100% 51% no-repeat,
        radial-gradient(circle 10px at calc(100% - var(--stub)) 100%, #0000 97%, #000) bottom / 100% 51% no-repeat;
}
.tk-body::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    right: var(--stub);
    border-left: 2px dashed var(--tk-perf);
}
.tk-main { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; padding: 14px 10px 13px 16px; }
.tk-type {
    font-family: var(--tk-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tk-muted);
}
.tk-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.tk-price { font-size: 22px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.tk-was {
    font-size: 13px;
    font-weight: 600;
    color: var(--tk-muted);
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}
.tk-stub { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 6px; text-align: center; }
.tk-best {
    font-family: var(--tk-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--tk-red);
}
.tk-day { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.tk-day small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0; color: var(--tk-muted); }
.tk-hole {
    position: absolute;
    bottom: 9px;
    right: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--tk-page);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
    transform: scale(0);
    transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
}
.tk-stamp {
    position: absolute;
    z-index: 2;
    top: 9px;
    right: calc(96px + 12px);
    padding: 3px 7px 2px;
    border: 2px solid var(--tk-stamp);
    border-radius: 5px;
    font-family: var(--tk-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    line-height: 1.3;
    color: var(--tk-stamp);
    pointer-events: none;
    opacity: 0;
    transform: rotate(-7deg) scale(1.35);
    transition: opacity 120ms ease-out, transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* Tiket terpilih: merah penuh (light) / navy + bingkai merah (dark) */
.tk-input:checked ~ .tk-body { background: var(--tk-sel-bg); box-shadow: inset 0 0 0 2px var(--tk-red); }
.tk-input:checked ~ .tk-body::before { border-left-color: var(--tk-sel-perf); }
.tk-input:checked ~ .tk-body .tk-price,
.tk-input:checked ~ .tk-body .tk-day,
.tk-input:checked ~ .tk-body .tk-best { color: var(--tk-sel-ink); }
.tk-input:checked ~ .tk-body .tk-type,
.tk-input:checked ~ .tk-body .tk-was,
.tk-input:checked ~ .tk-body .tk-day small { color: var(--tk-sel-muted); }
.tk-input:checked ~ .tk-body .tk-hole { transform: scale(1); }
.tk-input:checked ~ .tk-stamp { opacity: 0.92; transform: rotate(-7deg) scale(1); }
.tk-input:focus-visible ~ .tk-body { outline: 2px solid var(--tk-red); outline-offset: 3px; }

.tkp-empty {
    margin: 18px 0 0;
    padding: 16px;
    border-radius: 12px;
    background: var(--tk-paper);
    font-size: 14px;
    line-height: 1.5;
    color: var(--tk-muted);
}

/* ---------- Baris link (trial / voucher) ---------- */
.tkp-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    margin: 12px 0 0;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--tk-paper);
    box-shadow: inset 0 0 0 1px var(--tk-line);
    color: var(--tk-ink) !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
}
.tkp-link span { flex: 1; }
.tkp-link .lucide-icon:last-child { color: var(--tk-muted); }
.tkp-link:active { transform: scale(0.99); }

/* ---------- Yang kamu dapat ---------- */
.tkp-fine {
    margin: 24px 0 0;
    padding: 16px 16px 6px;
    border-radius: 10px;
    background: var(--tk-paper);
    box-shadow: inset 0 0 0 1px var(--tk-line);
}
.tkp-fine h2 {
    margin: 0 0 10px;
    font-family: var(--tk-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tk-muted);
}
.tkp-fine ol { list-style: none; margin: 0; padding: 0; counter-reset: tkf; }
.tkp-fine li {
    counter-increment: tkf;
    display: grid;
    grid-template-columns: 28px 1fr;
    padding: 9px 0;
    border-top: 1px dashed var(--tk-line);
    font-size: 14px;
    line-height: 1.45;
    color: var(--tk-ink);
}
.tkp-fine li:first-child { border-top: 0; }
.tkp-fine li::before {
    content: counter(tkf, decimal-leading-zero);
    padding-top: 2px;
    font-family: var(--tk-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--tk-red);
}
.tkp-fine li b { font-weight: 700; }
.tkp-fine li span { color: var(--tk-muted); }

/* ---------- FAQ (details/summary) ---------- */
.tkp-faq { margin: 18px 0 0; }
.tkp-faq details { border-top: 1px solid var(--tk-line); }
.tkp-faq details:last-child { border-bottom: 1px solid var(--tk-line); }
.tkp-faq summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 12px 2px;
    list-style: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--tk-ink);
}
.tkp-faq summary::-webkit-details-marker { display: none; }
.tkp-faq summary span { flex: 1; }
.tkp-faq summary .lucide-icon { color: var(--tk-muted); transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1); }
.tkp-faq details[open] summary .lucide-icon { transform: rotate(180deg); }
.tkp-faq p { max-width: 60ch; margin: 0; padding: 0 2px 14px; font-size: 14px; line-height: 1.6; color: var(--tk-muted); }

/* ---------- CTA nempel di atas bottom menu ---------- */
.tkp-cta {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1000;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 10px 15px 12px;
    background: var(--tk-paper);
    box-shadow: 0 -1px 0 var(--tk-line), 0 -6px 16px rgba(0, 0, 0, 0.05);
}
body.is-webview .tkp-cta { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) {
    .tkp-cta { max-width: 600px; margin-left: auto; margin-right: auto; }
}
.tkp-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 14px;
    background: var(--tk-red);
    color: #fff !important;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none !important;
    transition: background-color 150ms ease-out, transform 120ms ease-out;
}
.tkp-cta-btn:hover { background: var(--tk-red-press); }
.tkp-cta-btn:active { transform: scale(0.98); }
.tkp-cta-btn:focus-visible { outline: 2px solid var(--tk-red); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .tk, .tk-body, .tk-hole, .tk-stamp, .tkp-faq summary .lucide-icon, .tkp-cta-btn { transition: none; }
}
