/* ── Dashboard ────────────────────────────── */

/* Overview cards */
.db-overview {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.6rem;
	margin: 1rem 0 1.25rem;
}
.db-stat-card {
	background: var(--es-card);
	border: 1px solid var(--es-border);
	border-radius: 14px;
	padding: 0.85rem 0.5rem;
	text-align: center;
}
.db-stat-num {
	font-size: 1.6rem;
	font-weight: 900;
	color: var(--es-primary);
	line-height: 1;
}
.db-stat-label {
	font-size: 0.72rem;
	color: var(--es-text-muted);
	margin-top: 0.25rem;
}

/* Filter bar */
.db-filter-bar {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
	padding: 0.6rem 0.85rem;
	background: var(--es-card);
	border: 1px solid var(--es-border);
	border-radius: 12px;
}
.db-filter-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--es-text-soft);
	margin-right: 0.3rem;
}
.db-filter-label i { color: var(--es-primary); margin-right: 0.25rem; }

/* Topic section */
.db-topic-section {
	background: var(--es-card);
	border: 1px solid var(--es-border);
	border-radius: 18px;
	padding: 1.15rem;
	margin-bottom: 1rem;
	box-shadow: 0 2px 8px rgba(25,28,30,.04);
}
.db-topic-header {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	margin-bottom: 0.9rem;
	padding-bottom: 0.65rem;
	border-bottom: 2px solid var(--es-border);
}
.db-topic-badge {
	color: #fff;
	font-weight: 800;
	font-size: 0.9rem;
	padding: 5px 14px;
	border-radius: 10px;
	flex-shrink: 0;
}
.db-topic-title {
	font-size: 1.15rem;
	font-weight: 700;
	margin: 0;
	color: var(--es-text);
	flex: 1;
}
.db-topic-count {
	font-size: 0.78rem;
	color: var(--es-text-muted);
	font-weight: 600;
}

/* Bar chart rows */
.db-bars { display: flex; flex-direction: column; gap: 0.45rem; }
.db-bar-row {
	display: grid;
	grid-template-columns: minmax(120px, 160px) 1fr auto auto;
	gap: 0.5rem;
	align-items: center;
}
.db-bar-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--es-text);
	text-align: right;
	line-height: 1.3;
}
.db-bar-track {
	height: 22px;
	background: var(--es-card-soft);
	border-radius: 6px;
	overflow: hidden;
	min-width: 60px;
}
.db-bar-fill {
	height: 100%;
	border-radius: 6px;
	transition: width .4s ease;
	min-width: 4px;
}
.db-bar-value {
	display: flex;
	gap: 0.2rem;
	align-items: baseline;
	min-width: 50px;
}
.db-bar-num {
	font-size: 1rem;
	font-weight: 800;
	color: var(--es-text);
}
.db-bar-pct {
	font-size: 0.72rem;
	color: var(--es-text-muted);
}
.db-bar-years {
	display: flex;
	gap: 2px;
	flex-wrap: wrap;
	min-width: 80px;
}
.db-year-dot {
	display: inline-block;
	background: var(--es-card-soft);
	color: var(--es-text-muted);
	font-size: 0.62rem;
	padding: 1px 4px;
	border-radius: 4px;
	font-weight: 600;
}
.db-year-dot.is-recent {
	background: #dbeafe;
	color: #1e40af;
}
.db-year-more {
	font-size: 0.6rem;
	color: var(--es-text-muted);
	padding: 1px 3px;
}

/* Hot topics */
.db-hot-section {
	margin-top: 1.5rem;
	padding: 1.25rem;
	background: linear-gradient(135deg, #fef3c7 0%, #fff 50%);
	border: 1px solid #fde68a;
	border-radius: 18px;
}
.db-section-title {
	font-size: 1.15rem;
	font-weight: 800;
	margin: 0 0 0.3rem;
	color: #92400e;
}
.db-section-title i { margin-right: 0.4rem; color: #f59e0b; }
.db-section-desc {
	font-size: 0.82rem;
	color: #92400e;
	margin: 0 0 1rem;
	opacity: 0.8;
}
.db-hot-grid {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}
.db-hot-card {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	background: #fff;
	border: 1px solid var(--es-border);
	border-left: 4px solid var(--accent, var(--es-primary));
	border-radius: 10px;
	padding: 0.65rem 0.85rem;
}
.db-hot-rank {
	font-size: 1.1rem;
	font-weight: 900;
	color: var(--accent, var(--es-primary));
	min-width: 24px;
	text-align: center;
}
.db-hot-body { flex: 1; min-width: 0; }
.db-hot-theme {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--es-text);
}
.db-hot-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.15rem;
}
.db-hot-topic {
	font-size: 0.78rem;
	font-weight: 600;
}
.db-hot-freq {
	font-size: 0.82rem;
	font-weight: 700;
	color: #92400e;
	background: #fef3c7;
	padding: 2px 8px;
	border-radius: 999px;
}

