/* ============================================================================
 * parent-billing.css   —   Thanh toán & gia hạn
 * ----------------------------------------------------------------------------
 * 🔴 LÁT CẮT CỦA style.css. 11 lát PHẢI nạp ĐÚNG THỨ TỰ trong index.html.
 *    Đổi thứ tự = đổi kết quả đè = lệch giao diện, KHÔNG có lỗi nào báo.
 *    Nối cả 11 lát (bỏ banner này) = style.css gốc TỪNG BYTE.
 *    Kiểm:  node scripts/cut-css.js --verify
 *
 * MỤC LỤC — 353 dòng · 70 rule · 11.8 KB
 *   dòng    15–353    Thanh toán & gia hạn  (70 rule)
 *
 * Bảng tra đầy đủ mọi miền:      docs/BANDO-CSS.md
 * Vì sao cắt kiểu này:           docs/kien-truc/K6-1-so-do-tach-css.md
 * ========================================================================== */
.paywall-overlay.hidden-section { display: none !important; }
.paywall-card {
    max-width: 440px;
    padding-top: 20px;
}
.paywall-logo-wrap { margin-bottom: 8px; }
.paywall-body { text-align: center; }
.paywall-body .acct-exp-badge { margin-bottom: 10px; font-size: 14px; }
.paywall-title {
    margin: 4px 0 6px;
    font-size: 20px;
    color: var(--text-strong);
    font-weight: 800;
}
.paywall-message {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.5;
    color: #5a5a5a;
}
.paywall-info {
    text-align: left;
    background: var(--surface-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 6px 14px;
    margin-bottom: 18px;
}
.paywall-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border-subtle);
    font-size: 15px;
}
.paywall-info-row:last-child { border-bottom: none; }
.paywall-info-label {
    color: var(--text-faint);
    font-weight: 600;
    flex: 0 0 auto;
}
.paywall-info-value {
    color: var(--blue-900);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}
.paywall-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 10px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: filter .15s ease, background .15s ease;
    min-height: 48px;
}
.paywall-btn:active { transform: translateY(1px); }
.paywall-btn-primary {
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    color: var(--text-inverse);
    box-shadow: var(--shadow-cta);
}
.paywall-btn-primary:hover { filter: brightness(1.04); }
.paywall-btn-secondary {
    background: var(--surface-subtle);
    color: var(--text-strong);
    border: 1px solid var(--blue-200);
}
.paywall-btn-secondary:hover { background: var(--blue-100); }
.paywall-btn-secondary:disabled { opacity: .6; cursor: default; }
.paywall-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0;
    min-height: 40px;
    padding: 10px;
}
.paywall-btn-ghost:hover { color: var(--text-muted); text-decoration: underline; }
.paywall-recheck-msg {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-success);
    margin: 2px 0 12px;
    padding: 8px 10px;
    background: var(--green-soft);
    border-radius: var(--radius-sm);
}
.paywall-recheck-msg.is-warn {
    color: var(--text-warning);
    background: var(--surface-warning);
}

/* ============================================================
   [THANH TOÁN — ĐỢT 1] Cấu hình billing (admin). Mobile-first; input ≥16px.
   ============================================================ */
/* Ẩn tab admin-only trong ACCORDION MOBILE với phụ huynh (accordion dựng từ config,
   KHÔNG tự lọc theo vai). Body được gắn .hcc-role-parent trong applySettingsRoleVisibility. */
body.hcc-role-parent .tab-accordion-item[data-acc-child="math"],
body.hcc-role-parent .tab-accordion-item[data-acc-child="system"],
body.hcc-role-parent .tab-accordion-item[data-acc-child="billing"] { display: none !important; }

.billing-notice {
    background: var(--surface-warning);
    border: 1px solid var(--border-warning);
    color: var(--text-warning);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 15px;
    line-height: 1.5;
}
.billing-table-wrap { overflow-x: auto; }
.billing-pkg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.billing-pkg-table th,
.billing-pkg-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-faint);
    text-align: left;
    vertical-align: middle;
}
.billing-pkg-table th {
    font-size: 13px;
    color: var(--text-faint);
    font-weight: 700;
    white-space: nowrap;
}
.billing-months-cell { text-align: center; color: var(--text-muted); }
.billing-active-cell { text-align: center; }
.billing-active-cell input[type="checkbox"] { width: 20px; height: 20px; }
.billing-price-input { width: 100%; max-width: 150px; text-align: right; }
.billing-price-fmt { font-size: 12px; color: var(--text-success); margin-top: 2px; text-align: right; }

