/* ── Top Up / Pay Bill Widget ──────────────────────────────────────────────── */

:root {
    --tpb-primary: #FF6B00;
    --tpb-primary-dark: #E05E00;
    --tpb-primary-light: #FFF3EC;
    --tpb-border: #E0E0E0;
    --tpb-text: #111111;
    --tpb-muted: #777777;
    --tpb-error: #D93025;
}

/* ── Banner ─────────────────────────────────────────────────────────────────── */
.tpb-banner {
    background: linear-gradient(120deg, #CC5500 0%, #FF8C00 55%, #FFAC40 100%);
    padding: 0;
    overflow: hidden;
    margin-bottom: 0;
}
.tpb-banner__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 160px;
    padding-top: 32px;
    padding-bottom: 32px;
    gap: 24px;
}
.tpb-banner__content { flex: 1; }
.tpb-banner__title { font-size: 32px; font-weight: 700; color: #fff; margin: 0 0 8px; }
.tpb-banner__subtitle { font-size: 15px; color: rgba(255,255,255,.88); margin: 0; }
.tpb-banner__img {
    flex-shrink: 0;
    width: 180px;
    height: 160px;
    background: url('/images/tpb-banner-person.png') center bottom / contain no-repeat;
    opacity: .9;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.tpb-wrap { background: #F5F5F5; padding-bottom: 60px; }
.tpb-card {
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    padding: 36px 40px 40px;
    max-width: 860px;
    margin: 0 auto;
}

/* ── Form groups ─────────────────────────────────────────────────────────────── */
.tpb-form-group { margin-bottom: 24px; }
.tpb-form-group--checkbox { margin-bottom: 12px; }
.tpb-label { display: block; font-size: 14px; font-weight: 600; color: var(--tpb-text); margin-bottom: 10px; }
.tpb-req { color: var(--tpb-primary); }
.tpb-section-label { font-size: 15px; font-weight: 700; color: var(--tpb-text); margin-bottom: 14px; }

/* ── Inputs ─────────────────────────────────────────────────────────────────── */
.tpb-input {
    width: 100%; padding: 12px 16px;
    border: 1.5px solid var(--tpb-border);
    border-radius: 8px; font-size: 15px;
    color: var(--tpb-text); outline: none;
    transition: border-color .15s; background: #fff;
    box-sizing: border-box;
}
.tpb-input:focus { border-color: var(--tpb-primary); }
.tpb-input:disabled { background: #F5F5F5; color: #999; cursor: not-allowed; }
.tpb-input.is-error { border-color: var(--tpb-error); }

.tpb-input-group { display: flex; align-items: stretch; }
.tpb-input-group .tpb-input { border-radius: 0 8px 8px 0; border-left: none; flex: 1; }
.tpb-input-prefix {
    display: flex; align-items: center; padding: 0 14px;
    background: #F5F5F5; border: 1.5px solid var(--tpb-border);
    border-right: none; border-radius: 8px 0 0 8px;
    font-size: 14px; color: #555; font-weight: 500; white-space: nowrap;
}

/* ── Select ─────────────────────────────────────────────────────────────────── */
.tpb-select {
    width: 100%; padding: 12px 40px 12px 16px;
    border: 1.5px solid var(--tpb-border);
    border-radius: 8px; font-size: 15px;
    color: var(--tpb-text); outline: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    cursor: pointer; transition: border-color .15s;
}
.tpb-select:focus { border-color: var(--tpb-primary); }

/* ── Radio buttons ──────────────────────────────────────────────────────────── */
.tpb-radio-group { display: flex; align-items: center; gap: 28px; }
.tpb-radio-label {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 15px; color: #333; user-select: none;
}
.tpb-radio { display: none; }
.tpb-radio-custom {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid #ccc; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s;
    position: relative;
}
.tpb-radio:checked + .tpb-radio-custom { border-color: var(--tpb-primary); border-width: 2px; }
.tpb-radio:checked + .tpb-radio-custom::after {
    content: '';
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--tpb-primary);
    position: absolute;
}

/* ── Payment method cards ───────────────────────────────────────────────────── */
.tpb-payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tpb-method-card {
    border: 1.5px solid var(--tpb-border); border-radius: 10px;
    padding: 20px 16px 16px; cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    display: flex; flex-direction: column; gap: 10px;
    background: #fff;
}
.tpb-method-card:hover { border-color: var(--tpb-primary); box-shadow: 0 2px 8px rgba(255,107,0,.1); }
.tpb-method-card.is-selected { border-color: var(--tpb-primary); box-shadow: 0 2px 10px rgba(255,107,0,.15); }
.tpb-method-card__icon { color: #ccc; transition: color .15s; }
.tpb-method-card.is-selected .tpb-method-card__icon { color: var(--tpb-primary); }
.tpb-method-card__label { font-size: 13px; font-weight: 600; color: #555; line-height: 1.3; transition: color .15s; }
.tpb-method-card.is-selected .tpb-method-card__label { color: var(--tpb-primary); }

/* ── Custom searchable dropdown ─────────────────────────────────────────────── */
.tpb-dd { position: relative; }

.tpb-dd__trigger {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 16px; background: #fff;
    border: 1.5px solid var(--tpb-border); border-radius: 8px;
    font-size: 15px; color: #aaa; cursor: pointer;
    text-align: left; transition: border-color .15s;
}
.tpb-dd__trigger:focus { outline: none; border-color: var(--tpb-primary); }
.tpb-dd__trigger.has-value { color: var(--tpb-text); }
.tpb-dd__trigger.is-open { border-color: var(--tpb-primary); border-radius: 8px 8px 0 0; border-bottom-color: transparent; }
.tpb-dd__value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpb-dd__chevron { flex-shrink: 0; color: #aaa; transition: transform .2s; }
.tpb-dd__trigger.is-open .tpb-dd__chevron { transform: rotate(180deg); }

.tpb-dd__panel {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border: 1.5px solid var(--tpb-primary);
    border-top: none; border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 100; overflow: hidden;
}

.tpb-dd__search-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid #F0F0F0;
}
.tpb-dd__search {
    flex: 1; border: none; outline: none;
    font-size: 14px; color: var(--tpb-text);
    background: transparent;
}
.tpb-dd__search::placeholder { color: #aaa; }

.tpb-dd__list { max-height: 260px; overflow-y: auto; }

.tpb-dd__item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; cursor: pointer;
    border-bottom: 1px solid #F5F5F5;
    transition: background .1s;
}
.tpb-dd__item:last-child { border-bottom: none; }
.tpb-dd__item:hover { background: #FFF8F4; }
.tpb-dd__item.is-selected { background: var(--tpb-primary-light); }
.tpb-dd__item.is-disabled { opacity: .4; pointer-events: none; }

.tpb-dd__item-logo {
    width: 36px; height: 36px; border-radius: 50%;
    flex-shrink: 0; object-fit: contain;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    overflow: hidden;
}
.tpb-dd__item-logo img { width: 100%; height: 100%; object-fit: contain; }
.tpb-dd__item-name { font-size: 14px; color: var(--tpb-text); font-weight: 500; }
.tpb-dd__item-badge { font-size: 11px; color: #aaa; margin-left: auto; }

.tpb-dd__empty { padding: 16px; text-align: center; font-size: 13px; color: #aaa; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.tpb-divider { border: none; border-top: 1px solid #EEEEEE; margin: 28px 0; }

/* ── Checkbox ───────────────────────────────────────────────────────────────── */
.tpb-checkbox-label {
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer; font-size: 14px; color: #333; line-height: 1.6;
}
.tpb-checkbox { display: none; }
.tpb-checkbox-custom {
    width: 18px; height: 18px; flex-shrink: 0;
    border: 2px solid #ccc; border-radius: 4px; margin-top: 3px;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, background .15s;
}
.tpb-checkbox:checked + .tpb-checkbox-custom { background: var(--tpb-primary); border-color: var(--tpb-primary); }
.tpb-checkbox:checked + .tpb-checkbox-custom::after {
    content: ''; display: block;
    width: 5px; height: 9px;
    border: 2px solid #fff; border-top: none; border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}
.tpb-checkbox-label a { color: var(--tpb-primary); text-decoration: underline; }

/* ── Notification ───────────────────────────────────────────────────────────── */
.tpb-notification-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 12px; }
.tpb-notification-col { display: flex; flex-direction: column; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.tpb-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 13px 40px; background: var(--tpb-primary); color: #fff;
    border: none; border-radius: 50px; font-size: 15px; font-weight: 700;
    cursor: pointer; transition: background .15s;
}
.tpb-btn-primary:hover { background: var(--tpb-primary-dark); }
.tpb-btn-primary:disabled { opacity: .5; pointer-events: none; }
.tpb-btn-primary--full { width: 100%; justify-content: center; }

.tpb-form-actions { display: flex; justify-content: center; margin-top: 8px; }

/* ── Field error ────────────────────────────────────────────────────────────── */
.tpb-field-error { font-size: 12px; color: var(--tpb-error); margin-top: 6px; min-height: 16px; }

/* ── Loading ────────────────────────────────────────────────────────────────── */
.tpb-loading-inline { display: flex; align-items: center; gap: 8px; color: #888; font-size: 13px; padding: 20px 16px; }

/* ── Spinners ───────────────────────────────────────────────────────────────── */
.tpb-spinner-sm {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: tpb-spin .6s linear infinite;
}
.tpb-spinner-lg {
    width: 44px; height: 44px;
    border: 4px solid #EEE; border-top-color: var(--tpb-primary);
    border-radius: 50%; animation: tpb-spin .8s linear infinite; margin: 0 auto 20px;
}
@keyframes tpb-spin { to { transform: rotate(360deg); } }

/* ── Processing ─────────────────────────────────────────────────────────────── */
.tpb-processing { text-align: center; padding: 60px 20px; }
.tpb-processing p { color: #555; margin-bottom: 8px; }
.tpb-processing__note { font-size: 13px; color: #999; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.tpb-modal {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.tpb-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.tpb-modal__dialog {
    position: relative; background: #fff;
    border-radius: 14px; width: 100%; max-width: 480px;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    display: flex; flex-direction: column;
    max-height: 90vh; overflow: hidden;
}
.tpb-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid #EEE;
}
.tpb-modal__title { font-size: 17px; font-weight: 700; color: var(--tpb-text); }
.tpb-modal__close {
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: #999; padding: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    transition: background .12s;
}
.tpb-modal__close:hover { background: #F5F5F5; color: #333; }
.tpb-modal__body { padding: 24px; overflow-y: auto; flex: 1; }
.tpb-modal__footer { padding: 16px 24px 24px; }

/* Modal confirmation rows */
.tpb-modal-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; padding: 10px 0; border-bottom: 1px solid #F0F0F0; font-size: 14px;
}
.tpb-modal-row:last-child { border-bottom: none; }
.tpb-modal-row__label { color: var(--tpb-muted); flex-shrink: 0; }
.tpb-modal-row__value { font-weight: 600; color: var(--tpb-text); text-align: right; }
.tpb-modal-section-label {
    font-size: 13px; font-weight: 700; color: var(--tpb-muted);
    text-transform: uppercase; letter-spacing: .04em;
    margin: 16px 0 4px;
}

/* ── Custom Select (DSA style) ───────────────────────────────────────────────── */
.tpb-cs { position: relative; user-select: none; }
.tpb-cs__trigger {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; border: 1.5px solid var(--tpb-border); border-radius: 8px;
    padding: 12px 16px; cursor: pointer;
    font-size: 14px; font-weight: 500; color: #999;
    transition: all .3s cubic-bezier(.4,0,.2,1);
}
.tpb-cs__trigger:hover { border-color: var(--tpb-primary); }
.tpb-cs__trigger.has-value { color: var(--tpb-text); }
.tpb-cs__text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpb-cs__arrow {
    border: solid #999; border-width: 0 2px 2px 0;
    display: inline-block; padding: 3px; flex-shrink: 0;
    transform: rotate(45deg);
    transition: all .3s cubic-bezier(.4,0,.2,1);
    margin-left: 10px;
}
.tpb-cs__menu {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: #fff; border-radius: 10px; border: 1px solid #efefef;
    box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 200;
    opacity: 0; visibility: hidden;
    transform: translateY(-15px);
    transition: all .3s cubic-bezier(.4,0,.2,1);
}
.tpb-cs__header {
    padding: 12px 16px; color: #8E95A2; font-size: 13px;
    border-bottom: 1px solid #F2F2F2; font-weight: 500;
}
.tpb-cs__list { max-height: 220px; overflow-y: auto; }
.tpb-cs__list::-webkit-scrollbar { width: 6px; }
.tpb-cs__list::-webkit-scrollbar-track { background: transparent; }
.tpb-cs__list::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 10px; }
.tpb-cs__list::-webkit-scrollbar-thumb:hover { background: #ccc; }
.tpb-cs__option {
    padding: 12px 16px; font-size: 15px; font-weight: 500;
    color: #000; cursor: pointer; transition: background .2s;
    border-bottom: 1px solid #f5f5f5;
}
.tpb-cs__option:last-child { border-bottom: none; }
.tpb-cs__option:hover { background: #f8f9fa; color: var(--tpb-primary); }
.tpb-cs__option.is-active { color: var(--tpb-primary); background: var(--tpb-primary-light); }
.tpb-cs.is-open .tpb-cs__trigger {
    border-color: var(--tpb-primary);
    box-shadow: 0 0 0 3px rgba(255,107,0,.1);
}
.tpb-cs.is-open .tpb-cs__arrow { transform: rotate(-135deg); border-color: var(--tpb-primary); }
.tpb-cs.is-open .tpb-cs__menu { opacity: 1; visibility: visible; transform: translateY(0); }

/* ── Alert / Error Modal ─────────────────────────────────────────────────────── */
.tpb-alert-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.tpb-alert-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.tpb-alert-modal__dialog {
    position: relative; background: #fff;
    border-radius: 20px; width: 100%; max-width: 360px;
    box-shadow: 0 12px 48px rgba(0,0,0,.22);
    padding: 36px 28px 28px;
    text-align: center;
    animation: tpb-alert-in .22s ease;
}
@keyframes tpb-alert-in { from { opacity: 0; transform: scale(.93); } to { opacity: 1; transform: scale(1); } }
.tpb-alert-modal__close {
    position: absolute; top: 14px; right: 16px;
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: #bbb; padding: 0; line-height: 1;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s, color .12s;
}
.tpb-alert-modal__close:hover { background: #F5F5F5; color: #555; }
.tpb-alert-modal__icon-wrap {
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.tpb-alert-modal__icon-wrap img {
    width: 180px; height: auto; display: block;
}
.tpb-alert-modal__title {
    font-size: 17px; font-weight: 700; color: #111;
    margin: 0 0 10px; line-height: 1.35;
}
.tpb-alert-modal__msg {
    font-size: 14px; color: #666;
    margin: 0 0 28px; line-height: 1.5;
}
.tpb-alert-modal__btn {
    width: 50%; padding: 14px;
    background: var(--tpb-primary); color: #fff;
    border: none; border-radius: 50px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    transition: background .15s;
}
.tpb-alert-modal__btn:hover { background: var(--tpb-primary-dark); }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.tpb-toast-container {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    z-index: 99999; display: flex; flex-direction: column; align-items: center; gap: 10px;
    pointer-events: none;
}
.tpb-toast {
    display: flex; align-items: flex-start; gap: 10px;
    min-width: 280px; max-width: 480px; padding: 14px 16px;
    border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.18);
    font-size: 14px; line-height: 1.45; font-weight: 500;
    pointer-events: all; cursor: default;
    animation: tpb-toast-in .25s ease;
}
.tpb-toast.is-hiding { animation: tpb-toast-out .25s ease forwards; }
.tpb-toast--error   { background: #fff1f0; color: #b91c1c; border: 1px solid #fecaca; }
.tpb-toast--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.tpb-toast--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.tpb-toast__icon { flex-shrink: 0; margin-top: 1px; }
.tpb-toast__msg  { flex: 1; }
.tpb-toast__close {
    flex-shrink: 0; background: none; border: none; cursor: pointer;
    font-size: 18px; line-height: 1; padding: 0; margin-left: 4px;
    color: inherit; opacity: .6;
}
.tpb-toast__close:hover { opacity: 1; }
@keyframes tpb-toast-in  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tpb-toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tpb-banner__title { font-size: 24px; }
    .tpb-banner__img { width: 120px; height: 120px; }
    .tpb-card { padding: 24px 16px 32px; border-radius: 0; box-shadow: none; }
    .tpb-notification-row { grid-template-columns: 1fr; }
    .tpb-form-actions { justify-content: stretch; }
    .tpb-btn-primary { width: 100%; }
}

@media (max-width: 480px) {
    .tpb-banner__img { display: none; }
    .tpb-payment-methods { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .tpb-method-card { padding: 14px 6px 12px; }
    .tpb-method-card__label { font-size: 11px; }
}
