/* ── Base & Reset ─────────────────────────────────────────────────────────── */
:root {
    --bg-primary: #0a0a1a;
    --bg-card: #0f1023;
    --bg-input: #141432;
    --bg-hover: #1a1a3e;
    --border: #1e1e3a;
    --border-focus: #3b82f6;
    --text-primary: #e8e8f0;
    --text-secondary: #8888a8;
    --text-muted: #555577;
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.15);
    --amber-dark: #b47708;
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.15);
    --green: #22c55e;
    --red: #ef4444;
    --purple: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Particle Background ────────────────────────────────────────────────── */
#particleCanvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0; pointer-events: none; opacity: 0.4;
}

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.top-bar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge {
    font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: 20px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.2);
    letter-spacing: 0.05em;
}
.status-badge.loading { background: rgba(245, 158, 11, 0.1); color: var(--amber); border-color: rgba(245, 158, 11, 0.2); }
.status-badge.error { background: rgba(239, 68, 68, 0.1); color: var(--red); border-color: rgba(239, 68, 68, 0.2); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--amber), var(--amber-dark));
    color: #000; font-weight: 700; font-size: 13px;
    border: none; border-radius: 8px; cursor: pointer;
    transition: all 0.2s; letter-spacing: 0.02em;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--amber-glow), 0 0 40px var(--amber-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 20px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary); font-weight: 600; font-size: 13px;
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

.btn-generate {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff; font-weight: 600; font-size: 12px;
    border: none; border-radius: 8px; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.btn-generate:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-generate.generating { animation: pulse-purple 1.5s infinite; }

@keyframes pulse-purple {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 20px 4px rgba(124, 58, 237, 0.2); }
}

.btn-add-ad {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px;
    background: transparent; border: 2px dashed var(--border); border-radius: 12px;
    color: var(--text-secondary); font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all 0.2s;
}
.btn-add-ad:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-glow); }

.btn-download {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px; color: var(--blue); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.btn-download:hover { background: rgba(59, 130, 246, 0.2); box-shadow: 0 2px 12px var(--blue-glow); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* NICHE QUIZ STYLES */
/* ═══════════════════════════════════════════════════════════════════════════ */

.quiz-section {
    position: relative; z-index: 1;
    max-width: 1100px; margin: 0 auto;
    padding: 40px 24px 60px;
}

/* Step Indicator */
.quiz-step-indicator {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 48px; position: relative;
    max-width: 500px; margin-left: auto; margin-right: auto;
}

.step-line {
    position: absolute; top: 18px; left: 60px; right: 60px;
    height: 3px; background: var(--border); border-radius: 2px;
}
.step-line-fill {
    height: 100%; width: 0%; border-radius: 2px;
    background: linear-gradient(90deg, var(--amber), var(--purple));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-dot {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    position: relative; z-index: 2; flex: 1;
}
.step-num {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-card); border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: var(--text-muted);
    transition: all 0.3s;
}
.step-label {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    transition: color 0.3s;
}
.step-dot.active .step-num {
    background: linear-gradient(135deg, var(--amber), #d97706);
    border-color: var(--amber); color: #000;
    box-shadow: 0 0 20px var(--amber-glow);
}
.step-dot.active .step-label { color: var(--amber); }
.step-dot.completed .step-num {
    background: var(--green); border-color: var(--green); color: #fff;
}
.step-dot.completed .step-label { color: var(--green); }

/* Quiz Steps */
.quiz-step { animation: fadeInUp 0.4s ease; }

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

.quiz-header { text-align: center; margin-bottom: 32px; }
.quiz-title {
    font-size: 32px; font-weight: 800; letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #bbb);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}
.quiz-subtitle { font-size: 16px; color: var(--text-secondary); }
.quiz-back {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none; color: var(--text-secondary);
    font-size: 13px; font-weight: 600; cursor: pointer;
    margin-bottom: 16px; transition: color 0.2s;
}
.quiz-back:hover { color: var(--amber); }

/* Industry Grid */
.industry-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 12px; max-width: 800px; margin: 0 auto;
}
@media (max-width: 768px) { .industry-grid { grid-template-columns: repeat(2, 1fr); } }

.industry-card {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 24px 16px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 14px;
    cursor: pointer; transition: all 0.25s; position: relative; overflow: hidden;
}
.industry-card::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(168,85,247,0.05));
    opacity: 0; transition: opacity 0.3s;
}
.industry-card:hover::before { opacity: 1; }
.industry-card:hover {
    border-color: rgba(245, 158, 11, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.industry-card.selected {
    border-color: var(--amber);
    background: rgba(245, 158, 11, 0.08);
    box-shadow: 0 0 30px var(--amber-glow);
}
.industry-emoji { font-size: 32px; position: relative; z-index: 1; }
.industry-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    text-align: center; position: relative; z-index: 1;
}

.custom-input-row {
    display: flex; gap: 12px; max-width: 500px;
    margin: 20px auto 0; align-items: center;
}
.custom-industry-input { flex: 1; }

/* Niche Grid */
.niche-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px; max-width: 900px; margin: 0 auto;
}

.niche-card {
    padding: 16px 20px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; transition: all 0.2s;
    font-size: 14px; font-weight: 500; color: var(--text-primary);
    text-align: center;
}
.niche-card:hover {
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.06);
    transform: translateY(-2px);
}
.niche-card.selected {
    border-color: var(--purple);
    background: rgba(168, 85, 247, 0.1);
    box-shadow: 0 0 20px var(--purple-glow);
}

