/* ── Header ───────────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .app-header { height: var(--header-height); padding: 0 var(--space-5); }
}

.header-left   { display: flex; align-items: center; gap: var(--space-2); }
.header-center { display: flex; align-items: center; justify-content: center; flex: 1; }
.header-right  { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--text-muted); }

/* Ruthie centered in header */
.header-ruthie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.chain-badge {
  font-size: var(--text-xs);
  background: rgba(153, 69, 255, 0.1);
  color: var(--purple);
  border: 1px solid rgba(153, 69, 255, 0.22);
  padding: 2px 7px;
  border-radius: 20px;
}

/* ── Status text ─────────────────────────────────────────────────────────────── */
.status-text {
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.token-count { font-size: var(--text-xs); color: var(--text-muted); border-left: 1px solid var(--border-subtle); padding-left: 8px; margin-left: 2px; }

/* ── Skin switcher ───────────────────────────────────────────────────────────── */
.skin-switcher {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  line-height: 1;
}
.skin-switcher:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.skin-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 4px;
  z-index: 200;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.skin-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.skin-dropdown-item:hover { background: var(--bg-surface); color: var(--text-primary); }
.skin-dropdown-item.active { color: var(--accent); }
.skin-dropdown-item.disabled { opacity: 0.35; cursor: default; }
.skin-dropdown-item.disabled:hover { background: none; color: var(--text-secondary); }

.skin-dropdown-icon  { font-size: 14px; width: 18px; text-align: center; }
.skin-dropdown-label { flex: 1; }
.skin-dropdown-note  { font-size: 9px; color: var(--text-muted); }
/* ── Header price ticker ────────────────────────────────────────────────────── */
.header-prices { display: none; align-items: center; gap: 12px; }
.header-price  { display: flex; align-items: center; gap: 3px; font-size: 11px; }

.header-price-icon { font-weight: 700; line-height: 1; }
.hp-sol { width: 14px; height: 14px; border-radius: 50%; }
.hp-btc { width: 14px; height: 14px; border-radius: 50%; }
.hp-eth { width: 14px; height: 14px; border-radius: 50%; }

.header-price-val { font-family: 'JetBrains Mono', monospace; color: var(--text-primary); font-weight: 600; }
.header-price-chg { font-size: 10px; display: none; }
.header-price-chg.up   { color: var(--green); }
.header-price-chg.down { color: var(--red); }

@media (min-width: 480px) { .header-prices { display: flex; } }
@media (min-width: 640px) { .header-price-chg { display: inline; } }

/* ── App layout ──────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: calc(100dvh - 48px);
  padding-bottom: 88px; /* 56px bottom nav + 32px mode strip on mobile */
}

@media (min-width: 768px) {
  .app-layout {
    height: calc(100dvh - var(--header-height));
    padding-bottom: 0;
  }
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  display: none; /* hidden on mobile */
}

@media (min-width: 768px) {
  .sidebar {
    display: flex;
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-base);
    border-right: 1px solid var(--border-subtle);
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
    flex-direction: column;
    gap: var(--space-5);
  }
}

.sidebar-title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.filter-group { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-label { font-size: var(--text-xs); color: var(--text-secondary); }
.filter-label-row { display: flex; align-items: center; justify-content: space-between; }
.select-all-label { font-size: var(--text-xs); color: var(--text-muted); display: flex; align-items: center; gap: var(--space-1); cursor: pointer; }
.filter-value { font-size: var(--text-sm); color: var(--text-primary); font-weight: 600; }

.filter-range {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border-default);
  border-radius: 2px;
  outline: none;
}
.filter-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 5px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-size: var(--text-xs);
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

.filter-search {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-family: inherit;
  padding: 7px 10px;
  outline: none;
  box-sizing: border-box;
}
.filter-search::placeholder { color: var(--text-muted); }
.filter-search:focus { border-color: var(--accent); }

.checkbox-group { display: flex; flex-direction: column; gap: 4px; }
.checkbox-group label { font-size: var(--text-xs); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.checkbox-group input[type="checkbox"] { accent-color: var(--accent); }

.btn-notify {
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.28);
  color: var(--green);
  padding: 7px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-notify:hover { background: rgba(0, 230, 118, 0.2); }
.btn-notify.enabled {
  background: rgba(0, 230, 118, 0.1);
  border-color: rgba(0, 230, 118, 0.3);
  color: var(--green);
}

.sidebar-stats { margin-top: auto; border-top: 1px solid var(--border-subtle); padding-top: var(--space-3); }
.stat-row { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); padding: 3px 0; }

/* ── Main content wrapper ────────────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Panel containers ────────────────────────────────────────────────────────── */
#tracker-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#tracker-panel[hidden],
#trades-panel[hidden],
#perps-tracker-panel[hidden],
#perps-trades-panel[hidden] { display: none; }

/* ── Perps mode — hide sidebar (no meme filters needed) ────────────────────── */
body[data-mode="perps"] .sidebar { display: none !important; }