/* Bottom links */
.db-link-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.65rem 1.25rem;
	background: var(--es-card);
	border: 1px solid var(--es-border);
	border-radius: 12px;
	color: var(--es-primary);
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9rem;
	margin: 0.3rem;
	transition: all .15s;
}
.db-link-btn:hover {
	background: var(--es-primary);
	color: #fff;
	border-color: var(--es-primary);
}

@media (max-width: 480px) {
	.db-overview { grid-template-columns: repeat(2, 1fr); }
	.db-bar-row {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}
	.db-bar-label { text-align: left; }
	.db-bar-years { display: none; }
}

/* ── Clickable year dots + hot cards ────── */
.db-year-dot {
	border: none;
	cursor: pointer;
	transition: transform .12s, background .12s;
	font-family: inherit;
}
.db-year-dot:hover {
	transform: scale(1.15);
	background: var(--es-primary);
	color: #fff;
}
.db-year-dot.is-recent:hover {
	background: #1e40af;
	color: #fff;
}

.db-hot-card {
	cursor: pointer;
	transition: transform .12s, box-shadow .12s;
}
.db-hot-card:hover {
	transform: translateX(2px);
	box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.db-hot-chev {
	color: var(--es-text-muted);
	margin-left: .25rem;
	font-size: .85rem;
}

/* ── Modal popup ─────────────────────────── */
.db-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 1rem;
	animation: db-fade-in .15s ease-out;
}
@keyframes db-fade-in { from { opacity: 0 } to { opacity: 1 } }

.db-modal {
	background: #fff;
	border-radius: 16px;
	border: 2px solid var(--es-primary);
	width: 100%;
	max-width: 760px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0,0,0,.25);
	animation: db-pop-in .18s ease-out;
}
@keyframes db-pop-in {
	from { opacity: 0; transform: scale(.96) translateY(8px) }
	to { opacity: 1; transform: scale(1) translateY(0) }
}

.db-modal-head {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .9rem 1.1rem;
	color: #fff;
}
.db-modal-titles { flex: 1; min-width: 0; }
.db-modal-title {
	font-size: 1.05rem;
	font-weight: 800;
	line-height: 1.3;
}
.db-modal-sub {
	font-size: .82rem;
	opacity: .9;
	margin-top: .15rem;
}
.db-modal-close {
	background: rgba(255,255,255,.2);
	border: none;
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	cursor: pointer;
	font-size: .9rem;
	transition: background .15s;
}
.db-modal-close:hover { background: rgba(255,255,255,.35); }

.db-modal-body {
	overflow-y: auto;
	padding: 1rem;
	background: #f8f9fb;
	display: flex;
	flex-direction: column;
	gap: .8rem;
}
.db-modal-empty {
	text-align: center;
	color: var(--es-text-muted);
	padding: 2rem;
}

.db-q-card {
	background: #fff;
	border: 1px solid var(--es-border);
	border-radius: 10px;
	padding: .9rem 1rem;
}
.db-q-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: .4rem;
}
.db-q-id {
	font-size: .72rem;
	font-family: ui-monospace, monospace;
	color: var(--es-text-muted);
	background: var(--es-card-soft);
	padding: 2px 6px;
	border-radius: 4px;
}
.db-q-year {
	font-size: .78rem;
	font-weight: 700;
	color: var(--es-primary);
}
.db-q-context {
	font-size: .85rem;
	color: var(--es-text-soft);
	font-style: italic;
	margin-bottom: .4rem;
	padding-left: .5rem;
	border-left: 3px solid var(--es-border);
}
.db-q-label {
	font-size: .7rem;
	font-weight: 700;
	color: var(--es-text-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
	margin-top: .55rem;
	margin-bottom: .25rem;
}
.db-q-text {
	font-size: .95rem;
	line-height: 1.55;
	color: var(--es-text);
}
.db-q-answer {
	font-size: .92rem;
	line-height: 1.55;
	color: var(--es-text);
	white-space: pre-wrap;
	background: #fffbeb;
	border-left: 3px solid #fbbf24;
	padding: .5rem .65rem;
	border-radius: 4px;
}

@media (max-width: 600px) {
	.db-modal { max-height: 95vh; border-radius: 12px; }
	.db-modal-head { padding: .75rem .9rem; }
	.db-modal-title { font-size: .95rem; }
}
