/* ============================================
   Market Intelligence Scraper v2 — Premium Dark UI
   Deep Scraping + Metrics + Intelligence Report
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;

    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;

    --gradient-primary: linear-gradient(135deg, #06b6d4, #8b5cf6);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ec4899);
    --gradient-cool: linear-gradient(135deg, #3b82f6, #06b6d4);
    --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 60%),
                   radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-cyan: 0 0 30px rgba(6, 182, 212, 0.15);
    --shadow-glow-purple: 0 0 30px rgba(139, 92, 246, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ── Body ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--gradient-bg);
    pointer-events: none;
    z-index: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Layout ── */
.app-container { position: relative; z-index: 1; display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: 300px; min-width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-glass);
    display: flex; flex-direction: column;
    padding: 24px 16px; gap: 16px;
    overflow-y: auto;
    transition: transform var(--transition-slow);
}
.sidebar-header { display: flex; align-items: center; gap: 12px; padding: 8px 8px 16px; border-bottom: 1px solid var(--border-glass); }
.sidebar-logo { width: 36px; height: 36px; background: var(--gradient-primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.sidebar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sidebar-subtitle { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.sidebar-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); font-weight: 600; padding: 16px 8px 4px; }

.history-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.history-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition-fast); border: 1px solid transparent; gap: 8px; }
.history-item:hover { background: var(--bg-glass-hover); border-color: var(--border-glass-hover); }
.history-item.active { background: rgba(6, 182, 212, 0.1); border-color: rgba(6, 182, 212, 0.2); }
.history-keyword { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.history-meta { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.history-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.history-status.done { background: var(--accent-green); }
.history-status.running, .history-status.searching, .history-status.scraping, .history-status.analyzing { background: var(--accent-amber); animation: pulse 1.5s infinite; }
.history-status.error { background: var(--accent-red); }
.history-status.pending { background: var(--text-dim); }
.history-delete-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border: none; border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.history-item:hover .history-delete-btn { opacity: 1; }
.history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}
.history-delete-btn:active { transform: scale(0.9); }

.history-item.deleting {
    animation: slideOutLeft 0.3s ease forwards;
    pointer-events: none;
}

@keyframes slideOutLeft {
    to { opacity: 0; transform: translateX(-100%); height: 0; padding: 0 12px; margin: 0; overflow: hidden; }
}

.history-empty { text-align: center; padding: 32px 16px; color: var(--text-dim); font-size: 13px; }
.history-empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

/* ── Main Content ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 32px 40px; }

/* ── Hero / Search ── */
.hero-section { text-align: center; padding: 48px 0 32px; transition: all var(--transition-slow); }
.hero-section.compact { padding: 16px 0 24px; }
.hero-title { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.2; margin-bottom: 12px; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; transition: font-size var(--transition-slow); }
.hero-section.compact .hero-title { font-size: 24px; }
.hero-description { font-size: 16px; color: var(--text-secondary); max-width: 540px; margin: 0 auto 32px; font-weight: 300; transition: all var(--transition-slow); }
.hero-section.compact .hero-description { display: none; }

/* ── Search Bar ── */
.search-container { max-width: 680px; margin: 0 auto; position: relative; }
.search-wrapper { display: flex; align-items: center; background: var(--bg-glass); border: 1px solid var(--border-glass); border-radius: var(--radius-xl); padding: 6px 6px 6px 24px; transition: all var(--transition-normal); backdrop-filter: blur(20px); }
.search-wrapper:focus-within { border-color: var(--accent-cyan); box-shadow: var(--shadow-glow-cyan); background: rgba(255,255,255,0.06); }
.search-icon { color: var(--text-dim); font-size: 18px; margin-right: 12px; flex-shrink: 0; }
.search-input { flex: 1; background: none; border: none; outline: none; color: var(--text-primary); font-size: 15px; font-family: 'Inter', sans-serif; font-weight: 400; padding: 12px 0; }
.search-input::placeholder { color: var(--text-dim); }
.search-options { display: flex; align-items: center; gap: 8px; margin-right: 8px; }
.result-count-select { background: rgba(255,255,255,0.06); border: 1px solid var(--border-glass); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 12px; font-family: 'Inter', sans-serif; padding: 6px 8px; outline: none; cursor: pointer; appearance: none; }
.search-btn { background: var(--gradient-primary); border: none; border-radius: 20px; color: white; font-size: 14px; font-weight: 600; font-family: 'Inter', sans-serif; padding: 12px 28px; cursor: pointer; transition: all var(--transition-normal); white-space: nowrap; letter-spacing: 0.2px; }
.search-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3); }
.search-btn:active { transform: translateY(0); }
.search-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Progress Bar ── */
.progress-section { max-width: 680px; margin: 16px auto 0; display: none; }
.progress-section.active { display: block; }
.progress-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.progress-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.progress-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.progress-bar-track { width: 100%; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--gradient-primary); border-radius: 2px; width: 0%; transition: width 0.5s ease; }
.progress-bar-fill.indeterminate { width: 40%; animation: indeterminate 1.5s ease-in-out infinite; }

