/* ==============================================================================
   Quant PWA: Institutional Options Flow Aggregate Styling
   Theme: High-Density Dark Bloomberg / Cyberpunk Aesthetic
   ============================================================================== */

.flow-view-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Header & Controls Bar */
.flow-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.flow-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.flow-badge-icon {
  font-size: 1.3rem;
}

.flow-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
}

.flow-session-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  background: rgba(0, 230, 153, 0.1);
  border: 1px solid rgba(0, 230, 153, 0.3);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #00e699;
}

.flow-controls-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Flow Session Stepper & Date Select */
.flow-session-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.flow-step-btn {
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  transition: all 0.15s ease;
  user-select: none;
}

.flow-step-btn:hover:not(:disabled) {
  background: #334155;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.25);
}

.flow-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.flow-date-select {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  min-height: 32px;
  box-sizing: border-box;
}

.flow-date-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

/* Duration Toggle Chips */
.flow-duration-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.flow-duration-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flow-duration-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.flow-duration-btn.active {
  background: rgba(0, 176, 255, 0.2);
  color: #00b0ff;
  border: 1px solid rgba(0, 176, 255, 0.4);
  box-shadow: 0 0 8px rgba(0, 176, 255, 0.2);
}

.flow-refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #c9d1d9;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.flow-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: rotate(45deg);
}

/* Flow Hero Panel: Synergized Flow Synthesis */
.flow-panel-hero {
  background: var(--bg-card, #121826);
  border: 1px solid var(--border-subtle, #1a2234);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.flow-hero-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-hero-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #e6edf3);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-hero-session-date {
  font-size: 11px;
  font-weight: 600;
  color: #00e699;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: rgba(0, 230, 153, 0.1);
  border-radius: 4px;
}

/* Info Summary Ribbon */
.flow-info-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid #00b0ff;
  border-radius: 0 6px 6px 0;
  font-size: 0.78rem;
  color: #8b949e;
}

.flow-info-dates {
  color: #c9d1d9;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
}

/* 3-Section Grid Layout */
.flow-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  .flow-sections-grid {
    grid-template-columns: 1fr;
  }
}

/* Individual Section Card */
.flow-card {
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.flow-card.card-premium {
  border-top: 3px solid #ffd700;
}

.flow-card.card-bullish {
  border-top: 3px solid #00e676;
}

.flow-card.card-bearish {
  border-top: 3px solid #ff5252;
}

.flow-card.card-bearish-premium {
  border-top: 3px solid #ff1744;
}

.flow-card-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.flow-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flow-card-icon {
  font-size: 1.1rem;
}

.flow-card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f0f6fc;
  text-transform: uppercase;
}

.flow-card-subtitle {
  font-size: 0.72rem;
  color: #8b949e;
  padding: 0.4rem 1rem 0.2rem 1rem;
}

