/* ─── Pathfinder Dashboard — Design System ─────────────────────── */
:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #21262d;
  --bg4: #30363d;
  --border: #30363d;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #484f58;
  --accent: #58a6ff;
  --accent2: #1f6feb;
  --green: #3fb950;
  --green-bg: #0d2920;
  --red: #f85149;
  --red-bg: #2d1014;
  --yellow: #e3b341;
  --yellow-bg: #2c2200;
  --purple: #bc8cff;
  --sidebar-w: 220px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --transition: .18s cubic-bezier(.4,0,.2,1);
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Layout ─── */
body { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.3px;
}
.logo-icon { font-size: 20px; }

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent2); color: #fff; }
.nav-icon { width: 18px; text-align: center; font-size: 13px; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tt-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.disconnected { background: var(--red); }
.status-dot.connecting { background: var(--yellow); animation: pulse 1.2s infinite; }

@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.4 } }

.time {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
}

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

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.top-bar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Cards / Ticker Grid ─── */
.ticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ticker-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.ticker-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.ticker-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.ticker-symbol {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}

.ticker-name {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

.ticker-price {
  text-align: right;
}
.price-value {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--mono);
}
.price-change {
  font-size: 12px;
  font-weight: 500;
  font-family: var(--mono);
}
.up { color: var(--green); }
.down { color: var(--red); }
.neutral { color: var(--text2); }

/* IV Bar */
.iv-section { margin: 12px 0; }
.iv-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 5px;
}
.iv-bar {
  height: 5px;
  background: var(--bg4);
  border-radius: 99px;
  overflow: hidden;
}
.iv-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s ease;
}
.iv-low .iv-fill { background: var(--green); }
.iv-mid .iv-fill { background: var(--yellow); }
.iv-high .iv-fill { background: var(--red); }

/* ─── Strategy Cards ─── */
.strategy-card {
    border-left: 4px solid var(--primary);
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    box-shadow: 0 4px 20px rgba(0, 255, 127, 0.1);
}
.strategy-card:hover {
    box-shadow: 0 8px 30px rgba(0, 255, 127, 0.2);
}
.section-header .badge {
    background: var(--primary);
    color: var(--bg);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Tags / Chips */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 99px;
}
.tag-earn { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(225,179,65,.3); }
.tag-div  { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(63,185,80,.3); }
.tag-warn { background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(248,81,73,.25); }

