/* ============================================
   biodata-pro - Premium Gen-Z Friendly Styles
   Modern, Clean, 2026-Ready Design
   ============================================ */

/* CSS Variables */
:root {
    /* Premium Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --secondary: #f472b6;
    --secondary-dark: #ec4899;
    
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.3);
    
    /* Gradient Colors */
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-text: linear-gradient(135deg, #667eea 0%, #f093fb 50%, #f5576c 100%);
    --gradient-hero: linear-gradient(180deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
    
    /* Background Colors */
    --bg-dark: #0a0a1a;
    --bg-darker: #050510;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    /* Light Mode Form Colors */
    --bg-form: #ffffff;
    --bg-input: #f8fafc;
    --bg-input-focus: #ffffff;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-dark: #1e293b;
    --text-dark-secondary: #64748b;
    
    /* Border Colors */
    --border-light: rgba(255, 255, 255, 0.1);
    --border-lighter: rgba(255, 255, 255, 0.05);
    --border-form: #e2e8f0;
    
    /* Spacing */
    --container-max: 1200px;
    --section-padding: 100px;
    
    /* Typography */
    --font-primary: 'Space Grotesk', -apple-system, sans-serif;
    --font-secondary: 'Inter', -apple-system, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    
    /* Effects */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-glow: 0 0 40px var(--primary-glow);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-secondary);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* ============================================
   Navigation
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: rgba(10, 10, 26, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    color: white;
}

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

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-link-special {
    color: var(--accent) !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.nav-cta {
    background: var(--gradient-1);
    padding: 10px 24px !important;
    border-radius: var(--radius-lg);
    color: white !important;
}

.nav-cta:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
}

/* Mobile Menu Overlay */
.mobile-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 26, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 40px;
    gap: 8px;
    z-index: 1001;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mobile-menu.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.mobile-menu-link {
    display: block;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.mobile-link-special {
    color: var(--accent) !important;
}

.mobile-link-special:hover {
    color: var(--primary) !important;
}

.mobile-menu-cta {
    display: inline-block;
    margin-top: 20px;
    padding: 14px 40px;
    background: var(--gradient-1);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 1rem;
}

.mobile-menu-cta:hover {
    box-shadow: var(--shadow-glow);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.btn-glass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    min-height: 100vh;
    padding: 140px 24px 80px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -200px;
    right: -200px;
    animation: float 8s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--secondary);
    bottom: -100px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 12s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -30px); }
    66% { transform: translate(-20px, 20px); }
}

.hero-container {
    max-width: var(--container-max);
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
}

.badge-icon {
    font-size: 1.1rem;
}

.hero-title {
    font-family: var(--font-primary);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

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

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-light);
}

/* Hero Visual */
.hero-visual {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
    display: none;
}

@media (min-width: 1200px) {
    .hero-visual {
        display: block;
    }
    
    .hero-container {
        text-align: left;
        max-width: 60%;
        margin: 0 0 0 5%;
    }
    
    .hero-actions,
    .hero-stats {
        justify-content: flex-start;
    }
}

.preview-cards {
    position: relative;
    width: 300px;
    height: 400px;
}

