/* ============================================================
   MARS DATA SUPER APP — STYLE v3.5.0 (TOSCA BRANDING)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background: #E2E8F0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ---- APP SHELL ---- */
#app {
    --primary: #00A99D;      /* TOSCA UTAMA */
    --secondary: #FF8C00;    
    --text-dark: #1E293B;    
    --gray: #64748B;         
    --bg-app: #F8FAFC;       
    --surface: #FFFFFF;      
    --border: #E2E8F0;       
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --shadow-sm: 0 4px 12px rgba(0, 169, 157, 0.05); /* Shadow Tosca */
    --shadow-md: 0 8px 24px rgba(0, 169, 157, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 169, 157, 0.12);

    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100dvh;
    background: var(--bg-app);
    overflow: hidden;
}

/* Logic frame khusus dibuka di PC Desktop saja */
@media (min-width: 1024px) {
    html, body { display: flex; justify-content: center; align-items: center; }
    #app {
        position: relative;
        width: 414px; 
        height: min(896px, 95dvh);
        border-radius: 44px;
        border: 10px solid #FFFFFF;
        box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 40px 80px rgba(0,0,0,.2);
        overflow: hidden;
        margin: auto;
    }
}

/* ---- SCREENS (Motif Dotted Pattern Halus Tosca) ---- */
.screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: var(--bg-app);
    background-image: radial-gradient(rgba(0,169,157,0.04) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; animation: slideUp .28s cubic-bezier(.4,0,.2,1) forwards; }
.screen::-webkit-scrollbar { display: none; }
.screen > * { flex-shrink: 0; }

.has-bottom-nav { 
    padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; 
}

