:root {
--bg-app: #07070a;
--bg-main: #0a0a12;
--bg-card: #0f0f1a;
--bg-card-hover: #141425;
--border: #1a1a2e;
--border-light: #2a2a3e;
--text: #e0e0e0;
--text-dim: #888;
--text-muted: #6b7280;
--accent: #a78bfa;
--accent-dim: #7a5abe;
--accent-soft: rgba(167, 139, 250, 0.08);
--green: #4ade80;
--purple: #a78bfa;
--red: #f87171;
--radius: 12px;
--radius-sm: 8px;
--font: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
--mono: "DM Mono", "JetBrains Mono", monospace;
}

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

html { font-size: 15px; }

body {
font-family: var(--font);
background: var(--bg-app);
color: var(--text);
line-height: 1.55;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
display: flex; justify-content: space-between; align-items: center;
padding: 14px 28px;
border-bottom: 1px solid var(--border);
background: var(--bg-main);
position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-link {
display: flex; align-items: center; gap: 8px;
text-decoration: none; color: var(--text);
font-size: 15px; font-weight: 700; letter-spacing: -0.3px;
}
.brand-link svg { color: var(--accent); flex-shrink: 0; }
.brand-link span { color: var(--text-muted); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.file-indicator { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }

.main { flex: 1; max-width: 900px; width: 100%; margin: 0 auto; padding: 0 24px 80px; }

.upload-section { padding: 56px 0 40px; max-width: 480px; margin: 0 auto; }
.upload-box {
border: 2px dashed var(--border);
border-radius: var(--radius);
padding: 44px 24px; text-align: center;
cursor: pointer; transition: all 0.25s;
background: var(--bg-card);
}
.upload-box:hover { border-color: var(--accent-dim); background: var(--bg-card-hover); }
.upload-box.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { margin-bottom: 14px; }
.upload-icon svg { color: var(--text-muted); transition: color 0.2s; }
.upload-box:hover .upload-icon svg { color: var(--accent); }
.upload-text { font-size: 14px; color: var(--text-dim); }
.upload-text strong { color: var(--text); font-weight: 500; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.file-badge {
display: inline-flex; align-items: center; gap: 6px;
margin-top: 16px; padding: 6px 12px;
background: var(--bg-card); border: 1px solid var(--border);
border-radius: var(--radius-sm);
font-size: 12px; color: var(--text-dim); font-family: var(--mono);
}
.file-badge svg { color: var(--accent); flex-shrink: 0; }

.loader-overlay { padding: 60px 0; text-align: center; }
.loader-box { display: inline-flex; align-items: center; gap: 16px; }
.loader-spinner {
width: 20px; height: 20px;
border: 2px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-title { font-size: 13px; font-weight: 500; }
.loader-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.error-bar {
margin: 16px 0; padding: 12px 16px;
background: rgba(248, 113, 113, 0.08);
border: 1px solid rgba(248, 113, 113, 0.15);
border-radius: var(--radius-sm);
color: var(--red); font-size: 13px;
}

.results { padding: 0 0 48px; }
.chat-summary {
display: flex; align-items: center; gap: 14px;
margin-bottom: 20px; padding-bottom: 16px;
border-bottom: 1px solid var(--border);
}
.summary-avatar {
width: 40px; height: 40px; border-radius: 50%;
background: var(--accent-soft); color: var(--accent);
display: flex; align-items: center; justify-content: center;
flex-shrink: 0;
}
.summary-text h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.summary-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.meta-divider { color: var(--border-light); }

.grid-2col {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 10px;
margin-bottom: 24px;
}
.stat-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px 18px;
opacity: 0; transform: translateY(20px);
transition: opacity 0.5s ease, transform 0.5s ease, background 0.15s, border-color 0.15s;
}
.stat-card.visible { opacity: 1; transform: translateY(0); }
.stat-card:hover { background: var(--bg-card-hover); border-color: var(--accent-dim); }
.stat-card .stat-label {
font-size: 10px; font-weight: 600; text-transform: uppercase;
letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px;
}
.stat-card .stat-value {
font-size: 22px; font-weight: 700; color: var(--text);
letter-spacing: -0.5px;
}
.stat-card .stat-sub {
font-size: 11px; color: var(--text-dim); margin-top: 2px;
}
.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.green { color: var(--green); }
.stat-card .stat-value.red { color: var(--red); }

.section-divider {
border: none; height: 1px; background: var(--border);
margin: 28px 0 20px;
}

.chart-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
margin-bottom: 18px;
transition: border-color 0.2s, background 0.15s;
}
.chart-card:hover { border-color: var(--accent-dim); background: var(--bg-card-hover); }
.chart-card h3 {
font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--text);
}
.chart-card .chart-desc {
font-size: 11px; color: var(--text-dim); margin-bottom: 14px; line-height: 1.5;
}
.chart-card .chart-wrap {
position: relative;
}
.chart-card .chart-wrap canvas { display: block; max-width: 100%; }

.charts-grid {
display: grid;
grid-template-columns: 1fr;
gap: 18px;
}

@media (min-width: 700px) {
.charts-grid { grid-template-columns: repeat(2, 1fr); }
}

.topbar { padding: 10px 16px; }
@media (max-width: 480px) {
.grid-2col { grid-template-columns: 1fr 1fr; }
.stat-card { padding: 12px 14px; }
.stat-card .stat-value { font-size: 18px; }
.upload-section { padding: 32px 0; }
}

.hidden { display: none !important; }

.toolbar {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 16px;
flex-wrap: wrap;
}
.search-bar {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 200px;
padding: 10px 14px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
flex: 1;
background: none;
border: none;
color: var(--text);
font-size: 13px;
font-family: var(--font);
outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-count { font-size: 11px; color: var(--text-muted); font-family: var(--mono); white-space: nowrap; }

.toolbar-btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 10px 16px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
color: var(--text-dim);
font-size: 12px;
font-family: var(--font);
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
}
.toolbar-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.search-results {
margin-bottom: 16px;
max-height: 400px;
overflow-y: auto;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-card);
}
.search-result-item {
padding: 12px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
line-height: 1.5;
transition: background 0.1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item .sr-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 4px;
font-size: 11px;
}
.search-result-item .sr-author { color: var(--accent); font-weight: 500; }
.search-result-item .sr-date { color: var(--text-muted); font-family: var(--mono); }
.search-result-item .sr-text { color: var(--text-dim); }
.search-result-item .sr-text mark { background: rgba(167, 139, 250, 0.3); color: var(--text); border-radius: 2px; padding: 0 2px; }
.search-result-item .sr-context {
display: flex;
gap: 8px;
margin-top: 6px;
padding: 6px 8px;
background: rgba(7, 7, 10, 0.5);
border-radius: var(--radius-sm);
font-size: 12px;
color: var(--text-muted);
}
.search-results-empty {
padding: 24px;
text-align: center;
color: var(--text-muted);
font-size: 13px;
}