.preview-card {
    position: absolute;
    width: 200px;
    height: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card-1 {
    top: 0;
    left: 0;
    z-index: 3;
    animation: cardFloat 6s ease-in-out infinite;
}

.card-2 {
    top: 40px;
    left: 60px;
    z-index: 2;
    animation: cardFloat 6s ease-in-out 0.5s infinite;
}

.card-3 {
    top: 80px;
    left: 120px;
    z-index: 1;
    animation: cardFloat 6s ease-in-out 1s infinite;
}

@keyframes cardFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.mini-template {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mt-header {
    height: 20px;
    background: var(--gradient-1);
    border-radius: 4px;
}

.mt-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    margin: 0 auto;
}

.mt-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mt-line {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.mt-line.short {
    width: 60%;
}

.mini-template.dark {
    background: #1e1e2e;
}

.mini-template.dark .mt-header {
    background: var(--gradient-3);
}

.mini-template.gradient .mt-header {
    background: var(--gradient-2);
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-badge {
    display: inline-block;
    padding: 8px 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
}

.section-title {
    font-family: var(--font-primary);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
}

.section-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Features Section
   ============================================ */
.features {
    padding: var(--section-padding) 0;
    background: var(--bg-darker);
    position: relative;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.feature-icon.gradient-bg {
    background: var(--gradient-1);
}

.feature-icon svg {
    color: white;
}

.feature-card h3 {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ============================================
   Templates Section
   ============================================ */
.templates-section {
    padding: var(--section-padding) 0;
    background: var(--bg-dark);
}

/* Mobile-only: show creator form above template gallery to reduce scrolling */
@media (max-width: 768px) {
    .mobile-reorder-sections {
        display: flex;
        flex-direction: column;
    }

    .mobile-reorder-sections > .creator-section {
        order: 1;
    }

    .mobile-reorder-sections > .templates-section {
        order: 2;
    }

    .mobile-reorder-sections > .how-it-works {
        order: 3;
    }
}

.template-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.template-item {
    text-align: center;
    cursor: pointer;
}

.template-card {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    aspect-ratio: 3/4;
    transition: var(--transition);
    overflow: hidden;
}

.template-card:hover {
    border-color: var(--primary);
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
}

/* Template Preview Container - Scales actual templates */
.template-preview-container {
    width: 600px;
    transform-origin: top left;
    pointer-events: none;
}

.template-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--gradient-1);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
}

.template-badge.new {
    background: var(--gradient-2);
}

.template-name {
    display: block;
    margin-top: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   How It Works Section
   ============================================ */
.how-it-works {
    padding: var(--section-padding) 0;
    background: var(--bg-darker);
}

.steps-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    position: relative;
    text-align: center;
}

.step-number {
    font-family: var(--font-primary);
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.step-content h3 {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.step-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.step-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px auto 0;
    color: var(--primary-light);
}

.step-connector {
    width: 60px;
    height: 2px;
    background: var(--gradient-1);
    margin-top: 100px;
    display: none;
}

@media (min-width: 1024px) {
    .step-connector {
        display: block;
    }
}

/* ============================================
   Creator Section
   ============================================ */
.creator-section {
    padding: var(--section-padding) 0;
    background: var(--bg-dark);
}

.creator-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.form-panel {
    background: var(--bg-form);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.form-header {
    background: var(--bg-input);
    padding: 20px;
    border-bottom: 1px solid var(--border-form);
}

.form-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.form-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.form-tab:hover {
    background: white;
    color: var(--text-dark);
}

.form-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.form-tab svg {
    flex-shrink: 0;
}

.biodata-form {
    padding: 32px;
}

.form-tab-content {
    display: none;
}

.form-tab-content.active {
    display: block;
}

.form-row {
    margin-bottom: 20px;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row.two-col {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.required {
    color: #ef4444;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-form);
    border-radius: var(--radius-md);
    font-family: var(--font-secondary);
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: var(--transition);
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-dark-secondary);
}

/* Field Label Row with Remove Button */
.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.field-label-row label {
    flex: 1;
}

.field-remove-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0.6;
}

.field-remove-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    opacity: 1;
    transform: scale(1.1);
}

.field-remove-btn svg {
    width: 14px;
    height: 14px;
}

/* Hidden field state */
.form-group.field-removed {
    display: none !important;
}

/* Undo removed field banner */
.field-removed-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.field-removed-banner span {
    font-size: 0.85rem;
    color: #ef4444;
}

.field-restore-btn {
    padding: 6px 12px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.field-restore-btn:hover {
    background: var(--primary-dark);
}

/* Photo Upload */
.photo-upload-group {
    margin-bottom: 24px;
}

.photo-upload {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    border: 2px dashed var(--border-form);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.photo-upload:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.photo-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-dark-secondary);
    text-align: center;
    padding: 16px;
}

.photo-placeholder svg {
    color: var(--primary);
}

.photo-placeholder span {
    font-size: 0.9rem;
    font-weight: 500;
}

.photo-placeholder small {
    font-size: 0.8rem;
    opacity: 0.7;
}

.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Form Actions */
.form-actions {
    padding: 24px 32px;
    background: var(--bg-input);
    border-top: 1px solid var(--border-form);
}

.form-actions .btn {
    width: 100%;
}

/* Form Tab Navigation (Next/Previous Buttons) */
.form-tab-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-form);
}

.btn-outline {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--border-form);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.btn-nav-next,
.btn-nav-prev {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 600;
}

.btn-nav-next svg {
    order: 1;
}

.btn-nav-prev svg {
    order: -1;
}

@media (max-width: 500px) {
    .form-tab-nav {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-tab-nav .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-tab-nav > div:empty {
        display: none;
    }
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-form);
    border-radius: var(--radius-xl);
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-form);
}

.modal-header h3 {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: none;
    border-radius: 50%;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Template Sidebar */
.template-sidebar {
    width: 140px;
    flex-shrink: 0;
    background: #f9fafb;
    border-right: 1px solid var(--border-form);
    padding: 16px;
    overflow-y: auto;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-form);
}

.sidebar-title svg {
    color: var(--primary);
}

.template-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-thumb-btn {
    width: 100%;
    aspect-ratio: 3/4;
    background: white;
    border: 2px solid var(--border-form);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dark-secondary);
    text-align: center;
    padding: 8px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.template-thumb-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.template-thumb-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.template-thumb-btn .thumb-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    margin-bottom: 4px;
}

