/**
 * Firm.CompanyName 3.0 — Strategies page styles.
 *
 * Scoped under `.fe30-strategies-dash`. Reuses IAMS tokens from
 * `tokens-base.css`, the shell primitives from `3.0-shell.css`, and the
 * shared `.fe30-kpi` / `.fe30-toolbar` / `.fe30-table-host` from
 * `fe30-components.css`.
 *
 * Layout (top → bottom):
 *   .fe30-strategies-page-header   page title + subtitle
 *   .fe30-strategies-kpis          KPI strip (4 tiles)
 *   .fe30-strategies-toolbar       search + filter + overflow
 *   .fe30-strategies-card          DataTables grid
 *   .fe30-strategies-drawer        right-side detail drawer
 *   .fe30-strategies-toast         status messages
 */

/* ============================================================
   PAGE CHROME
   ============================================================ */

.fe30-strategies-dash {
  max-width: 1440px;
  margin: 0 auto;
}

.fe30-strategies-page-header {
  align-items: flex-end;
}

.fe30-strategies-page-meta {
  margin-top: 6px;
}

/* ============================================================
   TABLE CARD
   ============================================================ */

.fe30-strategies-card {
  margin-top: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  background: var(--bg-white);
  box-shadow: none;
  overflow: hidden;
}

.fe30-strategies-card-body {
  padding: 0;
  overflow-x: auto;
}

/* ============================================================
   DATATABLE OVERRIDES — row style, header, borders
   ============================================================ */

.fe30-strategies-dt.dataTable {
  border-collapse: collapse;
  width: 100% !important;
}

.fe30-strategies-dt.dataTable thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 16px;
  white-space: nowrap;
}

.fe30-strategies-dt.dataTable tbody td {
  border-bottom: 1px solid var(--hairline);
  font-size: var(--text-sm);
  padding: 14px 16px;
  vertical-align: middle;
}

.fe30-strategies-dt.dataTable tbody tr {
  transition: background var(--duration-fast) var(--ease-standard);
}

.fe30-strategies-dt.dataTable tbody tr:hover {
  background: rgba(0, 0, 0, 0.03) !important;
}

.fe30-strategies-dt.dataTable tbody tr:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 0 var(--brand-orange);
  background: var(--brand-orange-light) !important;
}

/* Paging controls */
.fe30-strategies-card .dataTables_wrapper .dataTables_info {
  font-size: var(--text-sm);
  color: var(--gray-500);
  padding: 12px 16px;
}

.fe30-strategies-card .dataTables_wrapper .dataTables_paginate {
  padding: 12px 16px;
}

.fe30-strategies-card .dataTables_wrapper .dataTables_paginate .paginate_button {
  font-size: var(--text-sm);
  color: var(--gray-600) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin: 0 2px;
  background: transparent !important;
}

.fe30-strategies-card .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  color: var(--brand-orange) !important;
  border-color: var(--brand-orange) !important;
  background: var(--brand-orange-light) !important;
  font-weight: 600;
}

.fe30-strategies-card .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--bg-gray-50) !important;
  color: var(--dark-navy) !important;
  border-color: var(--gray-400) !important;
}

/* Remove default DataTables stripe */
.fe30-strategies-dt.dataTable.stripe tbody tr.odd,
.fe30-strategies-dt.dataTable.display tbody tr.odd {
  background-color: transparent !important;
}

.fe30-strategies-dt.dataTable.stripe tbody tr.even,
.fe30-strategies-dt.dataTable.display tbody tr.even {
  background-color: transparent !important;
}

/* ============================================================
   CELL RENDERERS — strategy name (title + description)
   ============================================================ */

.fe30-strategies-cell-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
}

.fe30-strategies-cell-title {
  font-weight: 600;
  color: var(--dark-navy);
}

.fe30-strategies-cell-desc {
  font-size: var(--text-xs);
  color: var(--gray-500);
  white-space: normal;
  max-width: 320px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   OUTLOOK SLIDER — gradient bar with positioned dot
   ============================================================ */

.fe30-strategies-outlook {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 100px;
}

.fe30-strategies-outlook-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--error) 0%, var(--warning) 50%, var(--success) 100%);
  position: relative;
}

.fe30-strategies-outlook-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-white);
  box-shadow: var(--shadow-sm);
  position: relative;
  top: -11px;
  margin-bottom: -12px;
  transition: left var(--duration-base) var(--ease-standard);
}

.fe30-strategies-outlook-dot.is-bullish {
  background: var(--success);
}

.fe30-strategies-outlook-dot.is-bearish {
  background: var(--error);
}

.fe30-strategies-outlook-dot.is-neutral {
  background: var(--warning);
}

.fe30-strategies-outlook-label {
  font-size: var(--text-xs);
  color: var(--gray-600);
  font-weight: 500;
}

/* ============================================================
   FACTOR CHIPS — small pill with text label
   ============================================================ */

.fe30-strategies-factor {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--gray-700);
  background: var(--bg-gray-100);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  line-height: 1.5;
}

.fe30-text-muted {
  color: var(--gray-400);
}

/* ============================================================
   FILTER POPOVER (checkbox-based, anchored below toolbar)
   ============================================================ */