.user-heatmap-wrap {
overflow-x: auto;
margin: 4px 0;
}
.user-heatmap {
display: grid;
gap: 1.5px;
min-width: 500px;
}
.user-heatmap .uh-row { display: contents; }
.user-heatmap .uh-label {
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 6px;
font-size: 10px;
color: var(--text-muted);
font-family: var(--mono);
height: 18px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-heatmap .uh-header {
text-align: center;
color: var(--text-muted);
font-size: 7px;
font-family: var(--mono);
height: 18px;
}
.user-heatmap .uh-cell {
height: 18px;
border-radius: 2px;
transition: all 0.1s;
}
.user-heatmap .uh-cell:hover { transform: scale(1.4); z-index: 2; }

.premium-pdf-lock {
display: flex;
align-items: center;
gap: 8px;
padding: 12px 16px;
margin-bottom: 16px;
background: rgba(167, 139, 250, 0.05);
border: 1px solid rgba(167, 139, 250, 0.15);
border-radius: var(--radius-sm);
font-size: 12px;
color: var(--text-dim);
}
.premium-pdf-lock .lock-icon { font-size: 16px; }
.premium-pdf-lock a { color: var(--accent); text-decoration: underline; cursor: pointer; }
.premium-pdf-lock a:hover { color: #c4a8ff; }

.toolbar-btn.premium-btn {
background: linear-gradient(135deg, #a78bfa, #f472b6);
border-color: #f472b6;
color: #fff;
position: relative;
padding-right: 30px;
font-weight: 600;
}
.toolbar-btn.premium-btn:hover {
background: linear-gradient(135deg, #c084fc, #a78bfa);
border-color: #a78bfa;
color: #fff;
}
.toolbar-btn.premium-btn .ps {
position: absolute;
top: -6px;
right: -6px;
font-size: 10px;
color: #fff;
background: linear-gradient(135deg, #c084fc, #f472b6);
border-radius: 50%;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}
.toolbar-btn.premium-btn .ps::before {
content: "\f005";
font-family: "Font Awesome 6 Free";
font-weight: 900;
font-size: 10px;
}

.chart-panel {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
margin-bottom: 18px;
transition: border-color 0.2s, background 0.15s;
}
.chart-panel:hover { border-color: var(--accent-dim); background: var(--bg-card-hover); }
.chart-panel h3 {
font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text);
}
.chart-panel .chart-desc {
font-size: 11px; color: var(--text-dim); margin-bottom: 14px; line-height: 1.5;
}
.chart-panel .chart-wrap { position: relative; }
.chart-panel .chart-wrap canvas { display: block; max-width: 100%; }

.heatmap-grid {
display: grid;
grid-template-columns: 40px repeat(24, 1fr);
gap: 2px;
font-size: 10px;
margin: 8px 0;
}
.heatmap-header {
text-align: center;
color: var(--text-muted);
font-size: 9px;
font-family: var(--mono);
padding: 2px 0;
}
.heatmap-label {
text-align: right;
padding-right: 6px;
color: var(--text-muted);
font-size: 9px;
font-family: var(--mono);
display: flex;
align-items: center;
justify-content: flex-end;
}
.heatmap-cell {
height: 24px;
border-radius: 3px;
transition: transform 0.1s;
cursor: default;
}
.heatmap-cell:hover { transform: scale(1.3); z-index: 2; }

.chart-canvas {
display: block;
max-width: 100%;
height: auto;
}
:root {
--bg-app: #07070a;
--bg-main: #0a0a12;
--bg-card: #0f0f1a;
--bg-card-hover: #141425;
--border: #1a1a2e;
--border-light: #2a2a3e;
--text: #e0e0e0;
--text-dim: #888;
--text-muted: #6b7280;
--accent: #a78bfa;
--accent-dim: #7a5abe;
--accent-soft: rgba(167, 139, 250, 0.08);
--green: #4ade80;
--purple: #a78bfa;
--red: #f87171;
--radius: 12px;
--radius-sm: 8px;
--font: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
--mono: "DM Mono", "JetBrains Mono", monospace;
}

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

html { font-size: 15px; }

body {
font-family: var(--font);
background: var(--bg-app);
color: var(--text);
line-height: 1.55;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
display: flex; justify-content: space-between; align-items: center;
padding: 14px 28px;
border-bottom: 1px solid var(--border);
background: var(--bg-main);
position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.wordcloud-wrap { display: flex; justify-content: center; align-items: center; width: 100%; padding: 8px 0; }

# New mobile styles
@media (max-width:700px){
.grid-2col{grid-template-columns:1fr 1fr!important;gap:6px}
.stat-card{padding:10px 12px!important}
.stat-card .stat-value{font-size:16px!important}
.charts-grid{grid-template-columns:1fr!important}
.chart-panel{padding:14px!important}
.heatmap-grid{font-size:8px!important;gap:1px!important}
.heatmap-cell{height:16px!important}
.heatmap-header{font-size:7px!important}
.heatmap-label{font-size:7px!important}
.upload-section{padding:32px 16px!important;max-width:100%!important}
.upload-box{padding:24px 16px!important}
.topbar{padding:10px 12px!important}
.main{padding:0 12px 40px!important}
.toolbar{flex-direction:column;align-items:stretch!important}
.search-bar{min-width:unset!important}
.toolbar-btn{justify-content:center}
.chat-summary h2{font-size:15px!important}
.user-heatmap-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
}

.wordcloud-wrap{display:flex;justify-content:center;align-items:center;width:100%;padding:8px 0}
.wordcloud-canvas{max-width:100%;height:auto;display:block}
@media(max-width:480px){
.grid-2col{grid-template-columns:1fr 1fr!important;gap:4px}
.stat-card{padding:8px 10px!important}
.stat-card .stat-value{font-size:14px!important}
.search-results{max-height:250px!important}
.search-result-item{padding:8px 10px!important;font-size:12px!important}
.file-indicator{display:none}
}

.premium-badge {
    background: linear-gradient(135deg, #a78bfa, #f472b6, #a78bfa, #f472b6);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: premShimmer 2s ease-in-out infinite;
    display: inline-block;
    font-size: 14px;
}
.premium-btn .ps {
    background: linear-gradient(135deg, #a78bfa, #f472b6) !important;
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.4) !important;
}
.toolbar-btn.premium-btn {
    background: linear-gradient(135deg, #a78bfa, #f472b6) !important;
    border-color: #a78bfa !important;
}
.toolbar-btn.premium-btn:hover {
    background: linear-gradient(135deg, #c084fc, #f472b6) !important;
    border-color: #c084fc !important;
}
@keyframes premShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
