/* ==============================================================================
   NODESYNC STOCKS APP - BAUHAUS MINIMALIST DESIGN SYSTEM
   "Form follows function. Geometric clarity, high contrast, pure utility."
   ============================================================================== */

:root {
  --bg-primary: #F8F8F6;
  --bg-card: #FFFFFF;
  --bg-alt: #F0F0EC;
  --bg-dark: #121212;
  
  --border-strong: #111111;
  --border-subtle: #D5D5CE;
  --border-focus: #0055A5;

  --text-main: #111111;
  --text-muted: #555550;
  --text-light: #7E7E78;
  --text-inverse: #FFFFFF;

  /* Primary Bauhaus Color Palette */
  --bauhaus-red: #D9381E;
  --bauhaus-blue: #0055A5;
  --bauhaus-yellow: #E5A910;
  --bauhaus-black: #111111;
  --bauhaus-gray: #E2E2DC;

  /* Financial Status Accents */
  --finance-gain: #008744;
  --finance-loss: #D9381E;
  --finance-neutral: #555550;
  --finance-highlight: #0055A5;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  
  --shadow-bauhaus: 4px 4px 0px #111111;
  --shadow-subtle: 2px 2px 0px #111111;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding: 0 0 60px 0;
}

/* ==========================================================================
   Header & Masthead
   ========================================================================== */

.bauhaus-masthead {
  background: var(--bauhaus-black);
  color: var(--text-inverse);
  border-bottom: 4px solid var(--bauhaus-blue);
  padding: 20px 32px;
}

.masthead-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bauhaus-shapes {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shape-square {
  width: 16px;
  height: 16px;
  background-color: var(--bauhaus-red);
}

.shape-circle {
  width: 16px;
  height: 16px;
  background-color: var(--bauhaus-blue);
  border-radius: 50%;
}

.shape-triangle {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 16px solid var(--bauhaus-yellow);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #FFF;
}

.brand-text p {
  font-size: 0.8rem;
  color: #A0A09B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.masthead-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.account-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 4px 10px;
  border-radius: 2px;
}

.account-selector-wrap label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.05em;
}

.account-select {
  background: transparent;
  color: #FFF;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.account-select option {
  background: #1e1e1e;
  color: #FFF;
}

.meta-pill {
  background: #222222;
  border: 1px solid #383838;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: #D0D0CA;
}

.btn-refresh {
  background: var(--bauhaus-yellow);
  color: var(--bauhaus-black);
  border: 1px solid var(--bauhaus-black);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 2px 2px 0px #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-refresh:hover {
  background: #f7b81b;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
}

.btn-refresh:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

/* ==========================================================================
   Navigation Tab Bar
   ========================================================================== */

.tab-nav-bar {
  background: #FFFFFF;
  border-bottom: 2px solid var(--border-strong);
}

.tab-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  padding: 0 32px;
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 14px 20px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-alt);
}

.tab-btn.active {
  color: var(--bauhaus-black);
  border-bottom: 3px solid var(--bauhaus-red);
  background-color: transparent;
}

.tab-badge {
  background: var(--bauhaus-gray);
  color: var(--text-main);
  padding: 2px 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 2px;
}

.tab-btn.active .tab-badge {
  background: var(--bauhaus-black);
  color: #FFF;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.app-container {
  max-width: 1440px;
  margin: 28px auto 0 auto;
  padding: 0 32px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Privacy & Masking Banner */
.privacy-banner {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--bauhaus-blue);
  padding: 10px 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.privacy-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  background: #E8EEF5;
  color: var(--bauhaus-blue);
  padding: 2px 6px;
  margin-right: 6px;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  padding: 16px 20px;
  box-shadow: var(--shadow-subtle);
  position: relative;
}

.metric-card.accent-red { border-top: 5px solid var(--bauhaus-red); }
.metric-card.accent-blue { border-top: 5px solid var(--bauhaus-blue); }
.metric-card.accent-yellow { border-top: 5px solid var(--bauhaus-yellow); }
.metric-card.accent-black { border-top: 5px solid var(--bauhaus-black); }

.metric-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.metric-sub {
  font-size: 0.76rem;
  color: var(--text-light);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border-strong);
  padding-bottom: 6px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.section-header .sub-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Bauhaus Tables
   ========================================================================== */

.table-wrapper {
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-bauhaus);
  overflow-x: auto;
  margin-bottom: 32px;
}

.bauhaus-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.bauhaus-table th {
  background: var(--bg-alt);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--text-main);
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-strong);
  border-right: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.bauhaus-table th:last-child {
  border-right: none;
}

.bauhaus-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  font-size: 0.84rem;
  vertical-align: middle;
}

.bauhaus-table td:last-child {
  border-right: none;
}

.bauhaus-table tr:hover {
  background-color: #FDFDF8;
}

.bauhaus-table .col-mono {
  font-family: var(--font-mono);
}

.bauhaus-table .col-right {
  text-align: right;
}

.bauhaus-table .col-center {
  text-align: center;
}

/* Ticker badge */
.ticker-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.88rem;
  background: var(--bauhaus-black);
  color: #FFF;
  padding: 3px 7px;
  display: inline-block;
}

.category-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 2px 6px;
  border: 1px solid #DFDFD8;
}

/* Colored Value Utilities */
.val-gain {
  color: var(--finance-gain);
  font-weight: 700;
}

.val-loss {
  color: var(--finance-loss);
  font-weight: 700;
}

.val-neutral {
  color: var(--finance-neutral);
}

/* Visual Allocation Progress Bar */
.allocation-bar-container {
  background: var(--bg-card);
  border: 2px solid var(--border-strong);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-subtle);
}

.allocation-stacked-bar {
  display: flex;
  height: 24px;
  width: 100%;
  border: 2px solid var(--border-strong);
  margin-top: 10px;
  overflow: hidden;
  background: #EAEAEA;
}

.allocation-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #FFF;
  transition: width 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-growth { background: #0055A5; }
.seg-income { background: #008744; }
.seg-materials { background: #D9381E; }
.seg-smallcap { background: #E5A910; color: #111; }
.seg-cash { background: #555550; }

.allocation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.78rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border: 1px solid #111;
}

/* Status Badges */
.status-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  display: inline-block;
  border: 1px solid transparent;
}

.status-badge.badge-buy {
  background: #E6F4EA;
  color: #137333;
  border-color: #A8DAB5;
}

.status-badge.badge-caution {
  background: #FCE8E6;
  color: #C5221F;
  border-color: #F5C2C7;
}

.status-badge.badge-neutral {
  background: #F1F3F4;
  color: #5F6368;
  border-color: #DADCE0;
}

.score-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 3px 8px;
  background: var(--bauhaus-black);
  color: #FFF;
  display: inline-block;
}

.score-badge.high-alpha {
  background: var(--bauhaus-red);
  color: #FFF;
}

/* Callout Box */
.bauhaus-callout {
  background: var(--bg-alt);
  border-left: 4px solid var(--bauhaus-yellow);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.bauhaus-callout strong {
  color: var(--text-main);
}

/* Footer */
.bauhaus-footer {
  margin-top: 60px;
  border-top: 2px solid var(--border-strong);
  padding: 24px 32px;
  background: var(--bg-card);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bauhaus-footer a {
  color: var(--bauhaus-blue);
  text-decoration: none;
  font-weight: 600;
}

.bauhaus-footer a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .masthead-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .masthead-controls {
    width: 100%;
    justify-content: space-between;
  }
  .app-container {
    padding: 0 16px;
  }
  .tab-nav-inner {
    padding: 0 16px;
  }
}