#trades-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ── Token grid ──────────────────────────────────────────────────────────────── */
.token-grid {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-content: start;
}

@media (min-width: 480px) {
  .token-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

@media (min-width: 1024px) {
  .token-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}

/* ── Bottom nav (mobile only) ────────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-base);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  align-items: stretch;
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }
}

.bottom-nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: color 0.15s;
  padding: 0;
}
.bottom-nav-btn.active { color: var(--accent); }
.bottom-nav-btn:hover:not(.active) { color: var(--text-secondary); }
.bottom-nav-icon  { font-size: 20px; line-height: 1; }
.bottom-nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.3px; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px var(--space-5);
  color: var(--text-muted);
  gap: var(--space-2);
  text-align: center;
}
.empty-icon { font-size: 40px; color: var(--green); opacity: 0.35; }
.empty-sub  { font-size: var(--text-xs); color: var(--text-muted); }

.btn-add-ca {
  margin-top: var(--space-2);
  padding: 8px 20px;
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 6px;
  color: var(--green);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
}
.btn-add-ca:hover { background: rgba(0, 230, 118, 0.22); }
.btn-add-ca:disabled { opacity: 0.5; cursor: default; }

/* ── Toast container ─────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 72px; /* above bottom nav */
  right: var(--space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

@media (min-width: 768px) {
  .toast-container { bottom: var(--space-5); }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RUTHIE AVATAR SYSTEM
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Base avatar ────────────────────────────────────────────────────────────── */
.ruthie-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(0, 230, 118, 0.3);
  user-select: none;
  pointer-events: none;
}

/* ── Size variants ──────────────────────────────────────────────────────────── */
.ruthie-avatar--header {
  width: 36px;
  height: 36px;
  border-width: 1.5px;
}
@media (min-width: 768px) {
  .ruthie-avatar--header { width: 42px; height: 42px; }
}

.ruthie-avatar--sidebar {
  width: 40px;
  height: 40px;
  box-shadow: 0 0 12px 2px rgba(0, 230, 118, 0.15);
}

.ruthie-avatar--empty {
  width: 80px;
  height: 80px;
  border-width: 2px;
  animation: ruthie-breathe-empty 4s ease-in-out infinite;
}
@media (min-width: 768px) {
  .ruthie-avatar--empty { width: 100px; height: 100px; }
}

.ruthie-avatar--toast {
  width: 28px;
  height: 28px;
  border-width: 1.5px;
}

.ruthie-avatar--intel {
  width: 22px;
  height: 22px;
  border-width: 1px;
}

.ruthie-avatar--trades-empty {
  width: 48px;
  height: 48px;
  opacity: 0.5;
}

/* ── Connection state classes ───────────────────────────────────────────────── */
/* Smoking Ruthie stays green monochrome always — glow ring adapts to skin accent */
.ruthie-state-live {
  border-color: var(--accent-glow, rgba(0, 230, 118, 0.5));
  animation: ruthie-breathe 4s ease-in-out infinite, ruthie-glow-ring 3s ease-in-out infinite;
  filter: none;
  opacity: 1;
}

.ruthie-state-connecting {
  filter: grayscale(1) brightness(0.6);
  opacity: 0.5;
  border-color: rgba(255, 193, 7, 0.3);
  animation: ruthie-reconnect 1s ease-in-out infinite;
}

.ruthie-state-error {
  filter: grayscale(1) brightness(0.5);
  opacity: 0.4;
  border-color: rgba(255, 77, 77, 0.3);
  animation: none;
}

/* ── Keyframes ──────────────────────────────────────────────────────────────── */
/* Glow ring adapts to skin accent color */
@keyframes ruthie-glow-ring {
  0%, 100% { box-shadow: 0 0 6px 1px var(--accent-dim, rgba(0, 230, 118, 0.15)); }
  50%      { box-shadow: 0 0 14px 4px var(--accent-glow, rgba(0, 230, 118, 0.4)); }
}

/* Slow breathe — she's alive, she's working */
@keyframes ruthie-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

/* Reconnecting blink */
@keyframes ruthie-reconnect {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.2; }
}

/* Legacy — used by empty state avatar */
@keyframes ruthie-breathe-empty {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.03); }
}

/* ── Sidebar brand / mood section ──────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-mood {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.sidebar-mood-emoji {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.sidebar-brand-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-brand-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  transition: color 0.3s;
}

.sidebar-brand-status {
  font-size: 10px;
  color: var(--text-muted);
  transition: color 0.3s;
}

/* Mood color states */
.mood-fire    .sidebar-brand-name { color: #ff6b35; }
.mood-bullish .sidebar-brand-name { color: var(--green); }
.mood-neutral .sidebar-brand-name { color: var(--yellow); }
.mood-cautious .sidebar-brand-name { color: #ff9800; }
.mood-bearish .sidebar-brand-name { color: var(--red); }
