/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --primary-light: #a29bfe;
    --bg: #f8f9fc;
    --bg-surface: #ffffff;
    --text: #2d3436;
    --text-muted: #747d8c;
    --border: #e2e6ee;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* === Gradient Blobs === */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.5;
}
body::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.25), rgba(162, 155, 254, 0.1));
    top: -120px;
    right: -100px;
}
body::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(116, 185, 255, 0.25), rgba(9, 132, 227, 0.08));
    bottom: -80px;
    left: -100px;
}

/* Extra blob via a wrapper pseudo-element on main */
main::before {
    content: '';
    position: fixed;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(253, 203, 110, 0.2), rgba(225, 112, 85, 0.08));
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    filter: blur(80px);
    opacity: 0.5;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* === Header === */
header {
    padding: 32px 0 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe, #74b9ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.tagline {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.95rem;
}

/* === Steps === */
.steps {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 32px 0;
}
.step {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.35;
    transition: opacity 0.3s;
}
.step.active { opacity: 1; }
.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.step.active .step-number { background: var(--primary); color: #fff; }
.step-label { font-weight: 600; font-size: 0.9rem; }

/* === Step Content === */
.step-content { display: none; animation: fadeIn 0.3s ease; }
.step-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* === Two Column Layout === */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* === Form === */
.form-panel, .preview-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.form-panel h2, .preview-panel h2 {
    font-size: 1.15rem;
    margin-bottom: 20px;
    color: var(--text);
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: #b2bec3;
}
.form-group textarea { resize: vertical; }

/* === Toggle & Hints === */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
}
.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Logo Upload === */
.logo-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    background: var(--bg);
}
.logo-upload:hover { border-color: var(--primary-light); background: rgba(108, 92, 231, 0.03); }
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.upload-icon { font-size: 2rem; color: var(--primary); }
.logo-thumb {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    border-radius: 4px;
}
.btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}
.btn-remove:hover { background: #c0392b; }

/* === Color Picker === */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { box-shadow: 0 0 0 3px var(--primary); border-color: #fff; }
.custom-color {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    padding: 0;
}

/* === Card Preview === */
.card-preview {
    perspective: 800px;
}
.card-inner {
    width: 100%;
    aspect-ratio: 1.6 / 1;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #1a1a2e;
    color: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: background 0.3s, color 0.3s;
}
.card-logo-area { height: 40px; margin-bottom: 8px; }
.card-logo-area img { max-height: 40px; max-width: 120px; object-fit: contain; }
.card-name { font-size: 1.25rem; font-weight: 700; }
.card-title { font-size: 0.85rem; opacity: 0.8; margin-top: 2px; }
.card-company { font-size: 0.85rem; opacity: 0.7; margin-top: 1px; }
.card-divider { width: 32px; height: 2px; background: currentColor; opacity: 0.3; margin: 8px 0; }
.card-details { font-size: 0.75rem; opacity: 0.7; line-height: 1.5; }
/* === QR Code on Card === */
.card-qr {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 56px;
    height: 56px;
    background: #fff;
    border-radius: 4px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-qr img, .card-qr canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.card-nfc-icon {
    position: absolute;
    bottom: 16px;
    right: 16px;
    opacity: 0.4;
}
/* When QR is visible, move NFC icon out of the way */
.card-qr:not([hidden]) ~ .card-nfc-icon {
    right: auto;
    left: 16px;
}

/* === Preview / Confirm === */
.preview-confirm { max-width: 800px; margin: 0 auto; }
.preview-confirm h2 { text-align: center; font-size: 1.5rem; }
.subtitle { text-align: center; color: var(--text-muted); margin: 8px 0 32px; }

.wallet-previews {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}
.wallet-preview h3 { text-align: center; margin-bottom: 12px; font-size: 0.95rem; color: var(--text-muted); }
.wallet-mockup {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.wallet-mockup .card-inner {
    font-size: 0.85rem;
}

.confirm-info {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.confirm-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.confirm-info .info-row:last-child { border-bottom: none; }
.confirm-info .info-label { color: var(--text-muted); }

.btn-row { display: flex; gap: 12px; justify-content: center; }

/* === Purchase === */
.purchase-panel {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.purchase-panel h2 { margin-bottom: 24px; }
.order-summary {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.order-item, .order-total {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
}
.order-total {
    border-top: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.05rem;
    margin-top: 8px;
    padding-top: 12px;
}
.price { font-weight: 600; color: var(--primary); }
.purchase-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 8px;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(108, 92, 231, 0.3); }
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); background: var(--bg); }
.btn-stripe {
    background: #635bff;
    color: white;
    width: 100%;
    font-size: 1.05rem;
    padding: 14px 28px;
    margin-bottom: 12px;
}
.btn-stripe:hover { background: #5851db; box-shadow: 0 4px 14px rgba(99, 91, 255, 0.3); }
.btn-stripe:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

/* === Success === */
.success-panel {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 0;
}
.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 14px rgba(39, 174, 96, 0.3);
}
.success-panel h2 { margin-bottom: 8px; }
.success-panel p { color: var(--text-muted); margin-bottom: 24px; }
.download-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.btn-wallet {
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-apple { background: #000; color: #fff; }
.btn-apple:hover { background: #222; }
.btn-google { background: #4285f4; color: #fff; }
.btn-google:hover { background: #3367d6; }
.success-note { font-size: 0.82rem; }

/* === Footer === */
footer {
    text-align: center;
    padding: 32px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
    margin-top: 60px;
    background: rgba(255, 255, 255, 0.4);
}

/* === Responsive === */
@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
    .wallet-previews { grid-template-columns: 1fr; }
    .steps { gap: 20px; }
    .step-label { display: none; }
    .btn-row { flex-direction: column; }
    .download-buttons { flex-direction: column; align-items: center; }

    body::before { width: 350px; height: 350px; top: -60px; right: -60px; }
    body::after { width: 300px; height: 300px; bottom: -40px; left: -60px; }
    main::before { width: 280px; height: 280px; }
}

/* === Loading Spinner === */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Toast Notification === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #e74c3c;
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.toast.success { background: #27ae60; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