/* Niche Loading */
.niche-loading {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    padding: 60px 0;
}
.niche-loading p { color: var(--text-secondary); font-size: 14px; }

.ai-spinner {
    width: 48px; height: 48px; position: relative;
}
.ai-spinner::before, .ai-spinner::after {
    content: ''; position: absolute; inset: 0;
    border: 3px solid transparent; border-radius: 50%;
}
.ai-spinner::before {
    border-top-color: var(--amber);
    animation: spin 1s linear infinite;
}
.ai-spinner::after {
    border-bottom-color: var(--purple);
    animation: spin 1s linear infinite reverse;
    inset: 6px;
}

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

/* Breadcrumb */
.niche-breadcrumb {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 12px; font-size: 14px; color: var(--text-secondary);
}

/* Quiz Complete */
.quiz-complete-card {
    text-align: center; padding: 48px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; max-width: 700px; margin: 0 auto;
    position: relative; overflow: hidden;
}
.quiz-complete-card::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, rgba(245,158,11,0.06) 0%, transparent 70%);
}
.complete-icon {
    font-size: 64px; margin-bottom: 16px; position: relative; z-index: 1;
    animation: bounceIn 0.5s ease;
}
@keyframes bounceIn {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.niche-path {
    display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 8px;
    margin: 24px 0 32px; position: relative; z-index: 1;
}
.niche-path-item {
    padding: 8px 16px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.niche-path-item.highlight {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--amber);
    color: var(--amber);
}
.niche-path-arrow { color: var(--text-muted); font-size: 18px; }

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

.btn-generate-campaigns {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff; font-weight: 700; font-size: 16px;
    border: none; border-radius: 12px; cursor: pointer;
    transition: all 0.3s; letter-spacing: 0.01em;
}
.btn-generate-campaigns:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* PARALLEL CAMPAIGNS SECTION */
/* ═══════════════════════════════════════════════════════════════════════════ */

.campaigns-section {
    position: relative; z-index: 1;
    max-width: 1400px; margin: 0 auto;
    padding: 24px;
}

.campaigns-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.campaigns-title { font-size: 24px; font-weight: 800; }
.campaigns-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.campaigns-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn-generate-all {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff; font-weight: 600; font-size: 13px;
    border: none; border-radius: 8px; cursor: pointer;
    transition: all 0.2s;
}
.btn-generate-all:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3); }
.btn-generate-all:disabled { opacity: 0.5; cursor: not-allowed; }