/* ---- ANIMATIONS ---- */
@keyframes slideUp  { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes floatY   { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes spin     { to { transform:rotate(360deg); } }
@keyframes pulse    { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes popIn    { from{opacity:0;transform:scale(.85) translateY(20px)} to{opacity:1;transform:scale(1) translateY(0)} }

.animate-spin  { animation: spin 1s linear infinite; display:inline-block; }
.animate-pulse { animation: pulse 1.5s ease infinite; }

/* ---- BUTTONS ---- */
.btn-main {
    width:100%; padding:16px 20px;
    background: var(--primary); color: white;
    border: none; border-radius: 14px;
    font-weight: 800; font-size: 15px;
    cursor: pointer; transition: .18s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 6px 20px rgba(0,169,157,.25);
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-main:active { transform: scale(.97); box-shadow: none; }
.btn-main.btn-orange {
    background: var(--secondary);
    box-shadow: 0 6px 20px rgba(255,140,0,.3);
}
.btn-main.secondary {
    background: white; color: var(--primary);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ---- AUTH TABS ---- */
.auth-tab { 
    flex: 1; text-align: center; padding: 12px; font-size: 14px; 
    font-weight: 800; color: var(--gray); cursor: pointer; 
    border-radius: 10px; transition: .2s; 
}
.auth-tab.active { 
    background: white; color: var(--primary); 
    box-shadow: 0 2px 8px rgba(0,0,0,.05); 
}

/* ---- INPUTS ---- */
.input-group { margin-bottom: 18px; flex-shrink: 0; }
.input-group label { display:block; font-size:12px; font-weight:800; color:var(--primary); margin-bottom:8px; letter-spacing:.3px; text-transform:uppercase; }
.input-box {
    display: flex; align-items: center;
    border: 1.5px solid var(--border); border-radius: 13px;
    padding: 0 16px; background: white;
    transition: .18s; overflow: hidden;
}
.input-box i { font-size: 22px; color: var(--gray); flex-shrink: 0; }
.input-box input, .input-box select {
    flex: 1; padding: 15px 12px;
    border: none; background: transparent; outline: none;
    font-size: 14px; font-weight: 600; color: var(--text-dark);
    width: 100%; -webkit-appearance: none;
}
.input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0,169,157,.1); }

/* ---- HEADER ---- */
.header-page {
    display: flex; align-items: center;
    padding: 14px 20px;
    background: white;
    position: sticky; top: 0; z-index: 30;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.header-page i { font-size: 24px; cursor: pointer; color: var(--primary); transition: .15s; }
.header-page i:active { opacity:.6; }
.header-page h2 { flex:1; text-align:center; font-size:16px; font-weight:800; color:var(--primary); }
.header-page .header-right { min-width:24px; }

/* ---- TOP HEADER (HOME) ---- */
.top-header {
    position: relative;
    background: linear-gradient(135deg, #00A99D 0%, #00796B 100%);
    padding: 24px 20px 96px 20px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    flex-shrink: 0;
    overflow: hidden;
}
.top-header::after {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 24px 24px; z-index: 1; pointer-events: none;
}
@supports (padding-top: env(safe-area-inset-top)) {
    .top-header { padding-top: calc(24px + env(safe-area-inset-top)); }
    #bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}
.top-header-bg {
    position: absolute; right: -30px; top: -20px;
    width: 200px; height: 200px;
    background-size: contain; opacity: .07; filter: brightness(0) invert(1);
    pointer-events: none; z-index: 1; transform: rotate(-10deg);
}
.logo-title {
    display: flex; align-items: center; justify-content: flex-start;
}
.bell-icon { color: white; font-size: 28px; position: relative; cursor: pointer; z-index:5; }
.bell-badge {
    position: absolute; top: -2px; right: -3px; background: var(--danger); min-width: 16px; height: 16px;
    border-radius: 8px; font-size: 9px; font-weight: 800; display: flex; justify-content: center; align-items: center;
    padding: 0 3px; border: 2px solid #00A99D; color: white;
}

/* ---- HERO SCROLL (Saldo Card) & Graphic Elements ---- */
.hero-scroll {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    padding: 0 20px; gap: 14px; margin-top: -68px; position: relative; z-index: 5;
    scrollbar-width: none; flex-shrink: 0;
}
.hero-scroll::-webkit-scrollbar { display: none; }
.hero-card {
    flex: 0 0 auto; width: 280px; border-radius: 24px; padding: 22px;
    scroll-snap-align: center; position: relative; overflow: hidden;
    min-height: 150px; box-shadow: var(--shadow-lg);
}

.saldo-card { 
    background: url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='160' cy='160' r='140' stroke='white' stroke-opacity='0.08' stroke-width='20'/%3E%3Ccircle cx='160' cy='160' r='100' stroke='white' stroke-opacity='0.08' stroke-width='20'/%3E%3Ccircle cx='160' cy='160' r='60' stroke='white' stroke-opacity='0.08' stroke-width='20'/%3E%3C/svg%3E") no-repeat bottom right, linear-gradient(135deg, #00A99D, #00796B); 
    color: white; 
    z-index: 1;
}
.promo-card { 
    background: url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='160' cy='160' r='140' stroke='white' stroke-opacity='0.15' stroke-width='20'/%3E%3Ccircle cx='160' cy='160' r='100' stroke='white' stroke-opacity='0.15' stroke-width='20'/%3E%3Ccircle cx='160' cy='160' r='60' stroke='white' stroke-opacity='0.15' stroke-width='20'/%3E%3C/svg%3E") no-repeat bottom right, linear-gradient(135deg, #FF8C00, #FFA333); 
    color: white; 
    z-index: 1;
}

.btn-pill {
    background: var(--secondary); color: white; padding: 10px 18px; border-radius: 20px;
    font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; transition: .15s; border: none; box-shadow: 0 4px 12px rgba(255,140,0,.3);
}
.btn-pill:active { transform: scale(.95); }

/* ---- QUICK ACTIONS ---- */
.quick-actions {
    background: white; border-radius: 24px; padding: 22px 14px;
    display: flex; justify-content: space-around; margin: 24px 20px 0;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); flex-shrink: 0;
}
.qa-item {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    font-size: 11px; font-weight: 800; color: var(--text-dark); cursor: pointer; transition: .15s; flex: 1; line-height: 1.2;
}
.qa-item:active { transform: scale(.93); }
.qa-icon {
    width: 52px; height: 52px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    font-size: 24px; transition: .15s;
}
.qa-icon.solid { background: rgba(0,169,157,.08); color: var(--primary); }

/* ---- SECTION HEADER ---- */
.section-head { display: flex; justify-content: space-between; align-items: center; padding: 24px 20px 14px; flex-shrink: 0; }
.sec-title { font-size: 14px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: .4px; }
.sec-link  { font-size: 13px; font-weight: 700; color: var(--gray); cursor: pointer; }

/* ---- VOUCHER LIST ---- */
.voucher-list {
    display: flex; overflow-x: auto; gap: 12px; padding: 0 20px 16px;
    scrollbar-width: none; scroll-snap-type: x mandatory; flex-shrink: 0;
}
.voucher-list::-webkit-scrollbar { display: none; }
.v-card {
    flex: 0 0 auto; width: 140px; background: white; border-radius: 18px; padding: 20px 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; box-shadow: var(--shadow-sm); cursor: pointer; border: 1.5px solid var(--border);
    transition: .18s; scroll-snap-align: start;
}
.v-card:active { transform: scale(.95); border-color: var(--primary); }
.v-title { font-size: 12px; font-weight: 800; color: var(--text-dark); margin-top: 10px; line-height: 1.3; }
.v-sub   { font-size: 10px;  font-weight: 600; color: var(--gray); line-height: 1.3; margin-top: 4px; }

/* ---- PPOB GRID ---- */
.ppob-wrapper {
    background: white; border-radius: 24px; padding: 24px 16px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin: 0 20px 20px; flex-shrink: 0;
}
.ppob-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px 10px; 
    margin-top: 16px; 
    justify-items: center; 
    align-items: start; 
}
.p-item { 
    width: 100%;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
    cursor: pointer; 
    transition: .15s; 
    vertical-align: top; 
    overflow: hidden;
}
.p-item:active { transform: scale(.93); opacity:.7; }
.p-icon-wrap {
    width: 52px; height: 52px; border-radius: 16px; display: flex; justify-content: center; align-items: center;
    margin: 0 auto 8px auto !important; font-size: 26px; background: rgba(0,169,157,.08); color: var(--primary);
}
.p-title {
    font-size: 11px; font-weight: 800; color: var(--text-dark); line-height: 1.3; margin-top: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal;
    text-align: center; width: 100%; word-break: break-word;
}
.p-sub {
    font-size: 9px; font-weight: 600; color: var(--gray); line-height: 1.2; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
    text-align: center; width: 100%;
}

/* ---- BANNER CAROUSEL ---- */
.banner-scroll {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px;
    padding: 0 20px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    align-items: flex-start;
}
.banner-scroll::-webkit-scrollbar { display: none; }
.banner-item {
    flex: 0 0 calc(100% - 40px); scroll-snap-align: center; border-radius: 16px;
    height: auto; position: relative; background: transparent; box-shadow: var(--shadow-sm);
}
.banner-item img {
    width: 100%; height: auto; border-radius: 16px; display: block; object-fit: contain;
}

/* ---- BOTTOM NAV ---- */
#bottom-nav {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 76px; background: white;
    border-top-left-radius: 24px; border-top-right-radius: 24px; box-shadow: 0 -4px 20px rgba(0,0,0,.04);
    display: none; justify-content: space-around; align-items: center; z-index: 50; border-top: 1px solid var(--border);
}
.b-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--gray); width: 20%; cursor: pointer; gap: 4px; transition: .18s; height: 100%;
}
.b-item.active { color: var(--primary); }
.b-item i { font-size: 26px; transition: .18s; }
.b-item span { font-size: 10px; font-weight: 800; }
.b-center {
    position: relative; width: 20%; display: flex; flex-direction: column;
    align-items: center; justify-content: flex-end; cursor: pointer; height: 100%; padding-bottom: 12px;
}
.b-fab {
    position: absolute; top: -24px; width: 60px; height: 60px; background: var(--primary); border-radius: 50%;
    display: flex; justify-content: center; align-items: center; color: white; border: 5px solid white;
    box-shadow: 0 6px 16px rgba(0,169,157,.3); z-index: 51; transition: .18s; font-size: 28px;
}
.b-center:active .b-fab { transform: scale(.9); }
.b-center span { font-size: 10px; font-weight: 800; color: var(--primary); z-index: 10; }

/* ---- CARD DETAIL / CHECKOUT ---- */
.card-detail {
    background: white; border-radius: 16px; padding: 20px; border: 1px solid var(--border);
    margin-bottom: 16px; box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.d-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 13px; color: var(--gray); font-weight: 600; }
.d-row:last-child { margin-bottom: 0; }
.d-row .val { font-weight: 800; color: var(--primary); text-align: right; max-width: 60%; line-height: 1.4; }

/* ---- NOMINALS GRID ---- */
.nom-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.nom-box {
    background: white; border: 1.5px solid var(--border); border-radius: 14px; padding: 16px 12px;
    text-align: center; cursor: pointer; transition: .18s;
}
.nom-box:active { transform: scale(.96); }
.nom-box.active { border-color: var(--primary); background: rgba(0,169,157,.05); box-shadow: 0 0 0 3px rgba(0,169,157,.1); }
.nom-box h4 { font-size: 15px; font-weight: 800; color: var(--text-dark); margin-bottom: 4px; }
.nom-box p  { font-size: 12px; color: var(--gray); font-weight: 600; }

/* ---- PIN PAD ---- */
.pin-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--border); transition: .18s; }
.pin-dot.filled { background: var(--primary); transform: scale(1.3); }
.p-btn {
    width: 76px; height: 76px; border-radius: 50%; border: none; background: transparent;
    font-size: 28px; font-weight: 800; cursor: pointer; color: var(--primary); transition: .12s;
    display: flex; justify-content: center; align-items: center;
}
.p-btn:active { background: rgba(0,169,157,.1); transform: scale(.9); }

