/* =============================================================
   Monopoly Money Investor — Custom Stylesheet
   Supplements Bootstrap 5
   ============================================================= */

/* ---------- Base ---------- */
:root {
  --color-ai:        #8f6438;
  --color-advisor:   #b1814d;
  --color-self:      #d4a36f;
  --color-gain:      #2f7a47;
  --color-loss:      #b33a32;
  --color-neutral:   #6d5f50;
  --color-bg:        #f5eee5;
  --color-card:      #fffaf4;
  --color-border:    #dcc8b1;
  --color-nav-bg:    #2f2622;
  --color-nav-text:  #e8d5bf;
  --color-nav-hover: #fff3e3;
  --portfolio-ai:    #3b82f6;
  --portfolio-fa:    #10b981;
  --portfolio-my:    #f59e0b;
  --portfolio-overall: #dc2626;
  --radius:          0.5rem;
  --shadow:          0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:       0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

body {
  background-color: var(--color-bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #2e241e;
  font-size: 0.9rem;
}

/* ---------- Navigation ---------- */
.navbar-brand { font-weight: 700; letter-spacing: -0.02em; font-size: 1.1rem; display: inline-flex; align-items: center; gap: 0.5rem; }
.site-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  padding: 10px;
  background: #ffffff;
  border: 2px solid #d9c3a9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98), 0 4px 12px rgba(47, 38, 34, 0.35);
  flex: 0 0 auto;
}
.site-logo {
  width: 64px !important;
  height: 64px !important;
  max-width: 64px !important;
  max-height: 64px !important;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.explainer-logo {
  width: auto !important;
  height: 100% !important;
  max-width: 200px !important;
  max-height: none !important;
  object-fit: contain;
  display: block;
}
.mmi-explainer-body { display: flex; align-items: stretch; gap: 0.75rem; }
.mmi-explainer-logo-wrap { flex: 0 0 auto; display: flex; align-items: stretch; }
.mmi-explainer-copy { flex: 1 1 auto; }
.mmi-explainer a { color: inherit; text-decoration: none; }
.mmi-explainer a:hover { color: var(--color-ai); text-decoration: underline; }
.nav-link { color: var(--color-nav-text) !important; font-size: 0.875rem; }
.nav-link:hover, .nav-link.active { color: var(--color-nav-hover) !important; }
.navbar { background-color: var(--color-nav-bg) !important; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--color-card);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.875rem 1.25rem;
}

/* ---------- Portfolio accent cards ---------- */
.portfolio-card { transition: transform .15s ease, box-shadow .15s ease; cursor: pointer; }
.portfolio-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.portfolio-card .card-accent { height: 4px; border-radius: var(--radius) var(--radius) 0 0; }
.portfolio-card.ai      .card-accent { background: var(--portfolio-ai); }
.portfolio-card.advisor .card-accent { background: var(--portfolio-fa); }
.portfolio-card.self    .card-accent { background: var(--portfolio-my); }

/* ---------- Stats / KPI ---------- */
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--color-neutral); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-change { font-size: 0.85rem; font-weight: 600; }

