/* ========== MODAL OVERLAY ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-content {
    background: #fff;
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* ========== MODAL HEADER ========== */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: none;
    flex-shrink: 0;
}

.modal-close,
.modal-help {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover,
.modal-help:hover {
    background: #f0f0f0;
}

.modal-close svg,
.modal-help svg {
    stroke: #000;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    flex: 1;
    text-align: center;
}

/* ========== MODAL BODY ========== */
.modal-body {
    padding: 16px;
    padding-bottom: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* ========== DROPDOWN ========== */
.custom-dropdown {
    margin-bottom: 16px;
}

.dropdown-btn {
    width: 100%;
    padding: 12px 0;
    background: transparent;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    color: #000;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    height: 10px;
}

.dropdown-btn:hover {
    border-color: #d0d0d0;
}

.dropdown-btn svg {
    flex-shrink: 0;
}

/* ========== AMOUNT INPUT ========== */
.amount-input-wrapper {
    position: relative;
    margin-bottom: 12px;
    /* Performance optimization cho container */
    contain: layout style;
    will-change: auto;
}

.coin-icon-display {
    position: absolute;
    left: 16px;
    top: 45%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coin-icon-display svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.amount-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 600;
    color: #000;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease; /* Thêm transition nhẹ cho border */
    /* Performance optimization cho rapid input changes */
    will-change: contents;
    transform: translateZ(0);
    contain: layout style;
    font-variant-numeric: tabular-nums;
    /* Tối ưu text rendering */
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: subpixel-antialiased;
}

.amount-input:focus {
    border-color: #d0d0d0;
}

.amount-input.error {
    border-color: #ff2e6d;
}

.amount-input.has-value {
    color: #000;
}

.amount-input.placeholder {
    color: #bbb;
}

/* ========== ERROR MESSAGE ========== */
.error-message {
    font-size: 13px;
    color: #ff2e6d;
    margin-bottom: 12px;
    padding-left: 4px;
    font-weight: 400;
}

/* ========== CONVERTED AMOUNT ========== */
.converted-amount {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
    padding-left: 4px;
    font-weight: 400;
    /* Performance optimization cho text updates */
    will-change: contents;
    transform: translateZ(0);
    contain: layout style;
    font-variant-numeric: tabular-nums; /* Monospace numbers để tránh layout shift */
}

/* ========== NUMBER PAD ========== */
.number-pad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

/* ========== NUMBER PAD OPTIMIZATION ========== */
.number-pad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    /* Tối ưu hóa performance */
    will-change: auto;
    contain: layout style;
}

.num-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    width: 100%;
    transition: background-color 0.1s ease; /* Thêm transition nhẹ cho background */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    /* Performance optimization */
    will-change: transform, background-color;
    transform: translateZ(0);
    /* Tối ưu cho spam clicking */
    touch-action: manipulation;
    pointer-events: auto;
}

.num-btn:hover {
    background: #e8e8e8;
}

.num-btn:active,
.num-btn.pressed {
    background: #d4d4d4;
    transform: scale(0.98) translateZ(0);
}

.num-btn.delete-btn {
    background: #f5f5f5;
}

.num-btn.delete-btn:hover {
    background: #e8e8e8;
}

.num-btn.delete-btn:active,
.num-btn.delete-btn.pressed {
    background: #d4d4d4;
}

.num-btn.delete-btn svg {
    stroke: #999;
}

/* ========== SPECIAL OFFERS ========== */
.special-offers {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0;
}

.offer-label {
    font-size: 14px;
    color: #999;
    font-weight: 400;
}

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

.offer-link:hover {
    color: #ff4d88;
}

.offer-link svg {
    flex-shrink: 0;
}

/* ========== TERMS NOTICE ========== */
.terms-notice {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.terms-link {
    color: #ff2e6d;
    text-decoration: none;
}

.terms-link:hover {
    text-decoration: underline;
}

/* ========== TOTAL SECTION ========== */
.total-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0;
}

.total-label {
    font-size: 15px;
    font-weight: 600;
    color: #000;
}

.total-amount {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    /* Performance optimization cho frequent updates */
    will-change: contents;
    transform: translateZ(0);
    contain: layout style;
    font-variant-numeric: tabular-nums; /* Monospace numbers để tránh layout shift */
}

/* ========== SUBMIT BUTTON ========== */
.submit-btn {
    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%;
    margin-bottom: 24px;
}

.submit-btn:hover {
    background: linear-gradient(90deg, #ff8aa8 0%, #ffa3ba 100%);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: linear-gradient(90deg, #ffb3c6 0%, #ffc4d4 100%);
    color: #fff;
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn svg {
    flex-shrink: 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 375px) {
    .number-pad {
        gap: 8px;
    }
    
    .num-btn {
        font-size: 18px;
        min-height: 52px;
        
    }
}