/* Generation Loading */
.generation-loading {
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    padding: 80px 0; text-align: center;
}
.generation-loading h3 { font-size: 20px; font-weight: 700; }

.gen-loader {
    position: relative; width: 80px; height: 80px;
}
.gen-loader-ring {
    position: absolute; inset: 0;
    border: 3px solid transparent; border-radius: 50%;
}
.gen-loader-ring:nth-child(1) {
    border-top-color: var(--amber);
    animation: spin 1.2s linear infinite;
}
.gen-loader-ring:nth-child(2) {
    inset: 8px;
    border-right-color: var(--purple);
    animation: spin 1.5s linear infinite reverse;
}
.gen-loader-ring:nth-child(3) {
    inset: 16px;
    border-bottom-color: var(--blue);
    animation: spin 2s linear infinite;
}

/* Progress Bar */
.image-progress { padding: 0 0 20px; }
.progress-bar-container {
    height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--amber), var(--purple));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.progress-text {
    font-size: 12px; color: var(--text-secondary);
    margin-top: 8px; text-align: center;
}

/* Campaign Cards Grid */
.campaign-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}
.campaign-card:hover {
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.campaign-card.deselected {
    opacity: 0.4;
    filter: grayscale(0.5);
}

.campaign-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 12px;
}
.campaign-card-title {
    font-size: 15px; font-weight: 700; color: var(--text-primary);
    flex: 1; margin-right: 8px;
}
.campaign-card-number {
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 12px;
    background: rgba(168,85,247,0.1); color: var(--purple);
    border: 1px solid rgba(168,85,247,0.2);
}

.campaign-toggle {
    position: relative;
    width: 42px; height: 22px;
    background: var(--border); border-radius: 11px;
    cursor: pointer; transition: background 0.2s;
    border: none; flex-shrink: 0;
}
.campaign-toggle.active { background: var(--green); }
.campaign-toggle::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: #fff; border-radius: 50%;
    transition: transform 0.2s;
}
.campaign-toggle.active::after { transform: translateX(20px); }

.campaign-card-body { padding: 0 18px 16px; }

.campaign-micro-niche {
    font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 6px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    color: var(--amber);
    display: inline-block; margin-bottom: 12px;
}

.campaign-ad-copy {
    font-size: 13px; line-height: 1.6; color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}

.campaign-targeting {
    font-size: 11px; color: var(--text-muted);
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px; margin-bottom: 12px;
    line-height: 1.5;
}
.campaign-targeting strong { color: var(--text-secondary); }

.campaign-landing {
    font-size: 11px; color: var(--purple);
    padding: 6px 10px;
    background: var(--purple-glow);
    border-radius: 6px; margin-bottom: 12px;
}

.campaign-image-area {
    margin-bottom: 12px; border-radius: 8px; overflow: hidden;
    aspect-ratio: 16/9; background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
}
.campaign-image-area img {
    width: 100%; height: 100%; object-fit: cover;
}
.campaign-image-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: var(--text-muted); font-size: 12px;
}

