/* File: docs/styles.css
   Navy / Trading-212-inspired theme
*/

/* -----------------------------
   Design tokens
------------------------------ */
:root{
  --bg: #08101b;
  --bg-2: #0b1524;
  --panel: #0d1b2c;
  --panel-2: #0b1828;

  --text: #e9f1ff;
  --muted: rgba(233,241,255,0.68);

  --border: rgba(233,241,255,0.10);
  --border-2: rgba(233,241,255,0.14);

  --accent: #00ABE0;
  --accent-2: rgba(0,171,224,0.16);

  --ok: rgba(80, 220, 140, 0.90);
  --warn: rgba(255, 200, 80, 0.95);
  --bad: rgba(255, 120, 120, 0.95);

  --shadow: rgba(0, 0, 0, 0.42);

  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 12px;

  --pad: 14px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 550px at 20% 0%, rgba(0,171,224,0.15), transparent 60%),
    radial-gradient(800px 520px at 90% 20%, rgba(255,144,59,0.10), transparent 55%),
    linear-gradient(180deg, var(--bg), #060c14 65%);
  font-variant-numeric: tabular-nums;
}

.hidden{ display: none !important; }

/* -----------------------------
   Top bar
------------------------------ */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 16, 27, 0.68);
  backdrop-filter: blur(10px);
}

.brand{ display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo{
  width: 38px; height: 38px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 800;
  background: rgba(233,241,255,0.06);
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px var(--shadow);
}
.brand-title{ font-weight: 900; font-size: 14px; line-height: 1.1; }
.brand-subtitle{
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62vw;
}

/* -----------------------------
   Buttons
------------------------------ */
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(233,241,255,0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 10px 34px rgba(0,0,0,0.25);
}
.btn:hover{ background: rgba(233,241,255,0.09); border-color: var(--border-2); }
.btn:active{ transform: translateY(1px); }
.btn:focus{
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-2), 0 10px 34px rgba(0,0,0,0.25);
  border-color: rgba(0,171,224,0.45);
}
.btn-ghost{ background: transparent; box-shadow: none; }
.btn-ghost:hover{ background: rgba(233,241,255,0.06); }

.btn-accent{
  background: rgba(0,171,224,0.18);
  border-color: rgba(0,171,224,0.35);
}
.btn-accent:hover{
  background: rgba(0,171,224,0.24);
  border-color: rgba(0,171,224,0.55);
}

/* -----------------------------
   Layout
------------------------------ */
.layout{
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 14px;
  padding: var(--pad);
  max-width: 1220px;
  margin: 0 auto;
}
.layout-single{
  grid-template-columns: 1fr;
  max-width: 860px;
}

.panel, .drawer{
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(13, 27, 44, 0.78);
  box-shadow: 0 20px 70px var(--shadow);
  overflow: hidden;
}

.panel-header{
  padding: 16px 16px 10px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.00));
}
.panel-header h1{
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0.2px;
}
.summary{ font-size: 13px; color: var(--muted); }
.panel-body{ padding: 16px; }

/* Keep the warning banner consistent inside a panel body */
#partialWithdrawalCard .banner{
  border-bottom: none;
  margin-bottom: 12px;
}

/* Calculator output grid: 3-up on desktop, 1-up on small screens */
#partialWithdrawalCard .kv{
  grid-template-columns: 1.2fr 1fr 1fr;
  margin-bottom: 0;
}

/* Emphasise the tax number slightly */
#partialWithdrawalCard #withdrawTax{
  font-size: 18px;
}

/* Subtle spacing for helper lines */
#partialWithdrawalCard #withdrawMax{
  margin-top: 6px;
}

@media (max-width: 980px){
  #partialWithdrawalCard .kv{
    grid-template-columns: 1fr;
  }
}

/* -----------------------------
   Banners
------------------------------ */
.banner{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 200, 80, 0.11);
  color: rgba(255, 236, 200, 0.95);
  border-radius: 14px;
}
.banner-warn{
  background: rgba(255, 200, 80, 0.11);
}
.banner-danger{
  border-radius: 0;
  background: rgba(140, 20, 30, 0.30);
  color: rgba(255, 210, 210, 0.98);
  border-bottom: 1px solid rgba(255, 120, 120, 0.35);
}

