/* Modern & Clean Invoice Generator - Balanced Design + Multi-Step */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --success: #10b981;
    --success-light: #34d399;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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 20px rgba(102, 126, 234, 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f0f23;
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--gray-100);
    position: relative;
}

/* Subtle Background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.1;
    z-index: -1;
}

.bg-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(102, 126, 234, 0.2) 0%, transparent 70%);
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* Header */
.header {
    background: var(--gradient-primary);
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: gentle-float 8s ease-in-out infinite;
}

@keyframes gentle-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* NEW: Progress Bar Styling */
.progress-container {
    padding: 2rem 2rem 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 25%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Step Indicators */
.step-indicators {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    transition: all 0.3s ease;
}

.step-number {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--gray-400);
    transition: all 0.3s ease;
}

.step-label {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-weight: 500;
    transition: all 0.3s ease;
}

.step-indicator.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

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

.step-indicator.completed .step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-indicator.completed .step-label {
    color: var(--success-light);
}

/* Main Content */
.main-content {
    padding: 2rem 2rem 2.5rem;
}

/* NEW: Form Step Styling */
.form-step {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.form-step.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Sections */
.form-section {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    position: relative;
}

.form-section:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 1rem 1rem 0 0;
}

.form-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-100);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h3::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--primary);
    border-radius: 2px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.input-group {
    position: relative;
}

.input-group.full-width {
    grid-column: span 2;
}

.input-group.small {
    max-width: 120px;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-300);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    font-size: 1rem;
    color: var(--gray-100);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

/* File Upload */
.input-group input[type="file"] {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.input-group input[type="file"]:hover {
    border-color: var(--primary-light);
    background: rgba(255, 255, 255, 0.05);
}

.file-name {
    font-size: 0.8rem;
    color: var(--success-light);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Items Section Styling */
.items-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.add-item-btn {
    background: rgba(16, 185, 129, 0.15);
    border: 2px dashed rgba(16, 185, 129, 0.4);
    color: var(--success-light);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.add-item-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: var(--success);
    transform: translateY(-1px);
}

/* Item Card Structure */
.item-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.item-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.item-number {
    background: var(--gradient-primary);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.remove-item {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-item:hover {
    background: var(--error);
    color: white;
    transform: scale(1.05);
}

/* Item Inputs - All on Same Line */
.item-inputs {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    width: 100%;
}

/* Input Group Positioning */
.item-inputs .input-group {
    position: relative;
}

.description-input {
    flex: 1;
}

.qty-input {
    flex: 0 0 80px;
}

.price-input {
    flex: 0 0 120px;
}

/* Floating Label Inputs */
.item-inputs .input-group input {
    width: 100%;
    padding: 1rem 0.75rem 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    font-size: 1rem;
    color: var(--gray-100);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.item-inputs .input-group label {
    position: absolute;
    top: 1rem;
    left: 0.75rem;
    font-size: 0.9rem;
    color: var(--gray-400);
    transition: all 0.3s ease;
    pointer-events: none;
    font-weight: 500;
    background: transparent;
}

.item-inputs .input-group input:focus + label,
.item-inputs .input-group input:not(:placeholder-shown) + label {
    top: 0.25rem;
    font-size: 0.75rem;
    color: var(--primary-light);
    font-weight: 600;
}

.item-inputs .input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.item-inputs .input-group .input-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
    border-radius: 0 0 0.75rem 0.75rem;
}

.item-inputs .input-group input:focus ~ .input-border {
    width: 100%;
}

/* Item Total Display */
.item-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 0.875rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.75rem;
    font-weight: 600;
    color: var(--success-light);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.total-label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.item-amount {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Totals Section */
.totals-section {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
}

.totals-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
    border-radius: 1rem 1rem 0 0;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 1.1rem;
    color: var(--gray-200);
}

.totals-row.total {
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    margin-top: 1rem;
    padding-top: 1.5rem;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--primary-light);
}

/* NEW: Navigation Buttons */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.nav-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.prev-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--gray-300);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.prev-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--gray-100);
    transform: translateY(-1px);
}

.next-btn {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

/* Generate Button */
.generate-btn {
    background: var(--gradient-primary);
    border: none;
    padding: 1.25rem 2rem;
    border-radius: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.generate-btn:hover::before {
    left: 100%;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Advertisement Modal */
.ad-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ad-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ad-label {
    font-size: 0.8rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.ad-timer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    animation: pulse 1s infinite;
}

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

.ad-body {
    text-align: center;
    margin-bottom: 2rem;
}

.ad-body h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #a5b4fc;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ad-features {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 2rem;
    text-align: left;
}

.feature {
    display: flex;
    align-items: center;
    color: #e5e7eb;
    font-size: 0.95rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.feature:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.upgrade-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    width: 100%;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.close-ad {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #d1d5db;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    cursor: not-allowed;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.close-ad:disabled {
    opacity: 0.5;
}

.close-ad.enabled {
    cursor: pointer;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.close-ad.enabled:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-50%) translateY(-2px);
}

.ad-section {
    margin: 20px 0;
    text-align: center;
    padding: 10px;
    border: 1px dashed #ccc;
    background-color: #f9f9f9;
}

.ad-section img {
    max-width: 100%;
    height: auto;
}

.banner-social-proof {
    position: absolute;
    bottom: 8px;
    right: 15px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .container {
        border-radius: 1rem;
    }
    
    .header {
        padding: 2rem 1.5rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .progress-container {
        padding: 1.5rem;
    }
    
    .step-indicators {
        gap: 0.5rem;
    }
    
    .step-indicator {
        flex-direction: column;
    }
    
    .step-number {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .step-label {
        font-size: 0.75rem;
    }
    
    .main-content {
        padding: 2rem 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .input-group.full-width {
        grid-column: span 1;
    }
    
    .item-inputs {
        flex-direction: column;
        gap: 1rem;
    }
    
    .description-input,
    .qty-input,
    .price-input {
        flex: none;
    }
    
    .input-group.small {
        max-width: none;
    }
    
    .item-total {
        min-width: auto;
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .form-section h3 {
        font-size: 1.25rem;
    }
    
    .form-section {
        padding: 1.5rem;
    }
    
    .form-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-btn {
        width: 100%;
        min-width: auto;
    }
    
    .ad-content {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }

    .ad-body h3 {
        font-size: 1.5rem;
    }

    .close-ad {
        bottom: -40px;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .main-content {
        padding: 1.5rem 1rem;
    }
    
    .form-section {
        padding: 1.25rem;
    }
    
    .progress-container {
        padding: 1rem;
    }
    
    .step-label {
        display: none;
    }
    
    .ad-content {
        padding: 1.25rem;
    }

    .ad-body h3 {
        font-size: 1.25rem;
    }

    .upgrade-btn {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
}