/* ═══════════════════════════════════════════════════════════════════════
   CHARTS / TABS — gemeinsame Styles fuer /charts UND /account/markets
   (ausgelagert aus index.html, damit "Alle Maerkte" im Dashboard exakt
   dieselbe Optik wie die oeffentliche Chart-Seite hat)
═══════════════════════════════════════════════════════════════════════ */

/* Alias-Variablen: index.html benutzte urspruenglich eigene Variablennamen
   fuer teils identische Werte aus style.css. Hier wird auf die globalen
   Tokens aus style.css gemappt, damit Hell/Dunkel weiterhin ueber
   [data-theme] auf Body-Ebene funktioniert und beide Seiten optisch
   konsistent bleiben. */
:root {
  --text-muted:   var(--muted);
  --radius-sm:    var(--r-sm);
  --radius:       var(--r);
  --radius-lg:    var(--r-lg);
  --border-hover: var(--border-2);
  --flat-soft:    rgba(148,163,184,0.10);
  --shadow-card:  var(--shadow);
}

/* ── Ticker ─────────────────────────────────────────────────────────── */
.v2-ticker-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 28px;
  height: 36px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.v2-ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12.5px;
}
.v2-ticker-item:first-child { padding-left: 0; }
.v2-ticker-label { color: var(--text-muted); font-weight: 500; }
.v2-ticker-price { font-family: 'Fira Code', monospace; font-weight: 600; color: var(--text); }
.v2-ticker-chg { font-family: 'Fira Code', monospace; font-size: 11.5px; font-weight: 600; }
.v2-ticker-chg.up { color: var(--up); }
.v2-ticker-chg.down { color: var(--down); }
.v2-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--up);
  animation: v2-pulse 2s ease-in-out infinite;
}
@keyframes v2-pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── Layout ─────────────────────────────────────────────────────────── */
.v2-layout {
  display: flex;
  min-height: calc(100vh - 130px);
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.v2-sidebar {
  width: 210px;
  flex: none;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.v2-sidebar-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 10px 4px;
}
.v2-sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  text-decoration: none;
  width: 100%;
}
.v2-sidebar-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.v2-sidebar-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
[data-theme="light"] .v2-sidebar-link:hover { background: rgba(0,0,0,0.05); }
.v2-sidebar-divider { height: 1px; background: var(--border); margin: 8px 4px; }

/* ── Main Content ─────────────────────────────────────────────────────── */
.v2-main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────── */
.v2-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.v2-breadcrumb a { color: var(--text-dim); }
.v2-breadcrumb a:hover { color: var(--accent); }
.v2-breadcrumb-sep { opacity: 0.4; }

/* ── Page Header ─────────────────────────────────────────────────────── */
.v2-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.v2-page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 3px;
}
.v2-page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ── Hidden banner ─────────────────────────────────────────────────── */
.v2-hidden-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.v2-hidden-banner button {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}