.fe30-filter-popover {
  position: absolute;
  z-index: 100;
  min-width: 280px;
  max-width: min(420px, calc(100vw - 24px));
  max-height: min(400px, 70vh);
  overflow: auto;
  padding: var(--space-4);
  background: var(--bg-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.fe30-filter-popover[hidden] {
  display: none !important;
}

.fe30-filter-popover-section {
  margin-bottom: var(--space-4);
}

.fe30-filter-popover-section:last-of-type {
  margin-bottom: var(--space-3);
}

.fe30-filter-popover-heading {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.fe30-filter-popover-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.fe30-filter-popover-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: var(--text-sm);
  color: var(--ink-primary);
  cursor: pointer;
}

.fe30-filter-popover-label input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--brand-orange);
}

.fe30-filter-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--hairline);
}

/* Removable chip (active filter indicator) */
.fe30-chip-removable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--brand-orange-dark);
  background: var(--brand-orange-light);
  border: 1px solid rgba(251, 106, 24, 0.2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.fe30-chip-removable:hover {
  background: rgba(251, 106, 24, 0.15);
  border-color: var(--brand-orange);
}

.fe30-chip-removable::after {
  content: "×";
  font-size: 14px;
  line-height: 1;
}

/* ============================================================
   DETAIL DRAWER — right-side slide-in (mirrors factsheets)
   ============================================================ */

.fe30-strategies-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-pane, 300ms) var(--ease-spring, ease);
  z-index: 200;
}

.fe30-strategies-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.fe30-strategies-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--duration-pane, 300ms) var(--ease-spring, ease);
  z-index: 210;
  overflow: hidden;
}

.fe30-strategies-drawer.is-open {
  transform: translateX(0);
}

.fe30-strategies-drawer-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.fe30-strategies-drawer-titlewrap {
  flex: 1 1 auto;
  min-width: 0;
}

.fe30-strategies-drawer-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--dark-navy);
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fe30-strategies-drawer-meta {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  color: var(--gray-500);
}

.fe30-strategies-drawer-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--bg-white);
  color: var(--gray-600);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.fe30-strategies-drawer-close:hover {
  border-color: var(--gray-400);
  color: var(--dark-navy);
}

.fe30-strategies-drawer-close:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-orange);
}

/* Drawer body — scrollable content area */
.fe30-strategies-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-5);
}

.fe30-strategies-drawer-section {
  margin-bottom: var(--space-6);
}

.fe30-strategies-drawer-section:last-child {
  margin-bottom: 0;
}

.fe30-strategies-drawer-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--dark-navy);
  text-transform: uppercase;
}

.fe30-strategies-drawer-text {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--gray-700);
}

.fe30-strategies-drawer-text--em {
  font-style: italic;
  color: var(--gray-600);
}

/* Definition list in details section */
.fe30-strategies-drawer-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-4);
  font-size: var(--text-sm);
}

.fe30-strategies-drawer-dl dt {
  font-weight: 600;
  color: var(--gray-600);
}

.fe30-strategies-drawer-dl dd {
  margin: 0;
  color: var(--ink-primary);
}

/* Change summary table */
.fe30-strategies-drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.fe30-strategies-drawer-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 6px 8px;
  border-bottom: 1px solid var(--hairline);
}

.fe30-strategies-drawer-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-primary);
}

/* Drawer footer actions */
.fe30-strategies-drawer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--hairline);
  background: var(--bg-white);
  flex-shrink: 0;
}

.fe30-strategies-drawer-actions > [hidden] {
  display: none !important;
}

/* ============================================================
   SVG ALLOCATION CHART
   ============================================================ */

.fe30-strategies-drawer-chart-wrap {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
}

.fe30-strategies-drawer-chart {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.fe30-strategies-drawer-chart-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-width: 0;
}

.fe30-strategies-drawer-chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.fe30-strategies-drawer-chart-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.fe30-strategies-drawer-chart-legend-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-primary);
}

.fe30-strategies-drawer-chart-legend-pct {
  flex-shrink: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--gray-600);
}

/* ============================================================
   TOAST — bottom-center status messages
   ============================================================ */

.fe30-strategies-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--dark-navy);
  color: var(--bg-white);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  pointer-events: none;
}

.fe30-strategies-toast[hidden] {
  display: none;
}

/* ============================================================
   RECENTLY TRADED BADGE
   ============================================================ */

.fe30-strategies-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 0.675rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  border-radius: var(--radius-full, 9999px);
  vertical-align: middle;
  white-space: nowrap;
}

.fe30-strategies-badge--recent {
  background: var(--green-50, #ecfdf5);
  color: var(--green-700, #15803d);
  border: 1px solid var(--green-200, #bbf7d0);
}

/* ============================================================
   TRADE NOTES CELL
   ============================================================ */

.fe30-strategies-cell-notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 220px;
  overflow: hidden;
}

.fe30-strategies-cell-notes-reason {
  font-size: var(--text-xs, 0.75rem);
  color: var(--gray-500, #6b7280);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fe30-strategies-cell-notes-body {
  font-size: var(--text-sm, 0.8125rem);
  color: var(--gray-700, #374151);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .fe30-strategies-drawer {
    width: 100vw;
  }

  .fe30-strategies-drawer-chart-wrap {
    flex-direction: column;
    align-items: center;
  }

  .fe30-strategies-drawer-chart {
    width: 140px;
    height: 140px;
  }
}
