/* ===== Portfolio Manager – Custom Styles ===== */

:root {
  --sidebar-width: 230px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
  --topbar-bg: #ffffff;
  --body-bg: #f1f5f9;
  --card-radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
  background: var(--body-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #1e293b;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-weight: 700;
  font-size: 15px;
  color: #f8fafc;
  line-height: 1.3;
}

.sidebar-header .bi {
  font-size: 26px;
  color: var(--sidebar-active);
  flex-shrink: 0;
}

.sidebar-header small {
  font-weight: 400;
  font-size: 11px;
  color: var(--sidebar-text);
}

.sidebar .nav-link {
  color: var(--sidebar-text);
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  transition: background .15s, color .15s;
}

.sidebar .nav-link:hover {
  background: rgba(255,255,255,.07);
  color: #f8fafc;
}

.sidebar .nav-link.active {
  background: var(--sidebar-active);
  color: #ffffff;
  font-weight: 600;
}

.sidebar .nav-link .bi {
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ===== Main Content ===== */
.main-content {
  min-width: 0;
  background: var(--body-bg);
}

/* ===== Topbar ===== */
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid #e2e8f0;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

/* ===== Content Area ===== */
.content {
  max-width: 1400px;
}

/* ===== Cards ===== */
.card {
  border-radius: var(--card-radius) !important;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ===== KPI Cards ===== */
.kpi-card .card-body {
  padding: 20px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin: 4px 0;
}

/* ===== Tables ===== */
.table {
  font-size: 13.5px;
}

.table thead th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom-width: 1px;
  white-space: nowrap;
}

.table-dark thead th {
  background: #1e293b;
  border-color: #334155;
}

.table tbody tr:hover {
  background: #f8fafc;
}

/* ===== Asset Type Badges ===== */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.asset-badge-aktie {
  background: #dbeafe;
  color: #1d4ed8;
}

.asset-badge-rohstoff {
  background: #fef3c7;
  color: #92400e;
}

.asset-badge-krypto {
  background: #f3e8ff;
  color: #7c3aed;
}

.asset-badge-sonstige {
  background: #f1f5f9;
  color: #64748b;
}

/* ===== Buttons ===== */
.btn {
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 5px;
}

.btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

/* ===== Alerts ===== */
.alert {
  border-radius: 10px;
  border: none;
  font-size: 13.5px;
}

/* ===== Forms ===== */
.form-control, .form-select {
  border-radius: 8px;
  border-color: #cbd5e1;
  font-size: 14px;
}

.form-control:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-label {
  font-size: 13px;
  color: #374151;
  margin-bottom: 4px;
}

/* ===== Colors ===== */
.text-success { color: #059669 !important; }
.text-danger  { color: #dc2626 !important; }
.bg-success   { background-color: #059669 !important; }
.bg-danger    { background-color: #dc2626 !important; }

/* ===== Edelmetalle / Precious Metals ===== */

/* Exchange-Badges in der Header-Zeile */
.pm-exchange-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #fff;
}
.pm-exchange-badge.comex    { background: #1e40af; }
.pm-exchange-badge.london   { background: #7e22ce; }
.pm-exchange-badge.shanghai { background: #b91c1c; }

/* Spot-Preis-Tabelle */
.spot-price-card { border: 2px solid #e2e8f0; }

.spot-price-table th,
.spot-price-table td {
  font-size: 0.82rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* Gruppen-Farben in der Tabellen-Header */
.pm-header-comex    { background: #dbeafe !important; color: #1e40af !important; font-weight: 700; }
.pm-header-london   { background: #f3e8ff !important; color: #7e22ce !important; font-weight: 700; }
.pm-header-shanghai { background: #fee2e2 !important; color: #b91c1c !important; font-weight: 700; }

.pm-sub-comex    { background: #eff6ff !important; color: #1d4ed8; font-weight: 600; font-size: 0.75rem; }
.pm-sub-london   { background: #faf5ff !important; color: #6d28d9; font-weight: 600; font-size: 0.75rem; }
.pm-sub-shanghai { background: #fff1f2 !important; color: #9f1239; font-weight: 600; font-size: 0.75rem; }

/* Metall-Spalte */
.pm-metal-col { min-width: 80px; background: #f8fafc; }
.pm-metal-name {
  font-weight: 600;
  padding-left: 1rem !important;
  background: #f8fafc;
}

/* Farbige Punkte für Gold/Silber */
.pm-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}
.gold-dot   { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.25); }
.silver-dot { background: #94a3b8; box-shadow: 0 0 0 2px rgba(148,163,184,.25); }

/* Physische Münzkarten */
.physical-coin-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.physical-coin-card .card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

/* Statistik-Karten im Verlaufs-Abschnitt */
.pm-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}
.pm-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
  margin-bottom: 2px;
}
.pm-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

/* ===== Accounts / Broker ===== */

/* Kreisförmiges Broker-Icon */
.broker-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* Account-Zeilen-Karte */
.account-row-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: box-shadow .15s;
}
.account-row-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

/* Detail-Felder in der Account-Zeile */
.account-detail-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #94a3b8;
  margin-bottom: 1px;
}
.account-detail-value {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
}

/* Broker-Typ-Auswahl-Karten (im Formular) */
.broker-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  background: #fff;
}
.broker-type-card:hover {
  border-color: var(--bt-color, #3b82f6);
  background: var(--bt-bg, #eff6ff);
}
.btn-check:checked + .broker-type-card {
  border-color: var(--bt-color, #3b82f6);
  background: var(--bt-bg, #eff6ff);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.broker-type-icon {
  font-size: 1.8rem;
  color: var(--bt-color, #3b82f6);
}

/* Broker-Felder-Gruppen Übergang */
.broker-fields {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 1rem;
}

/* ===== Sidebar Section Label ===== */
.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #475569;
  padding: 4px 12px 2px;
  font-weight: 700;
}

/* ===== Login Page ===== */
body.login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f3460 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,.5);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}

.login-input {
  background: #0f172a;
  border-color: rgba(255,255,255,.1);
  color: #f8fafc;
}

.login-input:focus {
  background: #0f172a;
  border-color: #3b82f6;
  color: #f8fafc;
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}

.login-input::placeholder {
  color: #475569;
}

.login-input-icon {
  background: #0f172a;
  border-color: rgba(255,255,255,.1);
  color: #475569;
}

.login-pw-toggle {
  background: #0f172a;
  border-color: rgba(255,255,255,.1);
  color: #475569;
}

.login-pw-toggle:hover {
  background: #1e293b;
  color: #94a3b8;
  border-color: rgba(255,255,255,.2);
}

.login-btn {
  padding: 10px;
  font-weight: 600;
  font-size: 14px;
}

/* ===== User Avatar ===== */
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

/* ===== Physical Holdings ===== */
.holding-coin-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.holding-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.holding-stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

/* ===== Analytics / Ticker ===== */
.ticker-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: box-shadow .15s, transform .15s;
}

.ticker-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.ticker-symbol {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  font-family: monospace;
}

.ticker-name {
  font-size: 0.8rem;
}

.ticker-kpi-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}

.ticker-kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.ticker-kpi-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

/* ===== Partners ===== */
.partner-release-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: box-shadow .15s;
}

.partner-release-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.partner-coin-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.partner-stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.partner-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.partner-stat-value {
  font-size: 1rem;
  font-weight: 700;
}

/* ===== Investors ===== */
.investor-stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
}

.investor-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #64748b;
  margin-bottom: 4px;
}

.investor-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-header span,
  .sidebar .nav-link span:not(.bi),
  .sidebar-footer .btn-sm { display: none; }
  .sidebar-header .bi { font-size: 20px; }
  .sidebar .nav-link { justify-content: center; padding: 10px; }
}