.flow-card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.badge-gold {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge-green {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-red {
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.badge-blood {
  background: rgba(255, 23, 68, 0.15);
  color: #ff1744;
  border: 1px solid rgba(255, 23, 68, 0.35);
}

/* Leaderboard Tables */
.flow-table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.flow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.flow-table th {
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  color: #8b949e;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.flow-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #c9d1d9;
  white-space: nowrap;
}

.flow-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.flow-table tbody tr:hover {
  background: rgba(0, 176, 255, 0.08);
}

.flow-rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: #8b949e;
}

.flow-rank-1 {
  background: rgba(255, 215, 0, 0.2);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.flow-rank-2 {
  background: rgba(192, 192, 192, 0.2);
  color: #e0e0e0;
  border: 1px solid rgba(192, 192, 192, 0.4);
}

.flow-rank-3 {
  background: rgba(205, 127, 50, 0.2);
  color: #cd7f32;
  border: 1px solid rgba(205, 127, 50, 0.4);
}

.flow-ticker-btn {
  display: inline-block;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(88, 166, 255, 0.25);
  transition: all 0.15s ease;
}

.flow-ticker-btn:hover {
  background: rgba(88, 166, 255, 0.25);
  color: #fff;
  border-color: #58a6ff;
  box-shadow: 0 0 6px rgba(88, 166, 255, 0.3);
}

.flow-metric-primary {
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.metric-gold {
  color: #ffd700;
}

.metric-green {
  color: #00e676;
}

.metric-red {
  color: #ff5252;
}

.metric-blood {
  color: #ff1744;
}

.flow-metric-secondary {
  color: #8b949e;
  font-size: 0.75rem;
}

.flow-days-pill {
  display: inline-block;
  font-size: 0.7rem;
  color: #8b949e;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.flow-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #8b949e;
  font-style: italic;
}

.flow-empty-state.error {
  color: #ff5252;
}

/* ==============================================================================
   Thematic Semantic Flow Clusters UI (10-K Vector Rotations)
   ============================================================================== */

/* Mode Switcher Toggle */
.flow-mode-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.flow-mode-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flow-mode-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.flow-mode-btn.active {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.2);
}

/* Clusters Container & Controls */
.flow-clusters-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.clusters-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(16, 20, 26, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.clusters-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.clusters-title-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  letter-spacing: 0.05em;
}

.clusters-subtitle {
  font-size: 0.8rem;
  color: #8b949e;
}

.clusters-hurdle-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clusters-hurdle-label {
  font-size: 0.75rem;
  color: #8b949e;
  font-weight: 600;
}

.clusters-hurdle-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.clusters-hurdle-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.clusters-hurdle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.clusters-hurdle-btn.active {
  background: rgba(0, 230, 153, 0.2);
  color: #00e699;
  border: 1px solid rgba(0, 230, 153, 0.4);
}

/* Cluster Cards Grid */
.clusters-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Individual Cluster Card */
.cluster-card {
  background: rgba(18, 22, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cluster-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.cluster-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(24, 29, 38, 0.6);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease;
}

.cluster-card.collapsed .cluster-card-header {
  border-bottom: none;
}

.cluster-card-header:hover {
  background: rgba(30, 36, 48, 0.8);
}

.cluster-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cluster-title-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cluster-theme-icon {
  font-size: 1.1rem;
}

.cluster-theme-title {
  font-size: 1rem;
  font-weight: 700;
  color: #e6edf3;
  margin: 0;
}

.cluster-sector-pill {
  font-size: 0.7rem;
  font-weight: 600;
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
  border: 1px solid rgba(88, 166, 255, 0.25);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}

.cluster-meta-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: #8b949e;
}

.cluster-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.cluster-meta-separator {
  color: #484f58;
}

.cluster-premium-val {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: #ffd700;
  font-weight: 700;
}

.cluster-similarity-val {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: #a78bfa;
  font-weight: 700;
}

.cluster-count-val {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: #e6edf3;
  font-weight: 700;
}

.cluster-meta-label {
  font-size: 0.7rem;
  color: #8b949e;
  text-transform: uppercase;
}

.cluster-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cluster-sentiment-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.cluster-sentiment-badge.badge-bullish {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.35);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.15);
}

.cluster-sentiment-badge.badge-bearish {
  background: rgba(255, 23, 68, 0.15);
  color: #ff1744;
  border: 1px solid rgba(255, 23, 68, 0.35);
  box-shadow: 0 0 8px rgba(255, 23, 68, 0.15);
}

.cluster-expand-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8b949e;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cluster-expand-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.cluster-chevron {
  font-size: 0.7rem;
}

/* Cluster Body & Flow Split Bar */
.cluster-card-body {
  padding: 1rem 1.25rem;
}

.cluster-breakdown-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.85rem;
  background: rgba(10, 14, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.cluster-bar-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #8b949e;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.cluster-bar-track {
  display: flex;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.cluster-bar-fill-call {
  background: #00e676;
  height: 100%;
  transition: width 0.3s ease;
}

.cluster-bar-fill-put {
  background: #ff1744;
  height: 100%;
  transition: width 0.3s ease;
}

.cluster-bar-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.stat-calls {
  color: #00e676;
}

.stat-puts {
  color: #ff1744;
}

/* Tickers Table Inside Cluster */
.cluster-tickers-table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.cluster-tickers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.cluster-tickers-table th {
  background: rgba(20, 24, 32, 0.7);
  padding: 0.6rem 0.8rem;
  color: #8b949e;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cluster-tickers-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.cluster-ticker-row:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.cluster-company-cell {
  color: #c9d1d9;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-sentiment-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.flow-sentiment-tag.tag-bullish {
  background: rgba(0, 230, 118, 0.12);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.25);
}

.flow-sentiment-tag.tag-bearish {
  background: rgba(255, 23, 68, 0.12);
  color: #ff1744;
  border: 1px solid rgba(255, 23, 68, 0.25);
}

.cluster-inspect-btn {
  background: rgba(88, 166, 255, 0.1);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cluster-inspect-btn:hover {
  background: rgba(88, 166, 255, 0.25);
  color: #fff;
  border-color: #58a6ff;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .clusters-controls-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .cluster-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .cluster-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .cluster-company-cell {
    max-width: 130px;
  }
}

@media (max-width: 480px) {
  .clusters-hurdle-group {
    flex-wrap: wrap;
  }

  .cluster-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
}