/* ---------- Gain / Loss colours ---------- */
.text-gain    { color: var(--color-gain)  !important; }
.text-loss    { color: var(--color-loss)  !important; }
.text-neutral { color: var(--color-neutral) !important; }
.text-amber   { color: #b07a45 !important; }

/* ---------- Badges ---------- */
.badge { font-weight: 500; font-size: 0.7rem; padding: 0.25em 0.6em; border-radius: 99px; }
.badge-ai      { background-color: rgba(59,130,246,.14); color: #1d4ed8; }
.badge-advisor { background-color: rgba(16,185,129,.14); color: #047857; }
.badge-self    { background-color: rgba(245,158,11,.18); color: #b45309; }
.badge-overall { background-color: rgba(220,38,38,.12); color: #b91c1c; }
.badge-risk-low  { background-color: rgba(47,122,71,.14); color: #1f5a33; }
.badge-risk-med  { background-color: rgba(176,122,69,.18); color: #7a4f24; }
.badge-risk-high { background-color: rgba(179,58,50,.12);  color: #8f2a24; }

/* ---------- Asset type badges (consistent across all portfolios) ----------
   Palette (left → right from swatch):
   Teal · Cyan · Lime · Yellow · Orange · Hot Pink · Lavender · Purple
   ---------------------------------------------------------------- */
.badge-type-etf              { background-color: rgba(0,188,212,.15);   color: #006b78 !important; } /* Teal      #00BCD4 */
.badge-type-stock            { background-color: rgba(136,232,64,.18);  color: #3d6810 !important; } /* Lime      #88E840 */
.badge-type-oeic             { background-color: rgba(255,68,192,.14);  color: #8a0064 !important; } /* Hot Pink  #FF44C0 */
.badge-type-unit_trust       { background-color: rgba(255,224,64,.18);  color: #7a5a00 !important; } /* Yellow    #FFE040 */
.badge-type-investment_trust { background-color: rgba(255,160,64,.16);  color: #7a4400 !important; } /* Orange    #FFA040 */
.badge-type-bond             { background-color: rgba(0,224,208,.15);   color: #006860 !important; } /* Cyan      #00E0D0 */
.badge-type-cash             { background-color: rgba(204,170,255,.18); color: #4422aa !important; } /* Lavender  #CCAAFF */
.badge-type-other            { background-color: rgba(153,102,255,.15); color: #4400bb !important; } /* Purple    #9966FF */

/* ---------- Tables ---------- */
.table { font-size: 0.85rem; }
.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-neutral);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background-color: rgba(224,176,143,.18); }

/* ---------- External research links ---------- */
.ext-links { margin-top: 3px; display: flex; gap: 3px; flex-wrap: wrap; }
.ext-link {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #d3bca2;
  color: #8f7c68;
  text-decoration: none;
  line-height: 1.6;
  transition: border-color .15s, color .15s;
}
.ext-link:hover { color: #2e241e; border-color: #8f6438; }

/* ---------- Sortable table headers ---------- */
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.table thead th.sortable:hover { color: #2e241e; }
.table thead th.sortable::after { content: ' ↕'; opacity: 0.35; font-size: 0.65rem; }
.table thead th.sort-asc::after  { content: ' ↑'; opacity: 1; color: #8f6438; }
.table thead th.sort-desc::after { content: ' ↓'; opacity: 1; color: #8f6438; }

/* ---------- Charts ---------- */
.chart-container { position: relative; }

/* ---------- Page header ---------- */
.page-header { padding: 1.5rem 0 1rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { font-size: 0.8rem; margin: 0; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: 0.82rem; color: #4a3d33; }
.form-control, .form-select {
  border-color: var(--color-border);
  font-size: 0.875rem;
  border-radius: 0.375rem;
}
.form-control:focus, .form-select:focus {
  border-color: #8f6438;
  box-shadow: 0 0 0 3px rgba(143,100,56,.18);
}
.form-text { font-size: 0.75rem; color: var(--color-neutral); }

/* ---------- Risk slider ---------- */
.risk-display {
  display: inline-block;
  width: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.risk-bar {
  position: relative;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(to right, #2f7a47, #b07a45, #b33a32);
  margin: 0.25rem 0;
  overflow: visible;
}
.risk-scale {
  position: relative;
  padding: 4px 0;
}
.risk-indicator {
  position: absolute;
  top: -6px;
  width: 4px;
  height: 18px;
  background: #111827;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.95);
  transform: translateX(-50%);
  z-index: 5;
}
.risk-indicator::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #111827;
  box-shadow: 0 0 0 2px #ffffff;
  transform: translateX(-50%);
}

/* ---------- Allocation bar ---------- */
.alloc-bar { height: 8px; border-radius: 99px; background: var(--color-border); overflow: hidden; }
.alloc-bar-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ---------- Flash alerts ---------- */
.alert { font-size: 0.875rem; border-radius: var(--radius); }

/* ---------- Site footer ---------- */
.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-neutral);
}
.site-footer a {
  color: #5f3e1f;
  text-decoration: none;
}
.site-footer a:hover { color: #2f2622; }
.footer-github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}
.footer-github-link svg {
  width: 16px;
  height: 16px;
}

/* ---------- No data placeholder ---------- */
.no-data-placeholder {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-neutral);
}
.no-data-placeholder .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ---------- Admin panel ---------- */
.admin-section { background: #fff5e8; border: 1px solid #e7c9a6; border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 768px) {
  .stat-value { font-size: 1.25rem; }
  .table-responsive-sm { overflow-x: auto; }
  .mmi-explainer-body { display: block; }
  .explainer-logo {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    margin: 0 0 0.5rem 0;
  }
}

/* ---------- Print ---------- */
@media print {
  .navbar, .btn, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

