/* ==========================================
   TIKTOK COIN PURCHASE - LIGHT THEME
   Giao diện màu trắng sáng
   ========================================== */

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f7f7f7;
    color: #000;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

@media (max-width: 430px) {
    body {
        max-width: 100%;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ========== PAGE MANAGEMENT ========== */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== HEADER ========== */
.header {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #e5e5e5;
}

.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #000;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-btn:hover {
    background: #f0f0f0;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

/* ========== USER SECTION ========== */
.user-section {
    background: #f6f6f6;
    padding: 8px;
    padding-bottom: 12px;
}

.user-search {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.search-wrapper {
    flex: 1;
}

.search-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 400;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    outline: none;
    background: #fafafa;
    color: #000;
    font-weight: 400;
    transition: all 0.2s;
}

.search-input::placeholder {
    color: #999;
    font-weight: 400;
}

.search-input:focus {
    border-color: #ff2e6d;
    background: #fff;
}

/* ========== COIN ICON ========== */
.coin-icon {
    width: 24px;
    height: 24px;
    background-image: url('./CN.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.coin-icon1 {
    width: 16px;
    height: 16px;
    background-image: url('./CN.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.coin-icon-small {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.coin-icon-small::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #ff9500;
    border-radius: 50%;
}

/* ========== COIN SECTION ========== */
.coin-section {
    background: #f6f6f6;
    padding: 0;
    padding-bottom: 100px;
    min-height: calc(100vh - 200px);
}

/* Coin Header - Nền trắng */
.coin-header {
    background: #fff;
    padding: 16px;
    padding-bottom: 12px;
    margin: 0 8px;
    border-radius: 12px;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #000;
}

.section-notice {
    font-size: 13px;
    color: #ff2e6d;
    margin-bottom: 0;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.4;
}

/* Coin Grid Wrapper - Nền trắng với margin top */
.coin-grid-wrapper {
    background: #fff;
    padding: 12px 16px 16px 16px;
    margin: 8px 8px 0 8px;
    border-radius: 12px;
}

.section-notice svg {
    stroke: #ff4444;
    flex-shrink: 0;
}

/* ========== COIN GRID ========== */
.coin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 0;
}

.coin-card {
    background: #f5f5f5;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 12px;
    text-align: center;
    cursor: pointer;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Tối ưu cho spam clicking */
    transition: none; /* Loại bỏ transition */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    pointer-events: auto;
    will-change: background-color, border-color;
    transform: translateZ(0);
}

.coin-card:hover {
    background: #fffbfb;
}

.coin-card.active {
    border-color: #ff5588;
    background: rgba(255, 85, 136, 0.12); /* <= nền cùng màu nhưng mờ */
    border-width: 1px;
    box-shadow: 0 2px 8px rgba(255, 46, 109, 0.15);
}

.coin-amount {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.coin-number {
    font-size: 16px;
    font-weight: 700;
    color: #000;
}

.coin-price {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}

/* Custom Card */
.custom-card {
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.custom-card:hover {
    border-color: #ff2e6d;
    background: #fd004c;
}

.custom-text {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

/* ========== REWARDS BANNER ========== */
.rewards-banner {
    background: linear-gradient(90deg, #fff5e6 0%, #ffe8c2 100%);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 8px;
    cursor: pointer;
    transition: opacity 0.2s;
    border: none;
}

.rewards-banner:hover {
    opacity: 0.9;
}

.rewards-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 56px;
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rewards-content {
    flex: 1;
}

.rewards-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    color: #000;
}

.rewards-subtitle {
    font-size: 13px;
    color: #666;
    font-weight: 400;
}

.rewards-banner svg {
    stroke: #000;
}

/* ========== ADD TO HOME BANNER ========== */
.add-home-banner {
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 8px 16px 8px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid #e8e8e8;
}

.add-home-banner:hover {
    background: #fafafa;
}

.add-home-icon {
    width: 40px;
    height: 40px;
    background: #e3f2fd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.add-home-content {
    flex: 1;
}

.add-home-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #000;
}

.add-home-subtitle {
    font-size: 12px;
    color: #666;
}

.add-home-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.add-home-btn:hover {
    background: #e0e0e0;
}

/* ========== BALANCE INFO ========== */
.balance-info {
    text-align: center;
    padding: 16px 0;
}

.balance-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.balance-amount {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ========== FOOTER ========== */
.footer {
    background: #fff;
    padding: 16px 16px 24px 16px;
    border-top: none;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    position: sticky;
    bottom: 24px;
    left: 0;
    right: 0;
    z-index: 10;
}

.footer::after {
    content: '';
    position: absolute;
    bottom: -100vh;
    left: 0;
    right: 0;
    height: 100vh;
    background: #fff;
    z-index: -1;
}

.footer-promo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.promo-label {
    font-size: 13px;
    color: #666;
    font-weight: 400;
}

.promo-link {
    font-size: 14px;
    color: #ff2e6d;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.promo-link:hover {
    color: #ff6666;
}

/* ========== PAYMENT METHODS ========== */
.payment-methods {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.payment-icon {
    width: 26px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.payment-icon.visa {
    background: #fff url('https://upload.wikimedia.org/wikipedia/commons/5/5e/Visa_Inc._logo.svg') no-repeat center;
    background-size: contain;
    border: 1px solid #e5e5e5;
}

.payment-icon.mastercard {
    background: #fff url('https://upload.wikimedia.org/wikipedia/commons/2/2a/Mastercard-logo.svg') no-repeat center;
    background-size: contain;
}

.payment-icon.jcb {
    background: #fff url('https://upload.wikimedia.org/wikipedia/commons/4/40/JCB_logo.svg') no-repeat center;
    background-size: contain;
}

.payment-icon.amex {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/card_american_express_51cd3f.png') no-repeat center;
    background-size: contain;
}

.payment-icon.momo {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/momo_4256e5.png') no-repeat center;
    background-size: contain;
}

.payment-icon.zalopay {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/zalopay_8e254f.png') no-repeat center;
    background-size: contain;
}

.payment-icon.vietcombank {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/light_vietcombank_297138.png') no-repeat center;
    background-size: contain;
}
.payment-icon.vietinbank {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/light_vietinbank_a503cd.png') no-repeat center;
    background-size: contain;
}
.payment-icon.discover {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/discover_4adc90.png') no-repeat center;
    background-size: contain;
}
.payment-icon.banktransfer {
    background: #fff url('https://lf16-co.g-p-static.com/obj/pipo-sgcompliance/sky/BankTransfer_facae0.png') no-repeat center;
    background-size: contain;
}
.payment-more {
    font-size: 12px;
    color: #999;
}

/* ========== PRIMARY BUTTON ========== */
.btn-primary {
    background: linear-gradient(135deg, #ff2e6d, #ff5a8a);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #e02860, #ff4a7a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 46, 109, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: rgb(254, 44, 85);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Button trong bottom sheet */
.custom-footer .btn-primary {
    margin: 0;
    width: 100%;
}

/* ========== TIKTOK BRANDING ========== */
.tiktok-branding {
    text-align: center;
    padding: 24px 0;
    color: #ccc;
}

/* ========== BOTTOM SHEET ========== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 998;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sheet Pages */
.sheet-page {
    display: none;
}

.sheet-page.active {
    display: block;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #fff;
    border-radius: 18px 18px 0 0;
    transition: transform 220ms cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 999;
    max-width: 430px;
    width: 100%;
    box-shadow: 0px -8px 38px rgba(0, 0, 0, 0.45);
}

.bottom-sheet.active {
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 430px) {
    .bottom-sheet {
        max-width: 100%;
        left: 0;
        right: 0;
        transform: translateY(100%);
        border-radius: 18px 18px 0 0;
    }
    
    .bottom-sheet.active {
        transform: translateY(0);
    }
}

.bottom-sheet-content {
    padding: 16px;
}

.bottom-sheet-handle {
    width: 48px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.bottom-sheet-close,
.bottom-sheet-info {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.bottom-sheet-close:hover,
.bottom-sheet-info:hover {
    color: #000;
    background: #f0f0f0;
}

.bottom-sheet-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

/* ========== CUSTOM INPUT ========== */
.custom-input-section {
    margin-bottom: 24px;
}

.custom-label-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.custom-label {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

.custom-label-wrapper svg {
    color: #000;
}

.custom-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    position: relative;
    background: #fff;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.custom-input {
    background: transparent;
    border: none;
    color: #000;
    font-size: 28px;
    font-weight: 600;
    outline: none;
    flex: 1;
    font-family: 'Inter', sans-serif;
    caret-color: #ff2e6d;
}

.custom-input::placeholder {
    color: #bbb;
    font-weight: 400;
}

/* Cursor nhấp nháy màu hồng khi trống */
.custom-input-wrapper.empty::after {
    content: '';
    position: absolute;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 28px;
    background: #ff2e6d;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.custom-notice {
    font-size: 13px;
    color: #ff2e6d;
    min-height: 20px;
    margin-bottom: 8px;
    font-weight: 400;
    line-height: 20px;
    visibility: hidden;
}

.custom-notice:not(:empty) {
    visibility: visible;
}

/* ========== KEYPAD ========== */
.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.keypad-btn {
    background: #f5f5f5;
    border: none;
    color: #000;
    font-size: 20px;
    font-weight: 600;
    padding: 20px;
    cursor: pointer;
    transition: none;
    font-family: 'Inter', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    border-radius: 8px;
    min-height: 56px;
}

.keypad-btn:hover {
    background: #ebebeb;
}

.keypad-btn:active {
    background: #d8d8d8;
}

.keypad-delete {
    display: flex;
    align-items: center;
    justify-content: center;
}

.keypad-delete svg {
    color: #999;
}

/* ========== CUSTOM FOOTER ========== */
.custom-footer {
    margin-top: 24px;
    padding: 0 16px;
}

.custom-footer-divider {
    height: 1px;
    background: rgba(22, 24, 35, 0.2);
    margin-bottom: 16px;
    margin-left: -16px;
    margin-right: -16px;
}

.custom-promo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.custom-promo-label {
    font-size: 13px;
    color: #666;
    flex-shrink: 0;
    line-height: 1.3em;
}

.custom-promo-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #ff2e6d;
    cursor: pointer;
    text-align: right;
    line-height: 1.3em;
}

.custom-promo-link svg {
    color: #ff2e6d;
    flex-shrink: 0;
}

.custom-promo-link:hover {
    opacity: 0.8;
}

/* ========== CUSTOM TOTAL ========== */
.custom-total-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.custom-total-label {
    font-size: 18px;
    font-weight: 700;
}

.custom-total-value {
    font-size: 18px;
    font-weight: 700;
}

/* ========== SUCCESS BANNER FULL ========== */
.success-banner-full {
    background: #d4f4dd;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
}

.success-banner-full svg {
    stroke: #00a870;
    width: 14px;
    height: 14px;
}

.success-banner-full span {
    color: #00a870;
    font-weight: 500;
}

/* ========== SUMMARY PAGE ========== */
.summary-section {
    background: #fff;
    padding: 16px;
    padding-bottom: 100px;
    min-height: calc(100vh - 200px);
}

.summary-group {
    margin-bottom: 24px;
}

.summary-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.summary-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.summary-username {
    font-size: 16px;
    font-weight: 600;
}

.summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.summary-item-label {
    font-size: 16px;
    color: #333;
}

.summary-item-value {
    font-size: 16px;
    font-weight: 600;
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.summary-link {
    font-size: 14px;
    color: #ff4444;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.summary-link:hover {
    color: #ff6666;
}

/* ========== PAYMENT OPTIONS ========== */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-option {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-option:hover {
    background: #fafafa;
}

.payment-option.selected {
    border-color: #ff2e6d;
    background: #fff;
}

.payment-option.selected .payment-option-radio {
    border-color: #ff2e6d;
}

.payment-option-icon {
    flex-shrink: 0;
}

.payment-icon-momo {
    width: 32px;
    height: 32px;
    background: #d82d8b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.payment-icon-zalopay {
    width: 32px;
    height: 32px;
    background: #0068ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.payment-option-details {
    flex: 1;
}

.payment-option-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.payment-option-type {
    font-size: 12px;
    color: #666;
}

.payment-option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #999;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.radio-indicator {
    width: 12px;
    height: 12px;
    background: #ff2e6d;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.payment-option.selected .radio-indicator {
    opacity: 1;
}

/* ========== SUMMARY TERMS ========== */
.summary-terms {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
}

.summary-terms p {
    margin-bottom: 8px;
}

.summary-terms strong {
    color: #000;
}

.summary-terms a {
    color: #0066cc;
    text-decoration: underline;
}

/* ========== SUMMARY TOTAL ========== */
.summary-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-top: 1px solid #e5e5e5;
    margin-bottom: 24px;
}

.total-label {
    font-size: 18px;
    font-weight: 600;
}

.total-value {
    font-size: 18px;
    font-weight: 700;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 390px) {
    .coin-grid {
        gap: 8px;
    }
    
    .coin-card {
        padding: 10px 6px;
    }
    
    .coin-number {
        font-size: 18px;
    }
}

/* ========== PREVENT ZOOM ON MOBILE ========== */
input[type="text"],
input[type="number"],
button {
    touch-action: manipulation;
}
