:root {
    --primary: #635BFF;
    --primary-dark: #5851EA;
    --primary-light: #7A73FF;
    --text-primary: #1a1f36;
    --text-secondary: #697386;
    --text-muted: #8792a2;
    --border-color: #e6e8eb;
    --border-focus: #635BFF;
    --background: #f6f9fc;
    --surface: #ffffff;
    --error: #df1b41;
    --success: #30b566;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LAYOUT - CENTERED
   ============================================ */
.checkout-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ============================================
   PAYMENT CARD
   ============================================ */
.payment-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 8px 32px rgba(0,0,0,0.08);
    padding: 40px;
    position: relative;
    min-height: 300px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 10;
}

.loading-overlay.hidden {
    display: none;
}

.loading-overlay .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
}

/* ============================================
   CARD HEADER
   ============================================ */
.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.brand-logo {
    display: inline-flex;
    margin-bottom: 20px;
}

.card-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================\n   AMOUNT DISPLAY\n   ============================================ */
.amount-display {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #f8f9fe 0%, #f0f4ff 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
}

.amount-display .amount-value {
    display: block;
    font-size: 42px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ============================================
   WALLET SECTION
   ============================================ */
.wallet-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.wallet-button {
    min-height: 48px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wallet-button:empty {
    display: none;
}

.wallet-section:empty + .divider {
    display: none;
}

/* ============================================
   DIVIDER
   ============================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ============================================
   FORM STYLES
   ============================================ */
#payment-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="email"],
select {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
}

input[type="text"]:hover,
input[type="email"]:hover,
select:hover {
    border-color: #c4c9d4;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15);
}

input::placeholder {
    color: var(--text-muted);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23697386' d='M4.5 6L8 9.5 11.5 6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ============================================
   CARD INPUT
   ============================================ */
.card-input-wrapper {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.card-input-wrapper:hover {
    border-color: #c4c9d4;
}

.card-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15);
}

.card-input-wrapper.sq-card-error {
    border-color: var(--error);
}

#card-container {
    min-height: 44px;
    padding: 12px 14px;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */
#submit-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    margin-top: 8px;
    width: 100%;
}

#submit-button:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.35);
}

#submit-button:active:not(:disabled) {
    transform: scale(0.99);
}

#submit-button:disabled {
    background: #a5a8b8;
    cursor: not-allowed;
}

#submit-button.loading {
    background: var(--primary);
    pointer-events: none;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
#spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* ============================================
   PAYMENT STATUS
   ============================================ */
#payment-status {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#payment-status.success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}

#payment-status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ============================================
   CARD FOOTER
   ============================================ */
.card-footer {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.secure-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.secure-notice strong {
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .checkout-wrapper {
        padding: 20px 16px;
    }

    .payment-card {
        padding: 28px 24px;
    }

    .amount-display .amount-value {
        font-size: 30px;
    }

    #submit-button {
        padding: 16px;
    }
}