.campaign-card-actions {
    display: flex; gap: 8px;
}
.campaign-card-actions .btn-generate {
    flex: 1; justify-content: center; font-size: 11px; padding: 6px 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* GALLERY VIEW (Facebook Ad Previews) */
/* ═══════════════════════════════════════════════════════════════════════════ */

.gallery-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.gallery-ad-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s;
}
.gallery-ad-card:hover {
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.gallery-ad-card.deselected { opacity: 0.4; }

.gallery-phone-frame {
    padding: 12px;
}

.gallery-fb-post {
    background: #1c1e21;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 1px solid #2d2f33;
}

.gallery-fb-header {
    display: flex; align-items: center; padding: 10px 12px; gap: 8px;
}
.gallery-fb-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--amber), var(--blue));
    flex-shrink: 0;
}
.gallery-fb-page { font-size: 13px; font-weight: 600; color: #e4e6eb; }
.gallery-fb-sponsored { font-size: 11px; color: #b0b3b8; }

.gallery-fb-body {
    padding: 0 12px 8px; font-size: 13px; line-height: 1.5;
    color: #e4e6eb; white-space: pre-wrap; word-break: break-word;
    min-height: 40px;
}
.gallery-fb-body[contenteditable]:focus {
    outline: 1px solid var(--amber);
    border-radius: 4px; padding: 4px 8px; margin: 0 8px 8px;
    background: rgba(0,0,0,0.3);
}

.gallery-fb-image {
    width: 100%; aspect-ratio: 1.91/1;
    background: #242526; overflow: hidden;
}
.gallery-fb-image img { width: 100%; height: 100%; object-fit: cover; }

.gallery-fb-link-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; background: #242526; border-top: 1px solid #3a3b3c;
}
.gallery-fb-headline {
    font-size: 14px; font-weight: 700; color: #e4e6eb; margin-top: 2px;
}
.gallery-fb-headline[contenteditable]:focus {
    outline: 1px solid var(--amber);
    border-radius: 2px; background: rgba(0,0,0,0.3);
}
.gallery-fb-description {
    font-size: 12px; color: #b0b3b8; margin-top: 2px;
}
.gallery-fb-description[contenteditable]:focus {
    outline: 1px solid var(--amber);
    border-radius: 2px; background: rgba(0,0,0,0.3);
}
.gallery-fb-cta {
    flex-shrink: 0; padding: 6px 14px;
    background: #e4e6eb; color: #050505;
    font-size: 12px; font-weight: 700;
    border: none; border-radius: 6px;
    cursor: default; white-space: nowrap;
}

.gallery-card-controls {
    padding: 10px 12px; display: flex; align-items: center; justify-content: space-between;
    border-top: 1px solid var(--border);
}
.gallery-niche-label {
    font-size: 11px; color: var(--amber); font-weight: 600;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* CSV EXPORT PREVIEW */
/* ═══════════════════════════════════════════════════════════════════════════ */

.csv-preview-section {
    margin-top: 24px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
}
.csv-preview-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.csv-preview-header h3 { font-size: 16px; font-weight: 700; }
.csv-export-table-wrap {
    overflow: auto; max-height: 400px;
}
.csv-export-table-wrap table {
    width: 100%; border-collapse: collapse;
    font-size: 11px; white-space: nowrap;
}
.csv-export-table-wrap th {
    position: sticky; top: 0;
    background: var(--bg-card); color: var(--text-secondary);
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    font-size: 10px; padding: 8px 12px;
    border-bottom: 1px solid var(--border); text-align: left; z-index: 1;
}
.csv-export-table-wrap td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(30, 30, 58, 0.5);
    color: var(--text-primary); max-width: 200px;
    overflow: hidden; text-overflow: ellipsis;
}
.csv-export-table-wrap tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ORIGINAL FORM STYLES (Manual Builder) */
/* ═══════════════════════════════════════════════════════════════════════════ */

.manual-builder { position: relative; z-index: 1; }

.main-layout {
    display: grid; grid-template-columns: 1fr 420px;
    gap: 0; max-width: 1600px; margin: 0 auto;
    min-height: calc(100vh - 65px);
}
@media (max-width: 1200px) {
    .main-layout { grid-template-columns: 1fr; }
    .preview-column { position: static !important; height: auto !important; }
}

.form-column {
    padding: 24px; display: flex; flex-direction: column; gap: 16px;
    overflow-y: auto;
}
.preview-column {
    position: sticky; top: 65px; height: calc(100vh - 65px);
    overflow-y: auto; border-left: 1px solid var(--border);
    background: rgba(10, 10, 26, 0.5); display: flex; flex-direction: column;
}

.form-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; transition: border-color 0.2s;
}
.form-card:hover { border-color: rgba(255, 255, 255, 0.06); }

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; cursor: pointer; user-select: none;
    transition: background 0.15s;
}
.card-header:hover { background: rgba(255, 255, 255, 0.02); }
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.ad-number { color: var(--amber); font-size: 13px; }