/* ---- PAYMENT METHOD CARD ---- */
.pay-method-card {
    background: white; border: 1.5px solid var(--border); border-radius: 16px; padding: 18px;
    display: flex; align-items: center; gap: 16px; cursor: pointer; transition: .18s; margin-bottom: 12px;
}
.pay-method-card.active { border-color: var(--primary); background: rgba(0,169,157,.05); }
.pay-method-card:active { transform: scale(.98); }

/* ---- MAP / COVERAGE ---- */
#wifi-map { width: 100%; border-radius: 16px; overflow: hidden; }
.coverage-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.coverage-badge.covered   { background: rgba(16,185,129,.12); color: var(--success); }
.coverage-badge.uncovered { background: rgba(239,68,68,.10); color: var(--danger); }

/* ---- WIFI MODE TOGGLE ---- */
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.mode-btn {
    padding: 14px 10px; border-radius: 13px; border: 1.5px solid var(--border); background: white;
    font-size: 13px; font-weight: 800; color: var(--gray); cursor: pointer; transition: .18s; text-align: center;
}
.mode-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(0,169,157,.05); }
.mode-btn:active { transform: scale(.96); }

/* ---- VOUCHER RESULT CARD ---- */
.voucher-result {
    background: linear-gradient(135deg, var(--primary), #00796B); border-radius: 20px; padding: 24px;
    color: white; text-align: center; box-shadow: var(--shadow-lg); flex-shrink: 0;
    animation: popIn .4s cubic-bezier(.4,0,.2,1) forwards;
}
.voucher-code {
    font-size: 32px; font-weight: 900; letter-spacing: 4px; background: rgba(255,255,255,.2); border-radius: 12px;
    padding: 12px 20px; margin: 14px 0; font-family: monospace;
}
.voucher-pass { font-size: 22px; font-weight: 800; letter-spacing: 3px; color: #FFF; font-family: monospace; }

/* ---- HISTORY LAYOUT REVISED ---- */
.hist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    background: white;
    border-bottom: 1px solid var(--border);
    transition: .15s;
}
.hist-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    flex-shrink: 0;
}
.hist-info {
    flex: 1; 
    min-width: 0; 
}
.hist-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-sub {
    font-size: 12px;
    color: var(--gray);
    font-weight: 600;
}
.hist-right {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.hist-amount {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 4px;
}

/* ---- MISC ---- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.mars-toast {
    position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: rgba(30,41,59,.95); color: white; padding: 14px 24px; border-radius: 12px;
    font-size: 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 9999; opacity: 0; transition: all .3s cubic-bezier(.4,0,.2,1); white-space: nowrap;
}
.mars-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 800; }
.badge-success { background: rgba(16,185,129,.15); color: var(--success); }
.badge-pending { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-failed  { background: rgba(239,68,68,.12); color: var(--danger); }
.notif-item { display: flex; gap: 14px; padding: 18px 20px; background: white; border-bottom: 1px solid var(--border); transition: .15s; }
.notif-item.unread { background: rgba(0,169,157,.03); }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 6px; }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }