/* ============================================
   FeedbackLens — AI User Feedback Analyzer
   Modern CSS with Dark/Light theme support
   ============================================ */

:root {
    --bg-primary: #0a0b10;
    --bg-secondary: #12131a;
    --bg-card: #181924;
    --bg-card-hover: #1f2133;
    --bg-sidebar: #0e0f16;
    --bg-input: #181924;
    --bg-overlay: rgba(0,0,0,0.6);

    --text-primary: #e8eaed;
    --text-secondary: #9aa0b0;
    --text-muted: #5f6578;

    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-glow: rgba(139,92,246,0.25);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --border: #1e2030;
    --border-light: #2a2d42;

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

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --sidebar-w: 220px;
    --topbar-h: 60px;

    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;
}

[data-theme="light"] {
    --bg-primary: #f5f6fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f1f5;
    --bg-sidebar: #ffffff;
    --bg-input: #f0f1f5;
    --bg-overlay: rgba(0,0,0,0.3);

    --text-primary: #1a1d2e;
    --text-secondary: #5f6578;
    --text-muted: #9aa0b0;

    --border: #e2e4ea;
    --border-light: #d0d2da;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}
button { cursor: pointer; border: none; outline: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }

/* App Layout */
.app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 24px;
    transition: transform var(--transition-slow);
    z-index: 100;
    flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), #ec4899);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.3px; }
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-md);
    background: transparent; color: var(--text-secondary);
    font-weight: 500; font-size: 13px;
    transition: all var(--transition); width: 100%; text-align: left;
}
.nav-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-btn.active { background: var(--accent); color: #fff; box-shadow: var(--shadow-glow); }
.nav-btn i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.theme-switcher { display: flex; justify-content: center; }
.theme-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-card); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); font-size: 14px;
}
.theme-btn:hover { background: var(--accent); color: #fff; transform: rotate(20deg); }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Top Bar */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; gap: 16px; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger { display: none; background: transparent; color: var(--text-secondary); font-size: 18px; padding: 6px; }
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.add-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--accent); color: #fff;
    border-radius: var(--radius-md); font-weight: 600; font-size: 13px;
    transition: all var(--transition); white-space: nowrap;
}
.add-btn:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.add-btn.small { padding: 6px 12px; font-size: 12px; }

/* Views */
.view { display: none; flex: 1; overflow: auto; padding: 20px; }
.view.active { display: flex; flex-direction: column; gap: 20px; }

/* Stats Strip */
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px 16px;
    transition: all var(--transition);
}
.stat:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.stat-icon.blue { background: rgba(59,130,246,0.15); color: #60a5fa; }
.stat-icon.green { background: rgba(34,197,94,0.15); color: #4ade80; }
.stat-icon.red { background: rgba(239,68,68,0.15); color: #f87171; }
.stat-icon.yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.stat-info { display: flex; flex-direction: column; }
.stat-val { font-size: 24px; font-weight: 700; }
.stat-lbl { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* Charts Row */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.chart-card h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 16px; }

/* Donut */
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 24px; }
.donut { width: 140px; height: 140px; position: relative; }
.donut svg { transform: rotate(-90deg); }
.donut-center {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); text-align: center;
}
.donut-val { font-size: 28px; font-weight: 700; }
.donut-lbl { font-size: 11px; color: var(--text-muted); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Bar Chart */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 90px; font-size: 12px; font-weight: 500; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 28px; background: var(--bg-primary); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: var(--radius-sm); transition: width 0.6s ease; display: flex; align-items: center; padding-left: 8px; font-size: 11px; font-weight: 600; color: #fff; min-width: fit-content; }
.bar-fill.bug { background: #ef4444; }
.bar-fill.feature { background: #8b5cf6; }
.bar-fill.praise { background: #22c55e; }
.bar-fill.complaint { background: #f59e0b; }
.bar-fill.question { background: #3b82f6; }
.bar-fill.other { background: #6b7280; }

/* Recent Section */
.recent-section { flex: 1; }
.recent-section h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }

/* Feedback Items */
.feedback-item {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 14px 16px;
    transition: all var(--transition);
}
.feedback-item:hover { border-color: var(--border-light); box-shadow: var(--shadow-sm); }
.feedback-item .fi-sentiment {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.feedback-item .fi-sentiment.positive { background: rgba(34,197,94,0.15); color: #4ade80; }
.feedback-item .fi-sentiment.negative { background: rgba(239,68,68,0.15); color: #f87171; }
.feedback-item .fi-sentiment.neutral { background: rgba(245,158,11,0.15); color: #fbbf24; }
.feedback-item .fi-content { flex: 1; min-width: 0; }
.feedback-item .fi-text { font-size: 13px; line-height: 1.4; margin-bottom: 6px; }
.feedback-item .fi-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.tag-bug { background: rgba(239,68,68,0.15); color: #f87171; }
.tag-feature { background: rgba(139,92,246,0.15); color: #a78bfa; }
.tag-praise { background: rgba(34,197,94,0.15); color: #4ade80; }
.tag-complaint { background: rgba(245,158,11,0.15); color: #fbbf24; }
.tag-question { background: rgba(59,130,246,0.15); color: #60a5fa; }
.tag-positive { background: rgba(34,197,94,0.15); color: #4ade80; }
.tag-negative { background: rgba(239,68,68,0.15); color: #f87171; }
.tag-neutral { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* Analyze View */
.analyze-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; flex: 1; min-height: 0; }
.input-section { display: flex; flex-direction: column; gap: 12px; }
.input-section h2 { font-size: 18px; font-weight: 700; }
.hint { font-size: 12px; color: var(--text-muted); }
#feedbackInput {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 14px; color: var(--text-primary);
    font-size: 13px; line-height: 1.5; resize: none; min-height: 200px;
    transition: border-color var(--transition);
}
#feedbackInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
#feedbackInput::placeholder { color: var(--text-muted); }
.input-actions { display: flex; gap: 8px; }

.btn-primary {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 18px; background: var(--accent); color: #fff;
    border-radius: var(--radius-md); font-weight: 600; font-size: 13px;
    transition: all var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); }
.btn-secondary {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 18px; background: var(--bg-card); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-weight: 500; font-size: 13px; transition: all var(--transition);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.results-section { display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.results-section h2 { font-size: 18px; font-weight: 700; }
.results-summary {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 14px;
}
.summary-item { text-align: center; }
.summary-val { font-size: 20px; font-weight: 700; }
.summary-lbl { font-size: 11px; color: var(--text-muted); }
.results-list { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow: auto; }
.results-actions { display: flex; gap: 8px; }

/* History View */
.history-container { flex: 1; }
.history-container h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 14px 16px;
    transition: all var(--transition); cursor: pointer;
}
.history-item:hover { border-color: var(--border-light); box-shadow: var(--shadow-sm); }
.history-item .hi-info { display: flex; flex-direction: column; gap: 4px; }
.history-item .hi-date { font-size: 11px; color: var(--text-muted); }
.history-item .hi-count { font-size: 12px; color: var(--text-secondary); }
.history-item .hi-actions { display: flex; gap: 6px; }
.history-item .hi-actions button {
    width: 28px; height: 28px; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: all var(--transition);
}
.history-item .hi-actions button:hover { background: var(--accent); color: #fff; }
.history-item .hi-actions button.del:hover { background: var(--danger); }

/* Export View */
.export-container { flex: 1; }
.export-container h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.export-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.export-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; text-align: center; transition: all var(--transition);
}
.export-card:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.export-icon {
    width: 56px; height: 56px; border-radius: var(--radius-md);
    background: var(--accent-glow); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.export-card h3 { font-size: 15px; font-weight: 600; }
.export-card p { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Empty State */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px; color: var(--text-muted); text-align: center; gap: 12px;
}
.empty-state i { font-size: 32px; opacity: 0.5; }
.empty-state p { font-size: 13px; }

/* Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px 20px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
    transform: translateY(100px); opacity: 0;
    transition: all 0.3s ease; z-index: 2000;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast i { color: var(--success); font-size: 16px; }

/* Scrollbar */
::-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(--border-light); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .hamburger { display: flex; }
    .stats-strip { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .analyze-container { grid-template-columns: 1fr; }
    .export-options { grid-template-columns: 1fr; }
    .add-btn span { display: none; }
}

@media (max-width: 480px) {
    .stats-strip { grid-template-columns: 1fr; }
    .page-title { font-size: 15px; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.stat, .chart-card, .feedback-item, .export-card { animation: slideUp 0.3s ease; }

/* Print */
@media print {
    .sidebar, .topbar, .add-btn, .input-actions, .results-actions { display: none !important; }
    .view { padding: 0 !important; }
}
