/* =========================================
   Settings — uses shared theme variables from app.css
========================================= */

body{background:var(--bg);color:var(--text)}

.settings-container{
    width:100%;
    max-width:760px;
    margin:0 auto;
    padding:36px 0 60px;
}

.page-heading h1{
    font-size:26px;
    font-weight:700;
    letter-spacing:-.6px;
}

.back-link{
    display:inline-flex;
    align-items:center;
    gap:5px;
    color:var(--muted);
    text-decoration:none;
    font-size:12px;
    font-weight:600;
    margin-bottom:14px;
    transition:.15s;
}

.back-link:hover{color:var(--text)}
.back-link:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}

.page-heading p{
    margin-top:6px;
    color:var(--muted);
    font-size:14px;
}

/* =========================================
   Tabs
========================================= */

.tabs{
    display:flex;
    gap:4px;
    margin-top:26px;
    padding-bottom:2px;
    border-bottom:1px solid var(--border);
}

.tab{
    padding:10px 4px;
    margin-right:22px;
    border:0;
    background:none;
    color:var(--muted);
    font:600 13px "Inter",sans-serif;
    cursor:pointer;
    position:relative;
    transition:.15s;
}

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

.tab.active{color:var(--text)}

.tab.active::after{
    content:"";
    position:absolute;
    left:0;right:0;bottom:-1px;
    height:2px;
    background:var(--text);
    border-radius:2px;
}

.tab:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:6px}

.tab-panel{
    display:flex;
    flex-direction:column;
    gap:16px;
    margin-top:24px;
}

/* =========================================
   Panel Card
========================================= */

.panel-card{
    background:var(--bg);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:26px;
}

.panel-card-head h2{
    font-size:16px;
    font-weight:600;
    letter-spacing:-.2px;
}

.panel-card-head p{
    margin-top:5px;
    color:var(--muted);
    font-size:12px;
}

/* =========================================
   Forms
========================================= */

.settings-form{
    margin-top:20px;
    display:flex;
    flex-direction:column;
    gap:14px;
}

.form-row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
}

.field{display:flex;flex-direction:column;gap:7px}

.field span{
    color:var(--soft);
    font-size:11px;
    font-weight:600;
}

.field input{
    height:42px;
    padding:0 13px;
    border:1px solid var(--border);
    border-radius:9px;
    background:var(--surface);
    color:var(--text);
    outline:none;
    font:500 13px "Inter",sans-serif;
    transition:.15s;
}

.field input:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
    background:var(--bg);
}

.field input:disabled{
    color:var(--muted);
    cursor:not-allowed;
}

.btn-settings{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:40px;
    padding:0 18px;
    border:1px solid var(--border);
    border-radius:9px;
    background:var(--bg);
    color:var(--soft);
    font:600 12px "Inter",sans-serif;
    cursor:pointer;
    align-self:flex-start;
    transition:.15s;
}

.btn-settings:hover:not(:disabled){border-color:var(--border-strong);color:var(--text)}
.btn-settings:disabled{opacity:.5;cursor:not-allowed}
.btn-settings:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.btn-settings.primary{
    background:var(--text);
    border-color:var(--text);
    color:var(--bg);
}
.btn-settings.primary:hover:not(:disabled){opacity:.88}

/* =========================================
   Billing — Plan Summary
========================================= */

.plan-summary{
    margin-top:18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:18px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:12px;
    flex-wrap:wrap;
}

.plan-summary>div{display:flex;flex-direction:column;gap:6px}

.plan-name{font-size:16px;font-weight:700}

.plan-credits{color:var(--muted);font-size:12px}

.billing-links{
    margin-top:18px;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.billing-link{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:16px 18px;
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--surface);
    text-decoration:none;
    transition:.15s;
}

.billing-link:hover{
    border-color:var(--border-strong);
    background:var(--surface-2);
}

.billing-link:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.billing-link-title{
    display:block;
    color:var(--text);
    font-size:13px;
    font-weight:600;
}

.billing-link-desc{
    display:block;
    margin-top:3px;
    color:var(--muted);
    font-size:11px;
}

.billing-link-arrow{
    flex-shrink:0;
    color:var(--muted);
    font-size:15px;
    transition:.15s;
}

.billing-link:hover .billing-link-arrow{
    color:var(--accent);
    transform:translateX(2px);
}

/* Monthly/Yearly toggle */
.billing-toggle{
    display:inline-flex;
    align-self:center;
    gap:2px;
    padding:4px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:999px;
    margin:0 auto;
}

.toggle-option{
    display:flex;
    align-items:center;
    gap:7px;
    padding:8px 18px;
    border:0;
    border-radius:999px;
    background:transparent;
    color:var(--muted);
    font:600 12px "Inter",sans-serif;
    cursor:pointer;
    transition:.15s;
}

.toggle-option.active{
    background:var(--bg);
    color:var(--text);
    box-shadow:0 1px 3px rgba(13,13,13,.08);
}

.toggle-option:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.save-badge{
    padding:2px 7px;
    border-radius:999px;
    background:var(--accent-soft);
    color:var(--accent);
    font-size:9px;
    font-weight:700;
    text-transform:uppercase;
}

/* =========================================
   Billing — Top Up
========================================= */

.topup-box{
    margin-top:18px;
    display:flex;
    flex-direction:column;
    gap:14px;
    max-width:360px;
}

.amount-input{
    display:flex;
    align-items:center;
    border:1px solid var(--border);
    border-radius:9px;
    background:var(--surface);
    transition:.15s;
}

.amount-input:focus-within{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
    background:var(--bg);
}

.currency-prefix{
    padding:0 0 0 13px;
    color:var(--muted);
    font-size:13px;
    font-weight:600;
}