.billing-field { margin-bottom: 12px; }
.billing-field label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}
.billing-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;            /* ≥16px → iOS không tự zoom khi focus */
    padding: 10px 12px;
    border: 1px solid var(--blue-200);
    border-radius: var(--radius-sm);
    background: var(--surface-white);
    font-family: inherit;
    min-height: 44px;
}
.billing-input:focus {
    outline: none;
    border-color: var(--blue-800);
    box-shadow: 0 0 0 2px rgba(var(--shadow-rgb), .12);
}
.billing-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
    line-height: 1.45;
}
.billing-momo-block {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-subtle);
}
.billing-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--blue-900);
    margin-bottom: 10px;
    cursor: pointer;
}
.billing-check-label input[type="checkbox"] { width: 20px; height: 20px; }
.billing-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.billing-actions .settings-btn { flex: 1 1 auto; min-width: 140px; }
.billing-save-msg {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.45;
}
.billing-save-msg.is-ok { background: var(--green-soft); color: var(--text-success); }
.billing-save-msg.is-err { background: var(--surface-danger); color: var(--accent-danger); }
.billing-save-msg.is-info { background: var(--surface-subtle); color: var(--text-strong); }

/* ============================================================
   [THANH TOÁN — ĐỢT 2] Màn thanh toán phụ huynh (#paymentScreen).
   Overlay riêng z-index CAO hơn paywall (1000). Mobile-first; QR to; nút ≥16px.
   ============================================================ */
.payment-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center; /* [POPUP GỌN] căn giữa dọc (box đã cap max-height + cuộn bên trong) */
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
    background: rgba(var(--shadow-rgb), 0.55);
    font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
}
.payment-overlay.hidden-section { display: none !important; }
.payment-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    background: var(--surface-cream);
    border-radius: 16px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
    padding: 22px 18px 20px;
    margin: auto;
    /* [POPUP GỌN] Cap chiều cao + cuộn BÊN TRONG (.payment-scroll) → KHÔNG tràn xuống đáy màn.
       × + tiêu đề đứng yên; dvh cho điện thoại (trừ thanh địa chỉ); chừa 16px padding overlay. */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
}
/* Thân popup cuộn bên trong; overscroll-behavior chặn cuộn lan ra nền (nền cũng đã khoá auth-locked). */
.payment-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden; /* [FIX] KHÔNG cho cuộn NGANG trong popup (form dọc — chặn thanh scroll ngang) */
    overscroll-behavior: contain;
}
.payment-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 44px;   /* [UI] vùng chạm ≥44px (dùng chung cho cả popup gia hạn + popup lịch sử) */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.payment-close:hover { background: var(--surface-muted); color: #444; }
.payment-title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-strong);
    text-align: center;
    padding-right: 40px; /* chừa nút đóng 44px góc phải, không đè tiêu đề */
}
.payment-sub { margin: 0 0 10px; font-size: 16px; color: var(--text-muted); font-weight: 600; }
.payment-loading { text-align: center; color: var(--text-faint); padding: 24px 0; font-size: 16px; }

.payment-pkg-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.payment-pkg-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--surface-white);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    min-height: 52px;
}
.payment-pkg-item:hover { border-color: var(--blue-200); }
.payment-pkg-item.selected { border-color: var(--orange-600); background: var(--surface-cream); }
.payment-pkg-name { font-size: 16px; font-weight: 700; color: var(--blue-900); }
.payment-pkg-price { font-size: 16px; font-weight: 800; color: var(--red-550); white-space: nowrap; }

.payment-notice {
    background: var(--surface-warning);
    border: 1px solid var(--border-warning);
    color: var(--text-warning);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.5;
}
.payment-inline-link { color: var(--text-strong); font-weight: 700; text-decoration: underline; }

.payment-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 10px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    min-height: 50px;
    line-height: 1.3;
}
.payment-btn:disabled { opacity: .55; cursor: default; }
.payment-btn-primary { background: linear-gradient(135deg, var(--orange-500), var(--orange-600)); color: var(--text-inverse); box-shadow: var(--shadow-cta); }
.payment-btn-outline { background: var(--surface-white); color: var(--accent-danger); border: 1px solid var(--border-danger); }
.payment-btn-ghost { background: transparent; color: var(--text-muted); font-weight: 600; min-height: 42px; }