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

:root {
  --primary: #FF6600;
  --primary-light: #FFF3E0;
  --primary-dark: #E65100;
  --bg: #F2F2F7;
  --bg-card: #FFFFFF;
  --text-primary: #1C1C1E;
  --text-secondary: #3C3C43;
  --text-muted: #8E8E93;
  --text-hint: #C7C7CC;
  --border: #E5E5EA;
  --border-light: #F0F0F0;
  --red: #FF3B30;
  --green: #30D158;
  --blue: #007AFF;
  --purple: #AF52DE;
  --teal: #5AC8FA;
  --yellow: #FFCC00;
  --pink: #FF375F;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.08);
  --nav-h: 60px;
  --max-w: 800px;
  --max-w-wide: 1100px;
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}
.nav-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; height: 100%; gap: 32px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 18px; color: var(--text-primary);
  text-decoration: none;
}
.logo-img {
  width: 32px; height: 32px; border-radius: 8px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition); text-decoration: none;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg); text-decoration: none; }
.nav-link.active { color: var(--primary); background: var(--primary-light); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.mobile-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; }

.mobile-menu {
  display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 8px 16px; z-index: 99;
  flex-direction: column; gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-link {
  padding: 12px 16px; border-radius: 8px;
  font-size: 15px; font-weight: 500; color: var(--text-muted);
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.mobile-link.active { color: var(--primary); background: var(--primary-light); }

/* ── User Area ───────────────────────────────────────────── */
.user-avatar-wrap {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 4px 12px 4px 4px; border-radius: 20px;
  transition: var(--transition);
}
.user-avatar-wrap:hover { background: var(--bg); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; background: var(--border);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-dropdown {
  position: absolute; top: calc(var(--nav-h) - 4px); right: 20px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); min-width: 160px;
  display: none; overflow: hidden; z-index: 200;
}
.user-dropdown.open { display: block; }
.dropdown-item {
  padding: 12px 16px; font-size: 14px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 20px; border-radius: 20px; font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); text-decoration: none; }
.btn-login { background: var(--primary); color: #fff; padding: 6px 18px; font-size: 13px; }
.btn-full { width: 100%; padding: 12px; font-size: 15px; border-radius: var(--radius); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.4); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: #fff; border-radius: 20px; padding: 36px 32px;
  width: 100%; max-width: 400px; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: modalIn .3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.96); } }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg); border: none; width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: var(--text-muted); font-size: 14px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-header { text-align: center; margin-bottom: 28px; }
.modal-logo-img {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
  display: block;
}
.modal-header h2 { font-size: 22px; font-weight: 700; }
.modal-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--text-primary);
  transition: var(--transition); background: var(--bg);
}
.form-group input:focus { outline: none; border-color: var(--primary); background: #fff; }
.form-group input::placeholder { color: var(--text-hint); }
.modal-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.modal-footer a { font-weight: 600; }

/* ── Pages ───────────────────────────────────────────────── */
.main-content { flex: 1; padding-top: 24px; padding-bottom: 40px; }
.page { display: none; }
.page.active { display: block; }
.page-container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.page-container-wide { max-width: var(--max-w-wide); }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -.3px; }
.page-desc { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; }
.spinning i { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── News Card ───────────────────────────────────────────── */
.news-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 20px;
  margin-bottom: 12px; box-shadow: var(--shadow);
  transition: var(--transition); cursor: pointer; position: relative;
}
.news-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.news-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.news-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.news-date { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.news-title {
  font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--text-primary);
  margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.news-summary {
  font-size: 14px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 12px;
  /* display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; */
}
.news-footer { display: flex; align-items: center; justify-content: space-between; }
.news-url {
  font-size: 12px; color: var(--primary); max-width: 70%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.news-like {
  background: none; border: none; cursor: pointer; padding: 6px;
  font-size: 18px; color: var(--text-hint); transition: var(--transition);
  display: flex; align-items: center; gap: 4px;
}
.news-like:hover { color: var(--red); transform: scale(1.1); }
.news-like.liked { color: var(--red); }

/* ── Skeleton ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { background: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 12px; }
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }

/* ── Load More ───────────────────────────────────────────── */
.load-more-wrap { text-align: center; padding: 20px 0; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; color: var(--text-hint); }
.empty-state p { font-size: 15px; margin-bottom: 20px; }

/* ── Insights ────────────────────────────────────────────── */
.insights-controls {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.mode-tabs, .time-tabs {
  display: flex; background: var(--border); border-radius: var(--radius-sm);
  padding: 3px; gap: 2px;
}
.mode-tab, .time-tab {
  padding: 7px 16px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-muted);
  transition: var(--transition);
  display: flex; align-items: center; gap: 5px;
}
.mode-tab:hover, .time-tab:hover { color: var(--text-primary); }
.mode-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.time-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.insights-loading {
  text-align: center; padding: 60px; color: var(--text-muted); font-size: 15px;
}
.insights-loading i { margin-right: 8px; }

/* Narrative */
.narrative-card {
  display: flex; gap: 14px; background: var(--bg-card);
  border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow); margin-bottom: 16px;
  border-left: 3px solid var(--primary);
}
.narrative-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 16px;
}
.narrative-label { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.narrative-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* KPI Strip */
.kpi-strip {
  display: flex; gap: 10px; margin-bottom: 20px;
  overflow-x: auto; padding-bottom: 4px;
}
.kpi-strip::-webkit-scrollbar { display: none; }
.kpi-pill {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 12px 16px; min-width: 110px;
  box-shadow: var(--shadow); text-align: center; flex-shrink: 0;
}
.kpi-pill-icon { font-size: 16px; margin-bottom: 4px; }
.kpi-pill-value { font-size: 18px; font-weight: 800; }
.kpi-pill-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Sub Tabs (Salary/Tech/Company) */
.sub-tabs {
  display: flex; background: var(--border); border-radius: var(--radius-sm);
  padding: 3px; gap: 2px; margin-bottom: 20px;
}
.sub-tab {
  flex: 1; padding: 8px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-muted);
  transition: var(--transition); text-align: center;
}
.sub-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Widget Cards */
.widget-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 16px;
}
.widget-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.widget-card.full { grid-column: 1 / -1; }
.widget-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.widget-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.widget-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.widget-subtitle { font-size: 11px; color: var(--text-muted); }