.card-actions { display: flex; gap: 8px; }
.card-footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.card-pe {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  background: rgba(88,166,255,.08);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: 6px;
  padding: 3px 8px;
  letter-spacing: .02em;
  white-space: nowrap;
}
/* ─── Extended hours price ─── */
.ext-price {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 11px;
  font-family: var(--mono);
}
.ext-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 1px 5px;
  border-radius: 4px;
}
.pre-market  .ext-badge { background: rgba(255,165,0,.2);  color: #ffaa00; border: 1px solid rgba(255,165,0,.3); }
.after-market .ext-badge { background: rgba(88,166,255,.15); color: var(--accent); border: 1px solid rgba(88,166,255,.25); }
.ext-val { color: var(--text); font-weight: 600; }
.ext-chg { font-size: 10px; }
/* Card footer layout */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.card-footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.card-timestamp {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.65;
  font-family: var(--mono);
  white-space: nowrap;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: opacity var(--transition), transform var(--transition);
}
.btn:hover { opacity: .85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent2); color: #fff; }
.btn-ghost   { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-danger  { background: rgba(248,81,73,.15); color: var(--red); border: 1px solid rgba(248,81,73,.3); }
.btn-sm      { padding: 4px 10px; font-size: 12px; }
.btn-full    { width: 100%; justify-content: center; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 13px;
}
thead th {
  background: var(--bg3);
  padding: 10px 12px;
  text-align: right;
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(48,54,61,.5);
  white-space: nowrap;
}
tbody td:first-child { text-align: left; }
tbody tr:hover td { background: var(--bg3); }
tbody tr.atm-row td { background: rgba(88,166,255,.07); }
tbody tr.atm-row td:first-child { border-left: 3px solid var(--accent); }

.pos { color: var(--green); }
.neg { color: var(--red); }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-select option { background: var(--bg3); }

/* ─── Section headers ─── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
}

/* ─── Toast ─── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast-ok  { border-left: 3px solid var(--green); }
.toast-err { border-left: 3px solid var(--red); }
.toast-info{ border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform:translateX(40px); opacity:0 } to { transform:none; opacity:1 } }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  transform: translateY(-12px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: none; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ─── Pill badge ─── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-gray  { background: var(--bg3);       color: var(--text2); }

/* ─── Loading skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: skel 1.4s infinite;
  border-radius: var(--radius);
  height: 14px;
}
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ─── Misc helpers ─── */
.text-mono  { font-family: var(--mono); }
.text-sm    { font-size: 12px; }
.text-muted { color: var(--text2); }
.gap-8      { gap: 8px; }
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-4  { margin-bottom: 4px; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }
.p-card { padding: 20px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ─── Calendar ─── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-header-day {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  padding: 6px 0;
  text-transform: uppercase;
}
.cal-day {
  min-height: 80px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  position: relative;
  transition: border-color var(--transition);
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.other-month { opacity: .35; }
.cal-day.today { border-color: var(--accent); background: rgba(88,166,255,.04); }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.cal-events { display: flex; flex-direction: column; gap: 3px; }
.cal-event {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event-earn { background: var(--yellow-bg); color: var(--yellow); }
.cal-event-div  { background: var(--green-bg);  color: var(--green); }

/* ─── Alert items ─── */
.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.alert-item.inactive { opacity: .55; }
.alert-symbol { font-family: var(--mono); font-weight: 700; font-size: 15px; width: 56px; flex-shrink: 0; }
.alert-info { flex: 1; }
.alert-condition { font-weight: 600; margin-bottom: 2px; }
.alert-params { font-size: 11px; color: var(--text2); }
.alert-actions { display: flex; gap: 6px; }

/* ─── Toggle ─── */
.toggle {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg4);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text2);
  transition: transform var(--transition), background var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent2); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }

/* ─── Info summary bar ─── */
.summary-bar {
  display: flex;
  gap: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 24px;
}
.summary-item { flex: 1; text-align: center; }
.summary-value { font-size: 24px; font-weight: 700; font-family: var(--mono); }
.summary-label { font-size: 11px; color: var(--text2); margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text2);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ─── Input group ─── */
.input-group { display: flex; gap: 8px; }
.input-group .form-input { flex: 1; }

/* ─── Chain header info ─── */
.chain-info-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.chain-info-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.chain-info-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.chain-info-value { font-family: var(--mono); font-size: 18px; font-weight: 700; }

/* ─── Trending Options Volume Banner ─── */
.trending-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 7px 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.trending-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}
.trending-ticker-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.trending-track {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  will-change: transform;
  /* animation applied dynamically by JS */
}
.trending-track:hover { animation-play-state: paused !important; }
@keyframes marquee-scroll-px {
  0%   { transform: translateX(0); }
  100% { transform: translateX(var(--trend-scroll-dist, -50%)); }
}
.trend-spacer { display: inline-block; width: 80px; }
.trend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 18px;
  font-size: 12px;
}
.trend-sym       { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }
.trend-sym.trend-up   { color: var(--green); }
.trend-sym.trend-down { color: var(--red); }
.trend-sym.trend-flat { color: var(--text2); }
.trend-price { font-family: var(--mono); font-weight: 600; }
.trend-price.trend-up   { color: var(--green); }
.trend-price.trend-down { color: var(--red); }
.trend-price.trend-flat { color: var(--text2); }
.trend-chg   { font-family: var(--mono); font-weight: 600; }
.trend-chg.trend-up   { color: var(--green); }
.trend-chg.trend-down { color: var(--red); }
.trend-vol   { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--yellow); }
.trend-sep   { color: var(--bg4); padding: 0 6px; font-size: 16px; }
.trend-pos   { font-family: var(--mono); font-size: 10px; font-weight: 700; color: #fff; opacity: .55; }

/* ─── NY Market Clock ─── */
.ny-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
}
.ny-clock-time {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.ny-clock-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ny-clock-status.market-open {
  background: var(--green-bg);
  color: var(--green);
  box-shadow: 0 0 6px rgba(63,185,80,.3);
}
.ny-clock-status.market-pre {
  background: var(--yellow-bg);
  color: var(--yellow);
}
.ny-clock-status.market-after {
  background: rgba(188,140,255,.12);
  color: var(--purple);
}
.ny-clock-status.market-closed {
  background: var(--bg3);
  color: var(--text3);
}

/* ─── Language Selector ─── */
.lang-selector {
  margin-bottom: 8px;
}
.lang-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
  display: block;
}
.lang-btns {
  display: flex;
  gap: 4px;
}
.lang-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}
.lang-btn:hover { border-color: var(--accent); color: var(--text); }
.lang-btn.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }

/* ─── Day chip checkboxes (report scheduler) ─── */
.day-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  transition: all var(--transition);
  user-select: none;
}
.day-chip:has(input:checked) {
  background: rgba(31,111,235,.25);
  border-color: var(--accent2);
  color: var(--accent);
}
.day-chip input { position: absolute; opacity: 0; width: 0; height: 0; }

/* ─── Card ─── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 700; }

/* ─── Search Suggestions ─── */
.search-suggestions {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
  box-shadow: var(--shadow);
}
.search-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover {
  background: var(--bg4);
}
.search-item .symbol {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
}
.search-item .desc {
  font-size: 11px;
  color: var(--text2);
  margin-top: 2px;
}

/* ─── Skeleton Loading (Punto 5) ─── */
.skeleton-row {
  background: linear-gradient(90deg, transparent 25%, rgba(31,111,235,0.08) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
