/* =============================================
   TopUp Express - Styles
   ============================================= */

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #ef4444;
    
    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-dark: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    
    /* Typography */
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', monospace;
    
    /* Spacing */
    --container-max: 1200px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* =============================================
   Header
   ============================================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.5rem;
}

.logo-icon {
    font-size: 1.8rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo-text {
    color: var(--gray-900);
}

.logo-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary);
}

/* =============================================
   Hero Section
   ============================================= */
.hero {
    position: relative;
    padding: 140px 0 80px;
    min-height: 100vh;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-dark);
    z-index: -2;
}

.hero-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(14, 165, 233, 0.2) 0%, transparent 50%);
}

.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 480px;
    gap: 60px;
    align-items: center;
}

.hero-content {
    color: white;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
}

.gradient-text {
    background: linear-gradient(135deg, #818cf8 0%, #38bdf8 50%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--gray-300);
    margin-bottom: 40px;
    max-width: 480px;
}

.hero-stats {
    display: flex;
    gap: 48px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* =============================================
   Form Card
   ============================================= */
.form-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

/* Steps Indicator */
.form-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.form-steps::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--gray-200);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.step.active .step-number,
.step.completed .step-number {
    background: var(--gradient-primary);
    color: white;
}

.step.completed .step-number::after {
    content: '✓';
}

.step-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.step.active .step-label {
    color: var(--primary);
}

/* Form Elements */
.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--gray-900);
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.text-input,
.select-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    color: var(--gray-900);
    background: white;
    transition: all 0.2s;
}

.text-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.text-input::placeholder {
    color: var(--gray-400);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.select-wrapper {
    position: relative;
}

.select-input {
    appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    font-size: 0.75rem;
}

.phone-input-wrapper {
    display: flex;
    align-items: stretch;
}

.phone-prefix {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-weight: 600;
    color: var(--gray-600);
    min-width: 70px;
}

.phone-input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    flex: 1;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 6px;
}

.input-hint.error {
    color: var(--error);
}

.input-hint.success {
    color: var(--success);
}

/* Operator Detection */
.operator-detection {
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.operator-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 2px solid var(--success);
    border-radius: var(--radius-md);
}

.operator-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: white;
    padding: 4px;
}

.operator-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.operator-detected {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.operator-name {
    font-weight: 700;
    color: var(--gray-900);
}

.operator-check {
    width: 32px;
    height: 32px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Gift Toggle */
.gift-toggle {
    margin-bottom: 20px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 26px;
    background: var(--gray-200);
    border-radius: 13px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(22px);
}

.toggle-label {
    font-weight: 500;
    color: var(--gray-700);
}

.gift-options {
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-full {
    width: 100%;
}

.btn-arrow {
    transition: transform 0.2s;
}

.btn:hover .btn-arrow {
    transform: translateX(4px);
}

.btn-back {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--primary);
}

/* Products Grid */
.products-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.summary-phone {
    font-weight: 700;
    color: var(--gray-900);
}

.summary-operator {
    color: var(--gray-500);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.products-grid::-webkit-scrollbar {
    width: 6px;
}

.products-grid::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.products-grid::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.product-card {
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.product-card:hover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.02);
}

.product-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.product-receive {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.product-name {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.product-benefits {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.benefit-tag {
    font-size: 0.625rem;
    padding: 2px 6px;
    background: var(--gray-100);
    border-radius: 4px;
    color: var(--gray-600);
    text-transform: uppercase;
    font-weight: 600;
}

/* Promo Banner */
.promo-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.promo-icon {
    font-size: 1.5rem;
}

.promo-text {
    font-weight: 600;
    color: var(--gray-800);
}

/* Order Summary */
.order-summary {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.875rem;
}

.summary-row span:first-child {
    color: var(--gray-500);
}

.summary-row span:last-child {
    font-weight: 600;
    color: var(--gray-900);
}

.summary-row.total {
    border-top: 2px solid var(--gray-200);
    margin-top: 8px;
    padding-top: 16px;
    font-size: 1.125rem;
}

.summary-row.total span:last-child {
    color: var(--primary);
}

/* Stripe Element */
.stripe-element {
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    background: white;
    min-height: 100px;
}

.payment-message {
    font-size: 0.875rem;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    display: none;
}

.payment-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.security-badges {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Success */
.success-content {
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.success-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.success-text {
    color: var(--gray-600);
    margin-bottom: 24px;
}

.success-details {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.detail-row span:first-child {
    color: var(--gray-500);
}

.detail-row span:last-child {
    font-weight: 600;
}

.success-email {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* Loading */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    grid-column: 1 / -1;
    color: var(--gray-500);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.large {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: white;
    font-weight: 500;
}

/* =============================================
   Sections
   ============================================= */
.section {
    padding: 80px 0;
}

.section-alt {
    background: var(--gray-100);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 48px;
    color: var(--gray-900);
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

.step-card {
    text-align: center;
    padding: 32px 24px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s, box-shadow 0.3s;
}

.step-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.step-card-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.step-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--gray-900);
}

.step-card p {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.6;
}

/* FAQ */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.faq-item {
    padding: 24px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.faq-question {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--gray-900);
}

.faq-answer {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.6;
}

/* =============================================
   Footer
   ============================================= */
.footer {
    background: var(--gray-900);
    padding: 48px 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
}

.footer-links {
    display: flex;
    gap: 32px;
}

.footer-links a {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .hero-content {
        text-align: center;
    }
    
    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .form-card {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        gap: 32px;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .form-card {
        padding: 24px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .faq-grid {
        grid-template-columns: 1fr;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        display: none;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .form-steps {
        gap: 8px;
    }
    
    .step-label {
        display: none;
    }
    
    .form-steps::before {
        left: 20px;
        right: 20px;
    }
}