/* ══════════════════════════════════════
   View Tabs (Results | Metrics | Report)
   ══════════════════════════════════════ */

.view-tabs-container { display: none; margin-bottom: 28px; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.view-tabs-container.active { display: flex; }

.view-tabs {
    display: flex; gap: 4px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 4px;
    width: fit-content;
}
.view-tab {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    display: flex; align-items: center; gap: 8px;
}
.view-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.view-tab.active { background: var(--gradient-primary); color: white; }
.view-tab-icon { font-size: 16px; }
.view-tab-badge {
    background: rgba(255,255,255,0.15);
    padding: 1px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 700;
}

/* Panel visibility */
.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeIn 0.3s ease; }

/* ══════════════════════════════════════
   Deep Dive Search Bar
   ══════════════════════════════════════ */

.deep-dive-section {
    display: none;
    max-width: 680px;
    margin: 16px auto 0;
    animation: fadeInUp 0.4s ease both;
}
.deep-dive-section.active { display: block; }

.deep-dive-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.deep-dive-icon { font-size: 16px; }
.deep-dive-label {
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted);
}

.deep-dive-form {
    background: var(--bg-glass);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-lg);
    padding: 16px;
    backdrop-filter: blur(20px);
    transition: all var(--transition-normal);
}
.deep-dive-form:focus-within {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.12);
}

.deep-dive-input-row {
    display: flex; align-items: center; gap: 8px;
}
.deep-dive-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px; font-family: 'Inter', sans-serif;
    padding: 10px 14px;
    outline: none;
    transition: border-color var(--transition-fast);
}
.deep-dive-input::placeholder { color: var(--text-dim); }
.deep-dive-input:focus { border-color: var(--accent-purple); }

.deep-dive-count {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px; font-family: 'Inter', sans-serif;
    padding: 10px 8px;
    outline: none; cursor: pointer; appearance: none;
}

