/* ============================================================
   SKALO INTEL — Global Dark Theme
   Design: Vercel/Linear-inspired professional dashboard
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #0a0b0f;
  --surface:      #12131a;
  --surface-2:    #1a1b26;
  --border:       #1e2030;
  --border-hover: #2d3050;
  --accent:       #3bf0a0;
  --accent-dim:   rgba(59, 240, 160, 0.12);
  --accent-blue:  #5ba8ff;
  --blue-dim:     rgba(91, 168, 255, 0.12);
  --text:         #e4e5ea;
  --text-dim:     #7d7f8c;
  --text-muted:   #4a4c5e;
  --hn-color:     #ff6b35;
  --ph-color:     #da552f;
  --error:        #ff4d6d;
  --warning:      #fbbf24;
  --radius:       8px;
  --radius-sm:    4px;
  --sidebar-w:    240px;
  --transition:   150ms ease;
  --shadow:       0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

code, kbd, pre {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
}

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.45em;
  color: var(--accent);
}

ul { list-style: none; }

img { max-width: 100%; display: block; }

/* ── App shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  flex-shrink: 0;
}

.logo-accent { color: var(--accent); }

.nav-list {
  padding: 0.75rem 0.75rem;
  flex: 1;
}

.nav-item { margin-bottom: 0.125rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 450;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active .nav-link {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.nav-icon { font-size: 1rem; flex-shrink: 0; }
.nav-label { flex: 1; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.version-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.2em 0.5em;
  border-radius: var(--radius-sm);
}

/* ── Sidebar overlay (mobile) ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}

/* ── Main wrapper ──────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Mobile header (hidden on desktop) ─────────────────────── */
.mobile-header {
  display: none;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1200px;
  width: 100%;
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.page-subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.last-updated {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.775rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
}

/* ── Section title ─────────────────────────────────────────── */
.news-section { margin-bottom: 2.5rem; }

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── News grid ─────────────────────────────────────────────── */
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* ── News card ─────────────────────────────────────────────── */
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.news-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.source-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.675rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.2em 0.55em;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.source-hackernews {
  background: rgba(255, 107, 53, 0.15);
  color: var(--hn-color);
  border: 1px solid rgba(255, 107, 53, 0.3);
}

.source-producthunt {
  background: rgba(218, 85, 47, 0.15);
  color: var(--ph-color);
  border: 1px solid rgba(218, 85, 47, 0.3);
}

.points {
  font-size: 0.775rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.time-ago {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-left: auto;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.card-tagline {
  font-size: 0.825rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 2rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-icon { font-size: 2.5rem; }

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.empty-state p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ── Coming soon (stub pages) ──────────────────────────────── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem 2rem;
  text-align: center;
}

.coming-soon-icon { font-size: 3rem; opacity: 0.6; }

.coming-soon h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
}

.coming-soon p { color: var(--text-dim); }

.badge-coming {
  display: inline-block;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59, 240, 160, 0.3);
  padding: 0.25em 0.6em;
  border-radius: var(--radius-sm);
}

/* ── Error page ────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 0;
}

.error-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--border-hover);
  line-height: 1;
}

.error-page h1 { font-size: 1.5rem; font-weight: 600; }
.error-page p { color: var(--text-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0a0b0f;
}

.btn-primary:hover {
  background: #2dd48b;
  transform: translateY(-1px);
  text-decoration: none;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  padding: 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.775rem;
  color: var(--text-muted);
}

.site-footer .accent { color: var(--accent); }

/* ── Accent utility ────────────────────────────────────────── */
.accent { color: var(--accent); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    padding: 1.25rem 1rem;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .page-title { font-size: 1.25rem; }
}

/* ============================================================
   PHASE 2 — Tools, Blogs, Tips, AI Coach
   ============================================================ */

/* ── Shared: Filter pills ───────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.filter-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 0.3em 0.85em;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.filter-pill:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.filter-pill.active {
  background: var(--accent-dim);
  border-color: rgba(59, 240, 160, 0.4);
  color: var(--accent);
}

/* ── Shared: Tag list ───────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.725rem;
  padding: 0.15em 0.5em;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Shared: Add forms ──────────────────────────────────────── */
.add-form-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.form-group input,
.form-group textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  transition: border-color var(--transition);
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(59, 240, 160, 0.5);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.btn-submit {
  align-self: flex-start;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #0a0b0f;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  transition: background var(--transition), transform var(--transition);
}

.btn-submit:hover {
  background: #2dd48b;
  transform: translateY(-1px);
}

.form-status {
  font-size: 0.825rem;
  padding: 0.25rem 0;
}

.form-status.success { color: var(--accent); }
.form-status.error   { color: var(--error); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-warning {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.775rem;
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
}

.kb-badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.775rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--blue-dim);
  color: var(--accent-blue);
  border: 1px solid rgba(91, 168, 255, 0.3);
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
}

/* ── TOOLS PAGE ─────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.tool-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.tool-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.tool-category {
  display: inline-block;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59, 240, 160, 0.25);
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
}

.tool-rating { display: flex; gap: 2px; flex-shrink: 0; }

.star { font-size: 0.85rem; color: var(--border-hover); }
.star.filled { color: var(--warning); }

.tool-tagline {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.tool-notes {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.4;
  font-style: italic;
}

.tool-card-footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

.btn-visit {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition);
}

.btn-visit:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── BLOGS PAGE ─────────────────────────────────────────────── */
.channels-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition);
}

.channel-card:hover {
  border-color: var(--border-hover);
}

