/**
 * Payment V2 - Compact Package Design
 * Biggest package on top, dynamic pricing
 */

/* ============================================
   BASE
   ============================================ */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2d3748;
    overflow-x: hidden;
}

.payment-container {
    max-width: 900px;
    margin: 0 auto;
}

/* ============================================
   HEADER
   ============================================ */

.payment-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-5px);
}

.payment-header h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* ============================================
   CURRENT BALANCE CARD
   ============================================ */

.current-balance-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.balance-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.balance-value {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.balance-unit {
    font-size: 14px;
    color: #999;
}

/* ============================================
   PACKAGES SECTION
   ============================================ */

.packages-section {
    margin-bottom: 25px;
}

.packages-section h2 {
    color: white;
    text-align: center;
    font-size: 26px;
    margin-bottom: 8px;
}

.section-desc {
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-bottom: 20px;
    font-size: 13px;
}

.packages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
    font-size: 16px;
}

/* ============================================
   PACKAGE CARD - COMPACT
   ============================================ */

.package-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 15px;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
}

.package-card:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.package-card.selected {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Package Icon */
.package-icon {
    font-size: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Package Info */
.package-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.package-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.package-tokens {
    font-size: 14px;
    color: #666;
}

.package-tokens .base {
    font-weight: 600;
    color: #667eea;
}

.package-tokens .bonus {
    color: #28a745;
    font-weight: 600;
}

.package-bonus-badge {
    display: inline-block;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* Package Price */
.package-price-container {
    text-align: right;
}

.package-price {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.package-currency {
    font-size: 13px;
    color: #999;
    display: block;
    margin-top: 4px;
}

/* Select Button */
.select-package-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.select-package-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.package-card.selected .select-package-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Best Value Badge */
.best-value-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
}

/* ============================================
   SUMMARY SECTION
   ============================================ */

.summary-section {
    margin-bottom: 25px;
}

.summary-section h2 {
    color: white;
    text-align: center;
    font-size: 22px;
    margin-bottom: 15px;
}

.summary-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.bonus-row {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 10px 15px;
    margin: 10px -15px;
    border-radius: 8px;
}

.summary-row.total-tokens-row {
    font-weight: 600;
    font-size: 16px;
}

.summary-row.total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #667eea;
    font-size: 18px;
    font-weight: 700;
}

.summary-label {
    color: #666;
    font-size: 14px;
}

.summary-value {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.summary-value.bonus-value {
    color: #28a745;
    font-weight: 700;
}

.summary-value.total-value {
    color: #667eea;
    font-size: 18px;
}

.summary-row.total .summary-value {
    color: #667eea;
    font-size: 24px;
}

/* ============================================
   PAYMENT SECTION
   ============================================ */

.payment-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.payment-section h2 {
    color: #333;
    text-align: center;
    font-size: 22px;
    margin-bottom: 8px;
}

.security-note {
    text-align: center;
    color: #28a745;
    font-size: 13px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.stripe-element {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    transition: border-color 0.3s;
}

.stripe-element:focus-within {
    border-color: #667eea;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 6px;
}

.pay-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

.pay-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.pay-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-loader {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.payment-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.secure-badges {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.badge {
    font-size: 11px;
    color: #666;
}

/* ============================================
   SUCCESS OVERLAY
   ============================================ */

.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.success-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-icon {
    font-size: 70px;
    margin-bottom: 15px;
}

.success-card h2 {
    color: #28a745;
    font-size: 26px;
    margin-bottom: 12px;
}

.success-card p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.bonus-received {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 16px;
    color: #155724;
}

.bonus-received strong {
    color: #28a745;
    font-size: 24px;
}

.new-balance {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 18px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 16px;
}

.new-balance strong {
    color: #667eea;
    font-size: 28px;
    font-weight: 700;
}

.continue-btn {
    padding: 12px 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .payment-header h1 {
        font-size: 28px;
    }
    
    .package-card {
        grid-template-columns: auto 1fr;
        gap: 12px;
    }
    
    .package-price-container {
        grid-column: 1 / -1;
        text-align: center;
        margin-top: 8px;
    }
    
    .select-package-btn {
        grid-column: 1 / -1;
        width: 100%;
    }
    
    .balance-value {
        font-size: 36px;
    }
    
    .success-card {
        padding: 30px;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .package-icon {
        font-size: 36px;
    }
    
    .package-name {
        font-size: 16px;
    }
    
    .package-price {
        font-size: 24px;
    }
}