/* Donut Chart */
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-svg { flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.legend-label { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: var(--text-muted); font-weight: 600; font-size: 10px; }

/* Bar Chart */
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-item { display: flex; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--text-secondary); width: 80px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.bar-value { font-size: 11px; color: var(--text-muted); width: 36px; text-align: right; font-weight: 600; }

/* Project Card */
.project-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow); margin-bottom: 10px;
  transition: var(--transition); cursor: pointer;
}
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.project-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  padding: 2px 8px; border-radius: var(--radius-xs);
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
}
.project-name { font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.4; margin-bottom: 4px; }
.project-tagline { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.project-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.tag {
  padding: 2px 7px; border-radius: var(--radius-xs);
  font-size: 10px; font-weight: 600;
}
.project-date { font-size: 11px; color: var(--text-hint); }

/* ── Download Button & Modal ──────────────────────────────── */
.btn-download {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg-card);
  color: var(--primary); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.btn-download:hover {
  background: var(--primary-light); border-color: var(--primary);
  transform: scale(1.05);
}
.download-modal-card { max-width: 560px; text-align: center; }
.download-modal-body h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.download-hint { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.download-platforms { display: flex; gap: 0; align-items: stretch; }
.download-platform { flex: 1; display: flex; flex-direction: column; align-items: center; }
.download-divider { width: 1px; background: var(--border); margin: 0 20px; }
.download-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 14px;
}
.android-icon { background: #E8F5E9; color: #3DDC84; }
.ios-icon { background: #F0F0F5; color: #333; }
.qr-wrap {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border); padding: 12px;
  display: inline-block; margin-bottom: 14px;
}
.qr-wrap img { width: 160px; height: 160px; display: block; }
.download-btn-android {
  background: #3DDC84; color: #fff; border: none;
  padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 600;
}
.download-btn-android:hover { background: #32c474; text-decoration: none; }
.download-btn-ios {
  background: #333; color: #fff; border: none;
  padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 600;
}
.download-btn-ios:hover { background: #555; text-decoration: none; }
@media (max-width: 520px) {
  .download-platforms { flex-direction: column; gap: 20px; }
  .download-divider { width: 100%; height: 1px; margin: 0; }
  .download-modal-card { max-width: 360px; }
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--text-primary); color: #fff; padding: 10px 24px;
  border-radius: 20px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(-4px); }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border); padding: 20px;
  text-align: center; font-size: 13px; color: var(--text-muted);
}
.footer-inner { display: flex; justify-content: center; gap: 16px; align-items: center; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }
  .page-header h1 { font-size: 22px; }
  .widget-grid { grid-template-columns: 1fr; }
  .widget-card.full { grid-column: 1; }
  .insights-controls { flex-direction: column; align-items: stretch; }
  .mode-tabs, .time-tabs { width: 100%; }
  .mode-tab, .time-tab { flex: 1; justify-content: center; }
  .kpi-strip { gap: 8px; }
  .kpi-pill { min-width: 90px; padding: 10px 12px; }
  .kpi-pill-value { font-size: 16px; }
  .user-name { display: none; }
}

@media (max-width: 480px) {
  .nav-inner { padding: 0 12px; gap: 12px; }
  .page-container { padding: 0 12px; }
  .news-card { padding: 16px; }
  .modal-card { padding: 28px 20px; }
}