/* Preview Main Area */
.preview-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}

.preview-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.preview-scale {
    width: 600px;
    min-width: 600px;
    max-width: 600px;
    display: block;
    transform-origin: top center;
    transition: transform 0.2s ease;
}

/* Custom Scrollbar for Preview */
.preview-wrapper::-webkit-scrollbar {
    width: 8px;
}

.preview-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.preview-wrapper::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}

.preview-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Watermark Overlay */
.preview-watermark {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.preview-watermark span {
    font-family: var(--font-primary);
    font-size: 48px;
    font-weight: 700;
    color: rgba(99, 102, 241, 0.08);
    letter-spacing: 20px;
    text-transform: uppercase;
    transform: rotate(-25deg);
    white-space: nowrap;
    user-select: none;
}

.biodata-paper {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    width: 100%;
    overflow: hidden;
    position: relative;
    padding-bottom: 32px; /* Space for watermark */
}

.persistent-watermark {
    position: absolute;
    right: 12px;
    bottom: 8px;
    z-index: 100;
    opacity: 0.85;
    font-size: 9px;
    font-weight: 500;
    color: #888;
    pointer-events: none;
    user-select: none;
    background: rgba(255,255,255,0.95);
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.persistent-watermark a {
    color: #0070f3;
    text-decoration: none;
    pointer-events: auto;
}

/* Preview Actions */
.preview-actions {
    padding: 16px 32px;
    background: white;
    border-top: 1px solid var(--border-form);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
}

.preview-actions .btn {
    min-width: 200px;
}

.wedding-card-link {
    background: linear-gradient(135deg, #ec4899 0%, #f97316 100%);
    color: white;
    border: none;
    text-decoration: none;
}

.wedding-card-link:hover {
    background: linear-gradient(135deg, #db2777 0%, #ea580c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.35);
}

/* Hide old modal footer */
.modal-footer {
    display: none;
}

/* Responsive for Modal */
@media (max-width: 768px) {
    .modal {
        align-items: stretch;       /* ADD — stretch modal to full screen */
        padding: 0;                 /* ADD — remove any padding */
    }

    .modal-content {
        height: 100vh;              /* CHANGE from max-height to height */
        height: 100dvh;             /* CHANGE — forces exact viewport height */
        max-height: 100vh;
        max-height: 100dvh;
        display: flex;
        flex-direction: column;
        border-radius: 0;           /* ADD — cleaner full-screen on mobile */
        overflow: hidden;           /* ADD — clip children */
    }

    .modal-header {
        flex-shrink: 0;             /* ADD — header never shrinks */
    }

    .modal-body {
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        min-height: 0;              /* CRITICAL */
    }

    .template-sidebar {
        flex-shrink: 0;             /* ADD */
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-form);
        padding: 12px;
        max-height: 120px;
    }

    .template-thumbs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .template-thumb-btn {
        width: 70px;
        flex-shrink: 0;
    }

    .sidebar-title {
        display: none;
    }

    .preview-main {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;              /* CRITICAL */
        padding-bottom: 110px;      /* ensure content not hidden */
    }

    .preview-wrapper {
        flex: 0 0 auto;
        overflow: visible;
        padding: 16px;
        min-height: 0;              /* CRITICAL */
    }

    .preview-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        bottom: env(safe-area-inset-bottom);
        flex-shrink: 0;
        padding: 12px 16px;
        background: var(--bg-white, #fff);
        border-top: 1px solid var(--border-form);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 4000;
        flex-wrap: wrap;
        gap: 8px;
    }

    .preview-actions .btn {
        min-width: unset;
        flex: 1 1 45%;
        font-size: 0.85rem;
        padding: 10px 12px;
    }

    .preview-actions .wedding-card-link {
        font-size: 0.8rem;
    }
}

/* ============================================
   Footer
   ============================================ */
.footer {
    padding: 60px 0 30px;
    background: var(--bg-darker);
    border-top: 1px solid var(--border-light);
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

.footer-brand .nav-logo {
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-secondary);
    max-width: 300px;
    font-size: 0.95rem;
}

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

.footer-column h4 {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-column a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 10px;
    transition: var(--transition);
}

.footer-column a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.footer-bottom p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    :root {
        --section-padding: 60px;
    }
    
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .hero {
        padding: 100px 16px 60px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .biodata-form {
        padding: 20px;
    }
    
    .form-actions {
        padding: 20px;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    body * {
        visibility: hidden !important;
    }
    
    #biodataPaper, #biodataPaper * {
        visibility: visible !important;
    }
    
    #biodataPaper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    
    .modal, .modal-header, .modal-footer, .template-selector {
        display: none !important;
    }
}

/* ============================================
   Toast Notification
   ============================================ */
.field-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

.field-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.toast-undo-btn {
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.toast-undo-btn:hover {
    background: var(--primary-dark);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* ============================================
   SEO Content Section Styles
   ============================================ */
.seo-content {
    padding: 80px 0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.seo-article {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    color: #374151;
}

.seo-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 24px;
    line-height: 1.3;
    text-align: center;
}

.seo-intro {
    font-size: 1.125rem;
    color: #4b5563;
    margin-bottom: 40px;
    text-align: center;
    padding: 0 20px;
}

.seo-article h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 40px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.seo-article h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin: 24px 0 12px 0;
}

.seo-article p {
    margin-bottom: 16px;
    font-size: 1rem;
}

.seo-list {
    margin: 16px 0 24px 0;
    padding-left: 24px;
}

.seo-list li {
    margin-bottom: 10px;
    padding-left: 8px;
}

.seo-list.numbered {
    list-style-type: decimal;
}

.seo-cta-box {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin: 48px 0;
    color: white;
}

.seo-cta-box h3 {
    font-size: 1.5rem;
    color: white;
    margin: 0 0 12px 0;
}

.seo-cta-box p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 24px;
}

.seo-cta-box .btn {
    background: white;
    color: #6366f1;
    font-weight: 600;
}

.seo-cta-box .btn:hover {
    background: #f8fafc;
    transform: translateY(-2px);
}

.faq-title {
    margin-top: 48px !important;
}

.faq-section {
    margin-top: 24px;
}

.faq-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.faq-item h3 {
    font-size: 1.0625rem;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.faq-item p {
    color: #6b7280;
    margin: 0;
    font-size: 0.9375rem;
}

@media (max-width: 768px) {
    .seo-content {
        padding: 48px 0;
    }
    
    .seo-main-title {
        font-size: 1.75rem;
    }
    
    .seo-intro {
        font-size: 1rem;
    }
    
    .seo-article h2 {
        font-size: 1.25rem;
    }
    
    .seo-cta-box {
        padding: 28px 20px;
    }
    
    .seo-cta-box h3 {
        font-size: 1.25rem;
    }
}