.section-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.campaign-icon { background: rgba(245, 158, 11, 0.1); color: var(--amber); }
.adset-icon { background: rgba(59, 130, 246, 0.1); color: var(--blue); }
.ad-icon { background: rgba(168, 85, 247, 0.1); color: var(--purple); }

.card-body { padding: 0 20px 20px; transition: all 0.3s ease; }
.card-body.collapsed { display: none; }
.chevron { transition: transform 0.3s ease; }
.chevron.rotated { transform: rotate(180deg); }

.sub-section { margin-top: 16px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sub-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; cursor: pointer;
    background: rgba(255, 255, 255, 0.01); transition: background 0.15s;
}
.sub-header:hover { background: rgba(255, 255, 255, 0.03); }
.sub-body { padding: 14px; border-top: 1px solid var(--border); }
.sub-body.collapsed { display: none; }
.chevron-sm { transition: transform 0.3s ease; }
.chevron-sm.rotated { transform: rotate(180deg); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.col-span-2 { grid-column: span 2; }
.field-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.req { color: var(--amber); }

.field-input {
    padding: 8px 12px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-primary); font-size: 13px; font-family: 'Inter', sans-serif;
    transition: all 0.15s; outline: none; width: 100%;
}
.field-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.field-input::placeholder { color: var(--text-muted); }
.field-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.char-count { font-size: 10px; color: var(--text-muted); text-align: right; }

select.field-input {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
select.field-input option { background: var(--bg-card); color: var(--text-primary); }

.ai-gen-section {
    margin-top: 16px; border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 8px; overflow: hidden;
    background: rgba(245, 158, 11, 0.03);
}
.ai-gen-header { padding: 10px 14px; }
.ai-gen-body { padding: 0 14px 14px; }
.ai-prompt-input { border-color: rgba(245, 158, 11, 0.2) !important; }
.ai-prompt-input:focus { border-color: var(--amber) !important; box-shadow: 0 0 0 3px var(--amber-glow) !important; }

.generated-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.generated-image-thumb {
    position: relative; width: 80px; height: 80px;
    border-radius: 6px; overflow: hidden;
    border: 2px solid transparent; cursor: pointer; transition: all 0.2s;
}
.generated-image-thumb:hover { border-color: var(--amber); transform: scale(1.05); }
.generated-image-thumb.selected { border-color: var(--amber); box-shadow: 0 0 12px var(--amber-glow); }
.generated-image-thumb img { width: 100%; height: 100%; object-fit: cover; }

.generating-placeholder {
    width: 80px; height: 80px; border-radius: 6px;
    background: var(--bg-input); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { background: var(--bg-input); }
    50% { background: var(--bg-hover); }
    100% { background: var(--bg-input); }
}

/* Preview Tabs */
.preview-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 16px; }
.preview-tab {
    display: flex; align-items: center; gap: 6px;
    padding: 12px 16px; background: none; border: none;
    color: var(--text-muted); font-size: 12px; font-weight: 600;
    cursor: pointer; border-bottom: 2px solid transparent;
    transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.05em;
}
.preview-tab:hover { color: var(--text-secondary); }
.preview-tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* Facebook Preview */
.preview-panel { flex: 1; padding: 20px 16px; overflow-y: auto; }