/* ── Outer Tab Pills ─────────────────────────────────────────────────── */
.v2-tab-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.v2-tab-pill {
  padding: 6px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.v2-tab-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.v2-tab-pill:hover:not(.active) {
  border-color: var(--border-hover);
  color: var(--text);
  background: rgba(255,255,255,0.05);
}
[data-theme="light"] .v2-tab-pill:hover:not(.active) { background: rgba(0,0,0,0.05); }
.v2-tab-panel { display: none; }
.v2-tab-panel.active { display: block; }

/* ── Search Bar ─────────────────────────────────────────────────────── */
.v2-search-wrap {
  position: relative;
  margin-bottom: 20px;
}
.v2-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.v2-search-input {
  width: 100%;
  max-width: 420px;
  padding: 9px 12px 9px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.v2-search-input::placeholder { color: var(--text-muted); }
.v2-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Inner Tab Pills (sub-tabs for Öl & Gas) ─────────────────────────── */
.v2-inner-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.v2-inner-tab-btn {
  padding: 6px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.v2-inner-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.v2-inner-tab-btn:hover:not(.active) { color: var(--text); }
.v2-inner-tab-panel { display: none; }
.v2-inner-tab-panel.active { display: block; }

/* ── Section Block ─────────────────────────────────────────────────── */
.v2-section-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.v2-section-block:hover { border-color: var(--border-hover); }
.v2-section-block.search-no-match { display: none; }
.v2-section-block.is-hidden { display: none; }
.v2-section-block.is-minimized .v2-section-body { display: none; }
.v2-section-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.v2-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .v2-section-header { background: rgba(0,0,0,0.02); }

.v2-section-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.v2-section-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.v2-section-count {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 99px;
}
[data-theme="light"] .v2-section-count { background: rgba(0,0,0,0.07); }
.v2-section-btn {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  line-height: 1.4;
}
.v2-section-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
[data-theme="light"] .v2-section-btn:hover { background: rgba(0,0,0,0.07); }

/* ── Price Table ─────────────────────────────────────────────────────── */
.v2-price-table {
  width: 100%;
  border-collapse: collapse;
}
.v2-price-table thead th {
  text-align: left;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.v2-price-table thead th:hover { color: var(--text-dim); }
.v2-price-table thead th.col-value,
.v2-price-table thead th.col-change { text-align: right; }
.v2-price-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}
[data-theme="light"] .v2-price-table tbody tr { border-bottom: 1px solid rgba(0,0,0,0.05); }
.v2-price-table tbody tr:last-child { border-bottom: none; }
.v2-price-table tbody tr:hover { background: rgba(255,255,255,0.03); }
[data-theme="light"] .v2-price-table tbody tr:hover { background: rgba(0,0,0,0.03); }
.v2-price-table td { padding: 9px 16px; font-size: 13.5px; }

.v2-col-product { white-space: nowrap; }
.v2-col-product a { color: var(--text-dim); transition: color 0.12s; font-weight: 500; }
.v2-col-product a:hover { color: var(--accent); }

.v2-col-value {
  text-align: right;
  font-family: 'Fira Code', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  width: 140px;
}
.v2-unit { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 3px; }

.v2-col-change { text-align: right; width: 120px; }

.v2-chg-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.v2-chg-pill.up   { color: var(--up);   background: var(--up-soft); }
.v2-chg-pill.down { color: var(--down); background: var(--down-soft); }
.v2-chg-pill.flat { color: var(--flat); background: var(--flat-soft); }
.v2-chg-arrow { font-size: 9px; }

.v2-col-watch { width: 44px; text-align: center; }
.v2-watch-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  transition: all 0.12s;
  line-height: 1.2;
}
.v2-watch-btn:hover, .v2-watch-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ── Alle Märkte ─────────────────────────────────────────────────────── */
.v2-markets-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.v2-markets-toolbar input, .v2-markets-toolbar select {
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.v2-markets-toolbar input { min-width: 220px; }
.v2-markets-toolbar input:focus, .v2-markets-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Metals Header ────────────────────────────────────────────────────── */
.v2-metals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  margin-top: 8px;
}
.v2-cur-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
[data-theme="light"] .v2-cur-toggle { background: rgba(0,0,0,0.05); }
.v2-cur-btn {
  padding: 4px 14px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.03em;
}
.v2-cur-btn.active { background: var(--accent); color: #fff; box-shadow: 0 1px 6px var(--accent-glow); }

/* ── Metals Table ─────────────────────────────────────────────────────── */
.v2-metals-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.v2-metals-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.v2-metals-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.v2-metals-table-title { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.v2-sparkline-col { width: 90px; }
.v2-sparkline-col svg { display: block; }
.v2-metals-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.v2-metals-cur-label { font-size: 13px; font-weight: 500; color: var(--text-dim); }

/* ── Empty State ─────────────────────────────────────────────────────── */
.v2-empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}
.v2-empty-state strong { display: block; color: var(--text-dim); font-size: 15px; margin-bottom: 6px; }

/* ── Disclaimer ─────────────────────────────────────────────────────── */
.v2-disclaimer {
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════
   REDESIGN-ERGÄNZUNGEN (Vorschlag 1): Markt-Überblick, Pill-Inner-Tabs,
   aufgeräumte Sektionsköpfe, mobile Karten-Ansicht.
═══════════════════════════════════════════════════════════════════════ */

/* ── Markt-Überblick: KPIs + Top-Mover ── */
.v2-overview { margin-bottom: 22px; }
.v2-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.v2-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.v2-kpi-k { font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 7px; }
.v2-kpi-v { font-family: 'Fira Code', monospace; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.v2-kpi-v.up { color: var(--up); }
.v2-kpi-v.down { color: var(--down); }
.v2-kpi-s { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.v2-sent { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 9px; background: var(--bg-elevated); }
.v2-sent i { display: block; height: 100%; }

.v2-movers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.v2-mv-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.v2-mv-h { padding: 11px 15px; border-bottom: 1px solid var(--border); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.v2-mv-h.up { color: var(--up); }
.v2-mv-h.down { color: var(--down); }
.v2-mv-row { display: flex; align-items: center; gap: 11px; padding: 9px 15px; border-bottom: 1px solid var(--border); text-decoration: none; }
.v2-mv-row:last-child { border-bottom: none; }
.v2-mv-row:hover { background: var(--bg-hover); }
.v2-mv-name { font-size: 12.5px; font-weight: 600; color: var(--text-dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-mv-name small { display: block; font-weight: 400; color: var(--text-muted); font-size: 10px; }
.v2-mv-row:hover .v2-mv-name { color: var(--accent); }
.v2-mv-price { font-family: 'Fira Code', monospace; font-size: 12.5px; font-weight: 600; text-align: right; min-width: 66px; color: var(--text); }
.v2-mv-chg { font-family: 'Fira Code', monospace; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.v2-mv-chg.up { background: var(--up-soft); color: var(--up); }
.v2-mv-chg.down { background: var(--down-soft); color: var(--down); }

/* ── Inner-Tabs als Pills ── */
.v2-inner-tabs { border-bottom: none; gap: 6px; flex-wrap: wrap; }
.v2-inner-tab-btn {
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 15px;
  background: var(--bg-card);
  color: var(--text-dim);
  margin-bottom: 0;
}
.v2-inner-tab-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); border-bottom-color: var(--accent); }
.v2-inner-tab-btn:hover:not(.active) { border-color: var(--border-2); color: var(--text); }

/* ── Sektionskopf aufgeräumt ── */
.v2-section-header { background: transparent; }
.v2-section-name { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; color: var(--text); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .v2-kpis { grid-template-columns: 1fr 1fr; }
  .v2-movers { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .v2-sidebar { display: none; }
  .v2-main { padding: 20px 20px 40px; }
}

/* ── Mobile: Preistabellen als kompakte 2-Zeilen Karten ── */
@media (max-width: 640px) {
  .v2-section-body { overflow: visible; }
  .v2-price-table thead { display: none; }
  .v2-price-table, .v2-price-table tbody { display: block; width: 100%; }

  /* Jede Zeile = kompakte Karte: Name links | Preis+Change rechts | +Button ganz rechts */
  .v2-price-table tr {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    gap: 2px 10px;
  }
  .v2-price-table tbody tr:last-child { border-bottom: none; }

  /* Alle Zellen standardmäßig ausblenden — nur bekannte Klassen einblenden */
  .v2-price-table td { display: none !important; padding: 0 !important; border: 0 !important; }
  .v2-price-table td::before { display: none; }

  /* Produktname: links, beide Zeilen */
  .v2-price-table td.v2-col-product {
    display: flex !important;
    align-items: center;
    grid-column: 1;
    grid-row: 1 / 3;
    font-size: 14px; font-weight: 600;
    color: var(--text); text-align: left;
    white-space: normal; line-height: 1.3;
  }
  .v2-price-table td.v2-col-product a { color: var(--text); text-decoration: none; }
  .v2-price-table td.v2-col-product a:hover { color: var(--accent); }

  /* Preis: oben rechts */
  .v2-price-table td.v2-col-value {
    display: block !important;
    grid-column: 2; grid-row: 1;
    font-family: 'Fira Code', monospace;
    font-size: 13px; font-weight: 700;
    color: var(--text); text-align: right;
    white-space: nowrap; font-variant-numeric: tabular-nums;
  }

  /* Veränderung: unten rechts */
  .v2-price-table td.v2-col-change {
    display: block !important;
    grid-column: 2; grid-row: 2;
    text-align: right;
  }

  /* Watchlist-Button: ganz rechts, beide Zeilen */
  .v2-price-table td.v2-col-watch {
    display: flex !important;
    grid-column: 3; grid-row: 1 / 3;
    align-items: center; justify-content: center;
  }

  /* Sparkline, Einheit (Edelmetalle) und sonstige Spalten ausblenden */
  .v2-price-table td.v2-sparkline-col { display: none !important; }
}
@media (max-width: 600px) {
  .v2-ticker-bar { padding: 0 16px; }
  .v2-main { padding: 16px 16px 32px; }
  .v2-search-input { max-width: 100%; }
}