.amount-input input{
    flex:1;
    height:42px;
    padding:0 13px;
    border:0;
    background:transparent;
    color:var(--text);
    outline:none;
    font:600 14px "Inter",sans-serif;
    -moz-appearance:textfield;
}

.amount-input input::-webkit-outer-spin-button,
.amount-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}

.topup-preview{
    padding:12px 14px;
    background:var(--accent-soft);
    border:1px solid var(--accent-border);
    border-radius:9px;
    color:var(--accent);
    font-size:12px;
    font-weight:600;
    line-height:1.5;
}

.topup-preview.invalid{
    background:rgba(192,57,43,.06);
    border-color:rgba(192,57,43,.25);
    color:#c0392b;
}

.topup-quick{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.quick-amount{
    padding:7px 13px;
    border:1px solid var(--border);
    border-radius:999px;
    background:var(--bg);
    color:var(--soft);
    font:600 11px "Inter",sans-serif;
    cursor:pointer;
    transition:.15s;
}

.quick-amount:hover{border-color:var(--border-strong);color:var(--text)}
.quick-amount.active{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.quick-amount:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.topup-submit{width:100%;justify-content:center}

.topup-note{
    color:var(--muted);
    font-size:11px;
    line-height:1.6;
}

/* =========================================
   Billing — Plan Grid
========================================= */

.plan-grid{
    margin-top:18px;
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:12px;
}

.plan-option{
    position:relative;
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:20px;
    border:1px solid var(--border);
    border-radius:14px;
    background:var(--surface);
}

.plan-option.featured{
    border-color:var(--accent-border);
    background:var(--accent-soft);
}

.plan-badge{
    position:absolute;
    top:-10px;
    right:16px;
    padding:4px 9px;
    border-radius:999px;
    background:var(--accent);
    color:#fff;
    font-size:9px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.4px;
}

.plan-option-name{font-size:14px;font-weight:700}

.plan-option-price{font-size:22px;font-weight:700;letter-spacing:-.5px}
.plan-option-price small{font-size:12px;font-weight:500;color:var(--muted)}

.plan-savings{
    display:inline-block;
    margin-top:-4px;
    color:var(--success);
    font-size:11px;
    font-weight:600;
}

.plan-savings.muted{color:var(--muted)}

.plan-option ul{
    display:flex;
    flex-direction:column;
    gap:7px;
    margin:4px 0 6px;
    list-style:none;
}

.plan-option li{
    font-size:12px;
    color:var(--soft);
    padding-left:16px;
    position:relative;
}

.plan-option li::before{
    content:"✓";
    position:absolute;
    left:0;
    color:var(--accent);
    font-weight:700;
}

.plan-option .btn-settings{width:100%;justify-content:center;align-self:stretch}

.manual-pay-link{
    display:block;
    text-align:center;
    margin-top:8px;
    color:var(--muted);
    font-size:11px;
    font-weight:600;
    text-decoration:none;
}
.manual-pay-link:hover{color:var(--accent)}

/* =========================================
   Transaction History
========================================= */

.history-list{margin-top:18px}

.history-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:14px 0;
    border-bottom:1px solid var(--border);
}

.history-item:last-child{border-bottom:0}

.history-info{display:flex;flex-direction:column;gap:4px;min-width:0}

.history-remarks{
    font-size:13px;
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.history-status{
    display:inline-block;
    margin-left:7px;
    padding:2px 7px;
    border-radius:999px;
    font-size:9px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.3px;
    vertical-align:middle;
}

.history-status.pending{
    background:rgba(180,140,20,.12);
    color:#a8790f;
}

.history-status.failed{
    background:rgba(192,57,43,.1);
    color:#c0392b;
}

.history-date{color:var(--muted);font-size:11px}

.history-amount{
    flex-shrink:0;
    font-size:13px;
    font-weight:700;
}

.history-amount.credit{color:var(--success)}
.history-amount.debit{color:#c0392b}

.loading, .empty{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:36px 10px;
    color:var(--muted);
    font-size:12px;
    text-align:center;
}

/* =========================================
   Push notification toggle
========================================= */

.push-toggle-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:14px 18px;
    cursor:pointer;
}

.push-toggle-row span:first-child{
    font-size:13.5px;
    color:var(--text);
    line-height:1.5;
}

.switch{
    position:relative;
    display:inline-block;
    width:44px;
    height:26px;
    flex-shrink:0;
}

.switch input{
    position:absolute;
    opacity:0;
    width:100%;
    height:100%;
    margin:0;
    cursor:pointer;
    z-index:1;
}

.switch-track{
    position:absolute;
    inset:0;
    background:var(--border);
    border-radius:999px;
    transition:background .15s ease;
}

.switch-track::before{
    content:"";
    position:absolute;
    top:3px;
    left:3px;
    width:20px;
    height:20px;
    background:#fff;
    border-radius:50%;
    box-shadow:0 1px 3px rgba(0,0,0,.25);
    transition:transform .15s ease;
}

.switch input:checked + .switch-track{
    background:var(--accent);
}

.switch input:checked + .switch-track::before{
    transform:translateX(18px);
}

.switch input:disabled + .switch-track{
    opacity:.5;
    cursor:not-allowed;
}

@media(max-width:680px){
    .settings-container{padding:22px 0 40px}
    .form-row{grid-template-columns:1fr}
    .plan-grid{grid-template-columns:1fr}
    .plan-summary{flex-direction:column;align-items:flex-start}
    .plan-summary .btn-settings{align-self:stretch;justify-content:center}
    .tabs{overflow-x:auto;white-space:nowrap}
}
