/* ========================================================================
   Stockpro - Fundamental Analysis (FA) Stylesheet
   Thiết kế chuẩn mực theo phong cách Bloomberg / TradingView Dark Terminal
   ======================================================================== */

:root {
  --fa-bg: #0b0f19;
  --fa-card-bg: #0f1422;
  --fa-border: rgba(255, 255, 255, 0.08);
  --fa-text: #f8fafc;
  --fa-muted: #94a3b8;
  --fa-accent: #3b82f6;
  --fa-emerald: #10b981;
  --fa-amber: #f59e0b;
  --fa-rose: #f43f5e;
}

#financial-section {
  color: var(--fa-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

#financial-section * {
  box-sizing: border-box;
}

/* 1. Header Buttons & Controls */
.fa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fa-btn:hover {
  background: #334155;
  color: #ffffff;
}

.fa-pill-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fa-pill-btn:hover {
  color: #f1f5f9;
}

.fa-pill-btn.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fa-subnav-btn {
  background: #0f172a;
  color: #94a3b8;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fa-subnav-btn:hover {
  color: #f1f5f9;
  background: #1e293b;
}

.fa-subnav-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.4);
}

.fa-bctc-tab {
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fa-bctc-tab:hover {
  color: #f1f5f9;
}

.fa-bctc-tab.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fa-scroll-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.fa-scroll-btn:hover {
  background: #334155;
  color: #ffffff;
}

/* 2. Left Sidebar Metric Cards */
.fin-kpi-card {
  background: #0d121f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.fin-kpi-label {
  font-size: 9.5px;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

.fin-kpi-val {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  line-height: 1.2;
}

/* 3. 12 Financial Charts Grid Cards */
.fin-chart-card {
  background: #0f1422;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 0.2s ease;
}

.fin-chart-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.fin-chart-card .chart-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f1f5f9;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-chart-card .chart-body {
  width: 100%;
  height: 230px;
  position: relative;
}

/* 4. Tables: Percentile Table & BCTC Summary */
#fin-valuation-table th,
#fin-valuation-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#fin-valuation-table th {
  color: #94a3b8;
  font-weight: 600;
}

#fin-table th,
#fin-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#fin-table thead th {
  background: #0d1527;
  color: #94a3b8;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}

#fin-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.yoy-badge {
  display: block;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  margin-top: 2px;
}

.yoy-up {
  color: #10b981;
}

.yoy-down {
  color: #ef4444;
}

/* 5. Responsive */
@media (max-width: 1200px) {
  #fin-charts {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  #fin-core-layout {
    grid-template-columns: 1fr !important;
  }
  #fin-kpis {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
  }
  #fin-charts {
    grid-template-columns: 1fr !important;
  }
}