.fb-preview {
    background: #1c1e21; border-radius: 8px; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 1px solid #2d2f33;
}
.fb-header { display: flex; align-items: center; padding: 12px 16px; gap: 10px; }
.fb-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--amber), var(--blue)); flex-shrink: 0;
}
.fb-page-name { font-size: 14px; font-weight: 600; color: #e4e6eb; }
.fb-sponsored { font-size: 12px; color: #b0b3b8; }
.fb-dots { margin-left: auto; font-size: 20px; color: #b0b3b8; cursor: default; letter-spacing: 2px; }
.fb-body { padding: 0 16px 12px; font-size: 14px; line-height: 1.5; color: #e4e6eb; white-space: pre-wrap; word-break: break-word; }
.fb-image { width: 100%; aspect-ratio: 1.91 / 1; background: #242526; overflow: hidden; }
.fb-image img { width: 100%; height: 100%; object-fit: cover; }
.fb-image-placeholder {
    width: 100%; height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; background: #242526;
}
.fb-link-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #242526; border-top: 1px solid #3a3b3c;
}
.fb-display-link { font-size: 11px; color: #b0b3b8; text-transform: uppercase; letter-spacing: 0.03em; }
.fb-headline { font-size: 15px; font-weight: 700; color: #e4e6eb; margin-top: 2px; line-height: 1.3; }
.fb-description { font-size: 13px; color: #b0b3b8; margin-top: 2px; }
.fb-cta-btn {
    flex-shrink: 0; padding: 8px 16px; background: #e4e6eb;
    color: #050505; font-size: 13px; font-weight: 700;
    border: none; border-radius: 6px; cursor: default; white-space: nowrap;
}
.fb-engagement { display: flex; justify-content: space-between; padding: 8px 16px; font-size: 13px; color: #b0b3b8; }
.fb-actions { display: flex; border-top: 1px solid #3a3b3c; padding: 4px; }
.fb-actions button {
    flex: 1; padding: 8px; background: none; border: none;
    color: #b0b3b8; font-size: 13px; font-weight: 600;
    cursor: default; border-radius: 4px; transition: background 0.15s;
}
.fb-actions button:hover { background: rgba(255, 255, 255, 0.05); }

/* CSV Panel */
.csv-panel { flex: 1; display: flex; flex-direction: column; }
.csv-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.csv-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.csv-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.csv-table-wrap { flex: 1; overflow: auto; }
.csv-table-wrap table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.csv-table-wrap th {
    position: sticky; top: 0; background: var(--bg-card); color: var(--text-secondary);
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    font-size: 10px; padding: 8px 12px;
    border-bottom: 1px solid var(--border); text-align: left; z-index: 1;
}
.csv-table-wrap td {
    padding: 6px 12px; border-bottom: 1px solid rgba(30, 30, 58, 0.5);
    color: var(--text-primary); max-width: 200px;
    overflow: hidden; text-overflow: ellipsis;
}
.csv-table-wrap tr:hover td { background: rgba(255, 255, 255, 0.02); }

.btn-delete-ad {
    padding: 4px 8px; background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 4px;
    color: var(--red); font-size: 11px; cursor: pointer;
    transition: all 0.15s; opacity: 0.6;
}
.btn-delete-ad:hover { opacity: 1; background: rgba(239, 68, 68, 0.1); }

/* Toasts */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 100;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px; border-radius: 8px; font-size: 13px; font-weight: 500;
    animation: slideIn 0.3s ease; backdrop-filter: blur(10px); max-width: 360px;
}
.toast.success { background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.3); color: var(--green); }
.toast.error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--red); }
.toast.info { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); color: var(--blue); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 768px) {
    .field-grid { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }
    .top-bar { padding: 10px 16px; }
    .form-column { padding: 16px; }
    .campaign-cards-grid { grid-template-columns: 1fr; }
    .gallery-view { grid-template-columns: 1fr; }
    .quiz-title { font-size: 24px; }
    .industry-grid { grid-template-columns: repeat(2, 1fr); }
}