.channel-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.channel-info { flex: 1; }

.channel-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.channel-name a {
  color: var(--text);
  text-decoration: none;
}

.channel-name a:hover {
  color: var(--accent-blue);
}

.channel-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
}

.channel-handle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.channel-category-badge {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--blue-dim);
  color: var(--accent-blue);
  border: 1px solid rgba(91, 168, 255, 0.25);
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
}

.channel-description {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.videos-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.video-thumb-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: opacity var(--transition);
}

.video-thumb-card:hover { opacity: 0.8; text-decoration: none; }

.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  font-size: 1.5rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.video-thumb-card:hover .play-overlay { opacity: 1; }

.video-title {
  font-size: 0.775rem;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.no-videos {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── TIPS PAGE ──────────────────────────────────────────────── */
.tips-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.tip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.tip-card:hover { border-color: var(--border-hover); }

.tip-card.kb-tip { border-left: 2px solid var(--accent-blue); }

.tip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.tip-header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  min-width: 0;
}

.tip-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.tip-source-badge {
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.tip-source-badge.kb {
  background: var(--blue-dim);
  color: var(--accent-blue);
  border: 1px solid rgba(91, 168, 255, 0.3);
}

.tip-source-badge.manual {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59, 240, 160, 0.3);
}

.tip-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.tip-category-badge {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
}

.expand-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 200ms ease;
}

.tip-card.expanded .expand-icon { transform: rotate(180deg); }

.tip-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.tip-card.expanded .tip-body { display: block; }

.tip-content {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-top: 0.875rem;
  white-space: pre-wrap;
}

.tip-source-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--accent-blue);
}

/* ── AI COACH PAGE ──────────────────────────────────────────── */
.coach-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem); /* viewport minus padding */
  min-height: 500px;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: fadeUp 250ms ease both;
}

.chat-message.entering { opacity: 0; transform: translateY(8px); }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.chat-bubble {
  max-width: 72%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.chat-message.user .chat-bubble {
  background: var(--accent-dim);
  border-color: rgba(59, 240, 160, 0.25);
}

.chat-bubble p { margin: 0 0 0.5rem; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble h2, .chat-bubble h3, .chat-bubble h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.75rem 0 0.25rem;
}
.chat-bubble ul { list-style: disc; padding-left: 1.25rem; margin: 0.25rem 0; }
.chat-bubble li { margin: 0.2rem 0; }
.chat-bubble pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  font-size: 0.825rem;
}
.chat-bubble code { font-size: 0.825em; }
.chat-bubble a { color: var(--accent-blue); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.typing-dots {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* Input area */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 0.625rem;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.625rem 0.875rem;
  resize: none;
  overflow: hidden;
  transition: border-color var(--transition);
  min-height: 44px;
  max-height: 160px;
}

.chat-textarea:focus {
  outline: none;
  border-color: rgba(59, 240, 160, 0.45);
}

.chat-textarea::placeholder { color: var(--text-muted); }

.chat-send-btn {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #0a0b0f;
  cursor: pointer;
  padding: 0.625rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
  height: 44px;
}

.chat-send-btn:hover { background: #2dd48b; transform: translateY(-1px); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.chat-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.775rem;
  padding: 0.2rem 0;
  transition: color var(--transition);
}

.chat-action-btn:hover { color: var(--error); }

.chat-hint {
  font-size: 0.725rem;
  color: var(--text-muted);
}

/* ── Phase 2 responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .videos-row { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .videos-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .tools-grid  { grid-template-columns: 1fr; }
  .videos-row  { grid-template-columns: repeat(2, 1fr); }
  .form-row    { grid-template-columns: 1fr; }
  .chat-bubble { max-width: 90%; }
  .coach-shell { height: calc(100vh - 60px); }
}

@media (max-width: 480px) {
  .videos-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   PHASE 3 — Home page polish, refresh button, status bar
   ============================================================ */

/* ── Page header with refresh button ───────────────────────── */
.page-header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.825rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-refresh:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-refresh.refreshing {
  border-color: rgba(59, 240, 160, 0.4);
  color: var(--accent);
}

.refresh-icon { font-size: 0.9rem; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Fetch status bar ───────────────────────────────────────── */
.fetch-status-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.status-pill {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.15em 0.6em;
  border-radius: var(--radius-sm);
  border: 1px solid;
}

.status-pill.ok {
  background: rgba(59, 240, 160, 0.08);
  color: var(--accent);
  border-color: rgba(59, 240, 160, 0.25);
}

.status-pill.err {
  background: rgba(255, 77, 109, 0.08);
  color: var(--error);
  border-color: rgba(255, 77, 109, 0.25);
}

/* ── Count badge ────────────────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 0.4em;
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 0.4em;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Smaller news grid for "This Week" ──────────────────────── */
.news-grid-sm {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Compact news list for "Earlier" ───────────────────────── */
.news-list-compact {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.news-list-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.news-list-item:last-child { border-bottom: none; }
.news-list-item:hover { background: var(--surface-2); }

.news-list-title {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-list-title:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.news-list-item .time-ago  { flex-shrink: 0; }
.news-list-item .source-badge { flex-shrink: 0; }

/* ── Phase 3 responsive ──────────────────────────────────────── */
@media (max-width: 960px) {
  .news-grid-sm { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .news-grid-sm     { grid-template-columns: 1fr; }
  .page-header-main { flex-direction: column; align-items: flex-start; }
  .news-list-title  { white-space: normal; }
}