/* -----------------------------
   Table
------------------------------ */
.table-wrap{ overflow: auto; }
.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th{
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.2px;
  background: rgba(8, 16, 27, 0.18);
  position: sticky;
  top: 0;
  z-index: 2;
}
.table td.num, .table th.num{ text-align: right; }
.table tbody tr{
  cursor: pointer;
  transition: background 120ms ease;
}
.table tbody tr:hover{ background: rgba(233,241,255,0.04); }
.table tbody tr.selected{
  background: rgba(0,171,224,0.10);
  outline: 1px solid rgba(0,171,224,0.25);
}

/* -----------------------------
   Security cell (Name + ticker)
   ----------------------------- */
.table td:first-child{
  max-width: 520px;
}

/* Top line: security name */
.table td:first-child > div:first-child{
  font-weight: 950 !important;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

/* Second line: ticker */
.table td:first-child > div:nth-child(2){
  margin-top: 3px !important;
  font-size: 12px !important;
  color: var(--muted) !important;
  font-weight: 800;
  letter-spacing: 0.2px;
}

@media (max-width: 980px){
  .table td:first-child{ max-width: 320px; }
}

/* Value colours */
.pos{ color: rgba(80,220,140,0.95); font-weight: 900; }
.neg{ color: rgba(255,120,120,0.95); font-weight: 900; }
.dim{ color: var(--muted); }

/* -----------------------------
   Drawer
------------------------------ */
.drawer-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 16, 27, 0.16);
}
.drawer-title{ font-weight: 950; font-size: 13px; letter-spacing: 0.2px; }
.drawer-subtitle{
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  max-width: 46ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-body{ padding: 14px; }

.kv{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.card{
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(11, 24, 40, 0.72);
}
.label{ font-size: 12px; color: var(--muted); font-weight: 800; }
.value{ margin-top: 6px; font-weight: 950; letter-spacing: 0.2px; }
.section-title{ margin: 12px 0 8px 0; font-size: 13px; font-weight: 950; }

/* -----------------------------
   Forms
------------------------------ */
.form{ display: grid; gap: 12px; margin-top: 12px; }
.form-wide{ max-width: 720px; }

.field label{
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
}
.field input{
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(233,241,255,0.06);
  color: var(--text);
  font-size: 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.field input:hover{ background: rgba(233,241,255,0.07); }
.field input:focus{
  outline: none;
  border-color: rgba(35, 41, 43, 0.55);
  box-shadow: 0 0 0 3px var(--accent-2);
}

.row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.row-right{ justify-content: flex-end; }

.checkbox{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.checkbox input{ transform: translateY(1px); }

.small{ margin-top: 8px; font-size: 12px; color: var(--muted); }
.hint{ padding: 12px 14px; color: var(--muted); font-size: 12px; }

/* Overdue question cards */
.overdue-list{ display: grid; gap: 12px; margin-top: 14px; }
.overdue-item-title{ font-weight: 950; }
.overdue-item-sub{ color: var(--muted); font-size: 12px; margin-top: 2px; }

/* -----------------------------
   Chart area
------------------------------ */
.chart-wrap{
  padding: 14px;
  border-top: 1px solid var(--border);
  background: rgba(8, 16, 27, 0.10);
}
.chart-title{
  font-weight: 950;
  font-size: 13px;
  margin-bottom: 10px;
}

/* -----------------------------
   Empty + footer
------------------------------ */
.empty{
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
  border: 1px dashed rgba(233,241,255,0.16);
  border-radius: 14px;
  background: rgba(11, 24, 40, 0.40);
}
.footer{
  max-width: 1220px;
  margin: 10px auto 24px auto;
  padding: 0 14px;
}
.disclaimer{ color: var(--muted); font-size: 12px; }

/* -----------------------------
   Responsive
------------------------------ */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
}