.deep-dive-btn {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border: none; border-radius: var(--radius-sm);
    color: white; font-size: 13px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    padding: 10px 20px; cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-normal);
}
.deep-dive-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}
.deep-dive-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.deep-dive-suggestions {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 10px;
}
.deep-dive-chip {
    padding: 5px 14px; border-radius: 16px;
    font-size: 12px; font-weight: 500;
    font-family: 'Inter', sans-serif;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.deep-dive-chip:hover {
    background: rgba(139, 92, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.35);
    transform: translateY(-1px);
}

/* ── Summary Stats ── */
.summary-section { display: none; margin-bottom: 28px; }
.summary-section.active { display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.summary-card { background: var(--bg-glass); border: 1px solid var(--border-glass); border-radius: var(--radius-md); padding: 20px; backdrop-filter: blur(12px); transition: all var(--transition-normal); }
.summary-card:hover { border-color: var(--border-glass-hover); background: var(--bg-glass-hover); transform: translateY(-2px); }
.summary-card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); font-weight: 600; margin-bottom: 8px; }
.summary-card-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.summary-card-value.cyan { color: var(--accent-cyan); }
.summary-card-value.green { color: var(--accent-green); }
.summary-card-value.amber { color: var(--accent-amber); }
.summary-card-value.red { color: var(--accent-red); }
.summary-card-value.purple { color: var(--accent-purple); }
.summary-card-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── Action Bar ── */
.action-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.category-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.category-tab { padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; border: 1px solid var(--border-glass); background: var(--bg-glass); color: var(--text-secondary); transition: all var(--transition-fast); white-space: nowrap; }
.category-tab:hover { background: var(--bg-glass-hover); border-color: var(--border-glass-hover); color: var(--text-primary); }
.category-tab.active { background: rgba(6,182,212,0.15); border-color: rgba(6,182,212,0.3); color: var(--accent-cyan); }
.category-tab .tab-count { display: inline-block; margin-left: 6px; background: rgba(255,255,255,0.08); padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.category-tab.active .tab-count { background: rgba(6,182,212,0.2); }

.export-btns { display: flex; gap: 8px; }
.export-btn { padding: 8px 14px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; border: 1px solid var(--border-glass); background: var(--bg-glass); color: var(--text-secondary); transition: all var(--transition-fast); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.export-btn:hover { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.3); color: var(--accent-cyan); transform: translateY(-1px); }
.export-btn#exportJSON:hover { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.3); color: var(--accent-purple); }
.export-btn#exportCompCSV:hover { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: var(--accent-amber); }

/* ── Results Grid ── */
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.result-card { background: var(--bg-glass); border: 1px solid var(--border-glass); border-radius: var(--radius-md); padding: 24px; backdrop-filter: blur(12px); transition: all var(--transition-normal); display: flex; flex-direction: column; gap: 12px; animation: fadeInUp 0.4s ease both; }
.result-card:hover { border-color: var(--border-glass-hover); background: var(--bg-glass-hover); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.result-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.result-title { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text-primary); flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-title a { color: inherit; text-decoration: none; transition: color var(--transition-fast); }
.result-title a:hover { color: var(--accent-cyan); }

.sentiment-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.sentiment-badge.positive { background: rgba(16,185,129,0.12); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.2); }
.sentiment-badge.neutral { background: rgba(245,158,11,0.12); color: var(--accent-amber); border: 1px solid rgba(245,158,11,0.2); }
.sentiment-badge.negative { background: rgba(239,68,68,0.12); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.2); }

