/* MAXREESTR — Clean / Paper UI */

/* === Variables === */
:root {
    --bg: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #F9FAFB;
    --bg-input: #F9FAFB;
    --text: #1A1A1A;
    --text-secondary: #6B7280;
    --accent: #2563EB;
    --positive: #16A34A;
    --negative: #DC2626;
    --border: #E5E7EB;
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
    --radius: 6px;
    --radius-sm: 4px;
    --max-width: 1200px;
}

.dark {
    --bg: #0C0C0C;
    --bg-card: #141414;
    --bg-hover: #1A1A1A;
    --bg-input: #1A1A1A;
    --text: #E5E5E5;
    --text-secondary: #9CA3AF;
    --accent: #3B82F6;
    --positive: #22C55E;
    --negative: #EF4444;
    --border: #252525;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

/* === Typography === */
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* === Layout === */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* === Header === */
header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; height: 48px; display: flex; align-items: center; gap: 24px; }
.logo { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; white-space: nowrap; }
.nav-desktop { display: flex; gap: 4px; }
.nav-link { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); transition: background 0.15s, color 0.15s; }
.nav-link:hover, .nav-link.active { background: var(--bg-hover); color: var(--text); }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search-toggle, .theme-toggle { background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); color: var(--text-secondary); }
.search-toggle:hover, .theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.dark .icon-sun { display: inline; }
.dark .icon-moon { display: none; }
:root:not(.dark) .icon-sun { display: none; }
:root:not(.dark) .icon-moon { display: inline; }
html:not(.dark) .icon-sun { display: none; }
html:not(.dark) .icon-moon { display: inline; }
html.dark .icon-sun { display: inline; }
html.dark .icon-moon { display: none; }

.burger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--text-secondary); }
.nav-mobile { display: none; }

.search-bar { display: none; border-bottom: 1px solid var(--border); padding: 8px 24px; }
.search-bar.open { display: block; }
.search-form { max-width: var(--max-width); margin: 0 auto; position: relative; }
.search-form input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); font-size: 14px; outline: none; }
.search-form input:focus { border-color: var(--accent); }
.suggestions { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); z-index: 10; display: none; }

/* === Footer === */
footer { border-top: 1px solid var(--border); margin-top: 48px; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary); }
.footer-links { display: flex; gap: 16px; align-items: center; }
.footer-brand { font-weight: 600; color: var(--text); }
.footer-links a:hover { color: var(--text); }

/* === Hero === */
.hero { text-align: center; padding: 48px 24px 32px; max-width: 640px; margin: 0 auto; }
.hero h1 { margin-bottom: 20px; }
.hero-search { position: relative; margin-bottom: 16px; }
.hero-search input { width: 100%; padding: 10px 44px 10px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); font-size: 15px; outline: none; }
.hero-search input:focus { border-color: var(--accent); }
.hero-search button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; }
.hero-stats { display: flex; justify-content: center; gap: 24px; font-size: 13px; color: var(--text-secondary); }

/* === Sections === */
main { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { margin-top: 32px; }
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.link-more { font-size: 13px; color: var(--accent); }
.link-more:hover { text-decoration: underline; }

/* === Page header === */
.page-header { padding: 24px 0 16px; }
.page-header h1 { display: flex; align-items: baseline; gap: 8px; }
.count-badge { font-size: 14px; font-weight: 400; color: var(--text-secondary); }

/* === Breadcrumbs === */
.breadcrumbs { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs span { margin: 0 4px; }

/* === Growth cards === */
.cards-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.growth-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); min-width: 120px; text-align: center; transition: background 0.15s; }
.growth-card:hover { background: var(--bg-hover); }
.growth-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.growth { font-size: 13px; font-weight: 600; font-family: var(--mono); }

/* === Chips === */
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12px; padding: 2px 8px; background: var(--bg-hover); border-radius: var(--radius-sm); color: var(--text-secondary); }
.chip-link { font-size: 13px; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); transition: background 0.15s, border-color 0.15s; }
.chip-link:hover { background: var(--bg-hover); border-color: var(--accent); }
.chip-count { color: var(--text-secondary); font-size: 12px; }

/* === Tabs === */
.top-tabs, .chart-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab { padding: 6px 12px; border: none; background: none; cursor: pointer; font-size: 13px; color: var(--text-secondary); border-radius: var(--radius-sm); transition: background 0.15s, color 0.15s; }
.tab:hover { background: var(--bg-hover); }
.tab.active { background: var(--bg-hover); color: var(--text); font-weight: 500; }

/* === Data table === */
.data-table { font-size: 13px; }
.data-table thead { border-bottom: 1px solid var(--border); }
.data-table th { padding: 8px; text-align: left; font-weight: 500; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.col-num { width: 32px; color: var(--text-secondary); }
.col-right { text-align: right; }
.table-channel { display: flex; align-items: center; gap: 8px; }
.table-avatar { border-radius: 50%; width: 28px; height: 28px; }

/* === Channel card === */
.channel-list { display: flex; flex-direction: column; gap: 1px; }
.channel-card { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; transition: background 0.15s; }
.channel-card:hover { background: var(--bg-hover); margin: 0 -12px; padding: 12px; border-radius: var(--radius); }
.channel-avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.channel-info { flex: 1; min-width: 0; }
.channel-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.channel-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-handle { font-size: 12px; color: var(--text-secondary); }
.channel-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.channel-subs { color: var(--text-secondary); font-family: var(--mono); font-size: 12px; }
.channel-desc { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Channel profile === */
.channel-profile { padding: 24px 0; }
.profile-header { display: flex; gap: 20px; align-items: flex-start; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; flex-shrink: 0; }
.profile-info { flex: 1; }
.profile-info h1 { margin-bottom: 4px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.handle { color: var(--text-secondary); }
.region { color: var(--text-secondary); }
.profile-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.btn-primary { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: opacity 0.15s; }
.btn-primary:hover { opacity: 0.9; }

/* === Metrics grid === */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 16px 0; }
.metric-card { background: var(--bg-card); padding: 16px; }
.metric-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 4px; }
.metric-value { display: block; font-size: 1.25rem; font-weight: 600; }

/* === Chart === */
.chart-container { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-height: 200px; }
.chart-placeholder { display: flex; align-items: center; justify-content: center; height: 168px; color: var(--text-secondary); font-size: 14px; }

/* === Info list === */
.info-list { font-size: 14px; }
.info-list > div { display: flex; padding: 6px 0; border-bottom: 1px solid var(--border); }
.info-list dt { width: 140px; color: var(--text-secondary); flex-shrink: 0; }
.info-list dd { flex: 1; }

/* === Similar === */
.similar-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* === Filters === */
.filters { margin-bottom: 16px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-row select { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); font-size: 13px; cursor: pointer; outline: none; }
.filter-row select:focus { border-color: var(--accent); }

/* === Pagination === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 24px 0; font-size: 13px; }
.page-link { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); transition: background 0.15s; }
.page-link:hover { background: var(--bg-hover); }
.page-info { color: var(--text-secondary); }

/* === Responsive === */
@media (max-width: 768px) {
    .nav-desktop { display: none; }
    .burger { display: block; }
    .nav-mobile.open { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); padding: 8px 24px; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-meta { justify-content: center; }
    .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
    .hero { padding: 32px 16px 24px; }
    h1 { font-size: 1.35rem; }
}

@media (max-width: 480px) {
    .header-inner { padding: 0 16px; }
    main { padding: 0 16px; }
    .filter-row { flex-direction: column; }
    .filter-row select { width: 100%; }
}