.result-snippet { font-size: 13px; color: var(--text-secondary); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-glass); }
.result-domain { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.result-domain-favicon { width: 14px; height: 14px; border-radius: 3px; background: var(--bg-glass); }
.result-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.result-tag { padding: 3px 10px; border-radius: 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.result-tag.news { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.result-tag.competitor { background: rgba(236,72,153,0.12); color: var(--accent-pink); }
.result-tag.pricing { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.result-tag.trend-analysis { background: rgba(139,92,246,0.12); color: var(--accent-purple); }
.result-tag.social-media { background: rgba(6,182,212,0.12); color: var(--accent-cyan); }
.result-tag.general { background: rgba(148,163,184,0.1); color: var(--text-muted); }
.result-wordcount { font-size: 11px; color: var(--text-dim); }

.result-expand-btn { background: none; border: none; color: var(--accent-cyan); font-size: 12px; font-family: 'Inter', sans-serif; font-weight: 500; cursor: pointer; padding: 4px 0; transition: opacity var(--transition-fast); }
.result-expand-btn:hover { opacity: 0.7; }
.result-full-text { display: none; font-size: 13px; color: var(--text-secondary); line-height: 1.7; max-height: 300px; overflow-y: auto; padding: 12px; background: rgba(0,0,0,0.2); border-radius: var(--radius-sm); white-space: pre-wrap; }
.result-full-text.visible { display: block; animation: fadeIn 0.3s ease; }

/* ══════════════════════════════════════
   Metrics Panel
   ══════════════════════════════════════ */

.metrics-panel { display: flex; flex-direction: column; gap: 32px; }

.metric-dimension {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 28px;
    backdrop-filter: blur(12px);
    animation: fadeInUp 0.4s ease both;
}
.metric-dimension-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-glass);
}
.metric-dimension-icon { font-size: 28px; }
.metric-dimension-title { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.metric-dimension-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Metric stat row */
.metric-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.metric-stat {
    text-align: center;
    padding: 16px 12px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.03);
}
.metric-stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 4px; }

/* CSS Bar Charts */
.metric-bars { display: flex; flex-direction: column; gap: 10px; }
.metric-bar-row { display: flex; align-items: center; gap: 12px; }
.metric-bar-label { font-size: 12px; color: var(--text-secondary); min-width: 120px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-bar-track { flex: 1; height: 24px; background: rgba(255,255,255,0.04); border-radius: 4px; overflow: hidden; position: relative; }
.metric-bar-fill {
    height: 100%;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 8px;
    font-size: 11px; font-weight: 600; color: white;
    min-width: fit-content;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.metric-bar-fill.cyan { background: linear-gradient(90deg, rgba(6,182,212,0.6), var(--accent-cyan)); }
.metric-bar-fill.purple { background: linear-gradient(90deg, rgba(139,92,246,0.6), var(--accent-purple)); }
.metric-bar-fill.blue { background: linear-gradient(90deg, rgba(59,130,246,0.6), var(--accent-blue)); }
.metric-bar-fill.green { background: linear-gradient(90deg, rgba(16,185,129,0.6), var(--accent-green)); }
.metric-bar-fill.amber { background: linear-gradient(90deg, rgba(245,158,11,0.6), var(--accent-amber)); }
.metric-bar-fill.red { background: linear-gradient(90deg, rgba(239,68,68,0.6), var(--accent-red)); }
.metric-bar-fill.pink { background: linear-gradient(90deg, rgba(236,72,153,0.6), var(--accent-pink)); }
.metric-bar-count { font-size: 12px; color: var(--text-dim); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* Keyword tags */
.metric-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.metric-tag {
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 12px; font-weight: 500;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.metric-tag:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.metric-tag.highlight { background: rgba(6,182,212,0.12); border-color: rgba(6,182,212,0.2); color: var(--accent-cyan); }

/* Price tags */
.price-tag {
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 12px; font-weight: 600;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.2);
    color: var(--accent-green);
    font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════
   Intelligence Report Panel
   ══════════════════════════════════════ */

.report-panel { display: flex; flex-direction: column; gap: 32px; }

.report-header {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 28px;
    backdrop-filter: blur(12px);
}
.report-header-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.report-header-sub { font-size: 14px; color: var(--text-secondary); }
.report-header-keyword {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    background: rgba(6,182,212,0.12);
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Recommendation sections */
.report-section { animation: fadeInUp 0.4s ease both; }
.report-section-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px;
}
.report-section-icon { font-size: 28px; }
.report-section-title { font-size: 18px; font-weight: 700; }
.report-section-count {
    padding: 2px 10px; border-radius: 10px;
    font-size: 12px; font-weight: 700;
}

/* Recommendation cards */
.rec-card {
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 12px;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.3s ease both;
}
.rec-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.rec-card.improve { border-left: 4px solid var(--accent-green); }
.rec-card.introduce { border-left: 4px solid var(--accent-blue); }
.rec-card.remove { border-left: 4px solid var(--accent-red); }

.rec-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.rec-card-area { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.rec-card-priority {
    padding: 3px 10px; border-radius: 10px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    flex-shrink: 0;
}
.rec-card-priority.high { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.rec-card-priority.medium { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.rec-card-priority.low { background: rgba(148,163,184,0.1); color: var(--text-muted); }

.rec-card-insight { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 12px; }
.rec-card-action {
    font-size: 13px; color: var(--text-primary); line-height: 1.6;
    padding: 12px 16px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-cyan);
    margin-bottom: 12px;
}
.rec-card-themes { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-theme-tag {
    padding: 3px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 500;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
}

/* Section colors */
.improve-section .report-section-count { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.introduce-section .report-section-count { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.remove-section .report-section-count { background: rgba(239,68,68,0.15); color: var(--accent-red); }

/* ── Top Keywords ── */
.top-keywords-section {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.top-keywords-title { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 12px; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 20px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-message { font-size: 14px; color: var(--text-muted); max-width: 400px; margin: 0 auto; }

/* ── Mobile Sidebar Toggle ── */
.sidebar-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 100; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-secondary); border: 1px solid var(--border-glass); color: var(--text-primary); font-size: 18px; cursor: pointer; align-items: center; justify-content: center; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 49; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.open { display: block; }
    .sidebar-toggle { display: flex; }
    .main-content { padding: 24px 20px; padding-top: 64px; }
    .hero-title { font-size: 28px; }
    .results-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .metric-stats-row { grid-template-columns: repeat(2, 1fr); }
    .metric-bar-label { min-width: 80px; font-size: 11px; }
}
@media (max-width: 500px) {
    .summary-grid { grid-template-columns: 1fr; }
    .search-wrapper { flex-wrap: wrap; border-radius: var(--radius-lg); padding: 12px; gap: 8px; }
    .search-input { width: 100%; order: -1; }
    .search-btn { flex: 1; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .category-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .view-tabs { width: 100%; }
    .view-tab { flex: 1; justify-content: center; padding: 8px 12px; font-size: 12px; }
}
/* ── Industry Intelligence Dashboard ── */
.industry-intel-section {
    margin-bottom: 40px;
    animation: fadeInUp 0.5s ease both;
}

.industry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 28px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
}

.industry-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.industry-confidence {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.conf-label { font-size: 10px; text-transform: uppercase; color: var(--text-dim); font-weight: 600; letter-spacing: 1px; }
.conf-value { font-size: 14px; font-weight: 700; color: var(--accent-cyan); }

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

.intel-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all var(--transition-normal);
}

.intel-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glass-hover);
    background: var(--bg-glass-hover);
    box-shadow: var(--shadow-lg);
}

.intel-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.intel-card-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.05);
}

.intel-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.intel-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intel-datapoint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.intel-label { font-size: 13px; color: var(--text-secondary); }
.intel-value { font-size: 13px; font-weight: 600; color: var(--accent-cyan); text-align: right; }

/* Industry Color Themes */
.industry-retail .intel-card-icon { color: var(--accent-green); background: rgba(16,185,129,0.1); }
.industry-retail .intel-value { color: var(--accent-green); }

.industry-manufacturing .intel-card-icon { color: var(--accent-amber); background: rgba(245,158,11,0.1); }
.industry-manufacturing .intel-value { color: var(--accent-amber); }

.industry-fintech .intel-card-icon { color: var(--accent-blue); background: rgba(59,130,246,0.1); }
.industry-fintech .intel-value { color: var(--accent-blue); }

.industry-insurance .intel-card-icon { color: var(--accent-purple); background: rgba(139,92,246,0.1); }
.industry-insurance .intel-value { color: var(--accent-purple); }

/* ── Scraper Config Table ── */
.config-section {
    margin-top: 48px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: blur(20px);
}

.config-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-table-wrapper { overflow-x: auto; }
.config-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.config-table th {
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border-glass);
}

.config-table td {
    padding: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.priority-pill {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.priority-pill.high { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.priority-pill.medium { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.priority-pill.low { background: rgba(148,163,184,0.1); color: var(--text-muted); }

.freq-tag {
    font-weight: 600;
    color: var(--accent-cyan);
}

/* ══════════════════════════════════════
   Competitors Panel
   ══════════════════════════════════════ */

.competitors-panel { display: flex; flex-direction: column; gap: 28px; }

.competitors-header {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 28px;
    backdrop-filter: blur(12px);
}
.competitors-header-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.competitors-header-sub { font-size: 14px; color: var(--text-secondary); }

/* ── Competitor Comparison Chart ── */
.comp-comparison-section {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
}
.comp-comparison-title {
    font-size: 14px; font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.comp-comparison-bars { display: flex; flex-direction: column; gap: 12px; }

.comp-bar-row { display: flex; align-items: center; gap: 12px; }
.comp-bar-name {
    min-width: 140px; max-width: 140px;
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: right;
}
.comp-bar-track {
    flex: 1; height: 28px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    position: relative; overflow: hidden;
}
.comp-bar-center {
    position: absolute; left: 50%; top: 0; bottom: 0;
    width: 1px; background: rgba(255,255,255,0.1);
}
.comp-bar-fill {
    position: absolute; top: 3px; bottom: 3px;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.comp-bar-fill.positive { left: 50%; }
.comp-bar-fill.negative { right: 50%; }
.comp-bar-score {
    min-width: 50px; text-align: right;
    font-size: 13px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ── Competitor Cards Grid ── */
.competitors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.competitor-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(16px);
    display: flex; flex-direction: column; gap: 16px;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.4s ease both;
}
.competitor-card:hover {
    border-color: var(--border-glass-hover);
    background: var(--bg-glass-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Card Header */
.comp-card-header {
    display: flex; align-items: center; gap: 12px;
}
.comp-rank {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800;
    background: var(--gradient-primary);
    color: white;
    flex-shrink: 0;
}
.comp-name-block { flex: 1; min-width: 0; }
.comp-name {
    font-size: 17px; font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.comp-mentions {
    font-size: 11px; color: var(--text-dim);
    margin-top: 2px;
}

.comp-sentiment-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 700;
    white-space: nowrap; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.comp-sentiment-badge.positive { background: rgba(16,185,129,0.12); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.2); }
.comp-sentiment-badge.neutral { background: rgba(245,158,11,0.12); color: var(--accent-amber); border: 1px solid rgba(245,158,11,0.2); }
.comp-sentiment-badge.negative { background: rgba(239,68,68,0.12); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.2); }

/* Description */
.comp-description {
    font-size: 13px; color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-glass);
}

/* Signals Grid */
.comp-signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.comp-signal-group {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.12);
    border: 1px solid rgba(255,255,255,0.03);
}
.comp-signal-title {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 8px; color: var(--text-dim);
}
.comp-signal-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.comp-signal-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 500;
}
.comp-signal-tag.strength { background: rgba(16,185,129,0.1); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.15); }
.comp-signal-tag.weakness { background: rgba(239,68,68,0.1); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.15); }
.comp-signal-tag.pricing { background: rgba(245,158,11,0.1); color: var(--accent-amber); border: 1px solid rgba(245,158,11,0.15); }
.comp-signal-tag.innovation { background: rgba(139,92,246,0.1); color: var(--accent-purple); border: 1px solid rgba(139,92,246,0.15); }
.comp-signal-tag.partnership { background: rgba(59,130,246,0.1); color: var(--accent-blue); border: 1px solid rgba(59,130,246,0.15); }

.comp-signal-count {
    background: rgba(255,255,255,0.1);
    padding: 0px 6px; border-radius: 8px;
    font-size: 10px; font-weight: 700;
}

/* Sources */
.comp-sources { border-top: 1px solid var(--border-glass); padding-top: 12px; }
.comp-expand-btn {
    background: none; border: none;
    color: var(--accent-cyan); font-size: 12px;
    font-family: 'Inter', sans-serif; font-weight: 500;
    cursor: pointer; padding: 4px 0;
    transition: opacity var(--transition-fast);
}
.comp-expand-btn:hover { opacity: 0.7; }

.comp-sources-body {
    display: none; margin-top: 10px;
    flex-direction: column; gap: 6px;
}
.comp-sources-body.visible { display: flex; animation: fadeIn 0.3s ease; }

.comp-source-link {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.15);
    text-decoration: none; color: var(--text-secondary);
    transition: all var(--transition-fast);
    overflow: hidden;
}
.comp-source-link:hover {
    background: rgba(0,0,0,0.25);
    color: var(--text-primary);
}
.comp-source-favicon { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.comp-source-title {
    flex: 1; font-size: 12px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.comp-source-domain {
    font-size: 10px; color: var(--text-dim);
    white-space: nowrap; flex-shrink: 0;
}

/* ── Finding competitors status ── */
.history-status.finding_competitors {
    background: var(--accent-purple);
    animation: pulse 1.5s infinite;
}

/* ── Responsive adjustments ── */
@media (max-width: 900px) {
    .competitors-grid { grid-template-columns: 1fr; }
    .comp-bar-name { min-width: 100px; max-width: 100px; font-size: 12px; }
    .comp-signals-grid { grid-template-columns: 1fr; }
}

