/*
 * Finexus Research Article Styles v2.0
 * A sophisticated, wide-format design for data-rich financial research
 *
 * Key improvements:
 * 1. Wider layout (max-w-6xl) for charts and tables
 * 2. Multi-dimensional table styles with conditional formatting
 * 3. Multi-series chart configurations
 * 4. Distinct typography for main content vs appendix
 * 5. Professional financial publication aesthetics
 */

/* ==========================================================================
   LAYOUT & STRUCTURE
   ========================================================================== */

/* Main article container - wider for data visualization */
.article-container {
  max-width: 1152px; /* 72rem / max-w-6xl equivalent */
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* Full-width sections for charts and large tables */
.full-width {
  max-width: 1280px; /* max-w-7xl */
  margin-left: auto;
  margin-right: auto;
}

/* Prose container - readable width for text */
.prose-content {
  max-width: 85ch;
  margin: 0 auto;
}

/* Wide prose for mixed content sections */
.prose-wide {
  max-width: 85ch;
}

/* ==========================================================================
   TYPOGRAPHY - MAIN CONTENT
   ========================================================================== */

.prose h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #3b82f6;
  letter-spacing: -0.015em;
}

.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.prose h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #4b5563;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.prose p {
  font-size: 1.0625rem; /* 17px - slightly larger for readability */
  line-height: 1.75;
  color: #374151;
  margin-bottom: 1rem;
}

.prose p.lead {
  font-size: 1.25rem;
  line-height: 1.7;
  color: #4b5563;
}

.prose ul, .prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose li {
  font-size: 1rem;
  line-height: 1.6;
  color: #4b5563;
  margin-bottom: 0.375rem;
}

/* ==========================================================================
   TYPOGRAPHY - APPENDIX & FOOTER
   ========================================================================== */

.appendix {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.appendix h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.appendix h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
}

.appendix p {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #6b7280;
}

.appendix li {
  font-size: 0.9375rem;
  color: #6b7280;
}

.footer-meta {
  font-size: 0.8125rem;
  color: #9ca3af;
  line-height: 1.6;
}

/* ==========================================================================
   CHARTS - MULTI-SERIES CONFIGURATIONS
   ========================================================================== */

/* Chart containers with responsive heights */
.chart-hero {
  position: relative;
  height: 450px;
  margin: 1rem 0;
  padding: 0.75rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-primary {
  position: relative;
  height: 380px;
  margin: 1rem 0;
}

.chart-secondary {
  position: relative;
  height: 280px;
  margin: 1rem 0;
}

.chart-compact {
  position: relative;
  height: 250px;
  margin: 1rem 0;
}

/* Chart grid for side-by-side comparisons */
.chart-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.chart-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .chart-grid-2, .chart-grid-3 {
    grid-template-columns: 1fr;
  }
  .chart-hero { height: 350px; }
  .chart-primary { height: 320px; }
}

/* Chart titles and annotations */
.chart-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.chart-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.chart-source {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.5rem;
  text-align: right;
}

/* ==========================================================================
   TABLES - MULTI-DIMENSIONAL DATA
   ========================================================================== */

/* Base table styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table thead {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.data-table th {
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.data-table th.text-center,
.data-table td.text-center {
  text-align: center;
}

.data-table th.text-right,
.data-table td.text-right {
  text-align: right;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #4b5563;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Multi-level headers for complex tables */
.data-table th.group-header {
  background: #1e40af;
  color: white;
  text-align: center;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.625rem;
}

.data-table th.sub-header {
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Row styling variations */
.data-table tr.highlight-row {
  background: #fffbeb;
}

.data-table tr.current-row {
  background: #dbeafe;
  font-weight: 600;
}

.data-table tr.separator-row td {
  background: #f1f5f9;
  padding: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Conditional formatting for values */
.val-positive {
  color: #059669;
  font-weight: 600;
}

.val-negative {
  color: #dc2626;
  font-weight: 600;
}

.val-neutral {
  color: #6b7280;
}

.val-strong-positive {
  color: #047857;
  font-weight: 700;
  background: #d1fae5;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.val-strong-negative {
  color: #b91c1c;
  font-weight: 700;
  background: #fee2e2;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* Heatmap-style cells */
.heat-1 { background: #dcfce7; } /* Light green */
.heat-2 { background: #bbf7d0; }
.heat-3 { background: #86efac; }
.heat-4 { background: #4ade80; } /* Strong green */
.heat-5 { background: #22c55e; color: white; }
.heat-n1 { background: #fef2f2; } /* Light red */
.heat-n2 { background: #fecaca; }
.heat-n3 { background: #fca5a5; }
.heat-n4 { background: #f87171; } /* Strong red */
.heat-n5 { background: #ef4444; color: white; }

/* Row category indicators */
.row-indicator {
  width: 4px;
  padding: 0 !important;
}
.row-indicator.positive { background: #10b981; }
.row-indicator.negative { background: #ef4444; }
.row-indicator.neutral { background: #6b7280; }
.row-indicator.highlight { background: #3b82f6; }

/* Sticky first column for wide tables */
.data-table.sticky-first th:first-child,
.data-table.sticky-first td:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

/* Compact table variant */
.data-table.compact th,
.data-table.compact td {
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
}

/* Large/detailed table variant */
.data-table.detailed th,
.data-table.detailed td {
  padding: 1rem 1.25rem;
  font-size: 1rem;
}

/* Table wrapper for horizontal scroll */
.table-scroll-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ==========================================================================
   METRIC CARDS & DASHBOARDS
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: center;
  transition: box-shadow 0.2s;
}

.metric-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.metric-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}

.metric-card .value.positive { color: #059669; }
.metric-card .value.negative { color: #dc2626; }
.metric-card .value.blue { color: #2563eb; }

.metric-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.375rem;
}

.metric-card .context {
  font-size: 0.8125rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* Larger hero metric */
.metric-hero {
  padding: 2rem;
}

.metric-hero .value {
  font-size: 3rem;
}

/* ==========================================================================
   CALLOUT BOXES
   ========================================================================== */

.callout {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.5rem;
}

.callout h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
}

.callout p:last-child,
.callout ul:last-child {
  margin-bottom: 0;
}

.callout-info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
.callout-info h4 { color: #1d4ed8; }

.callout-success {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}
.callout-success h4 { color: #047857; }

.callout-warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.callout-warning h4 { color: #b45309; }

.callout-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}
.callout-danger h4 { color: #b91c1c; }

/* Trade idea box - prominent */
.trade-box {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 2px solid #10b981;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin: 1rem 0;
}

.trade-box h3 {
  color: #047857;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
}

/* Quote/pullquote */
.pullquote {
  font-size: 1.25rem;
  font-weight: 500;
  color: #1e40af;
  line-height: 1.5;
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #3b82f6;
  background: linear-gradient(90deg, #eff6ff 0%, transparent 100%);
}

.blockquote {
  background: #f8fafc;
  border-left: 4px solid #64748b;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #475569;
}

.blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.75rem;
}

/* ==========================================================================
   TICKER BADGES
   ========================================================================== */

.ticker-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.15s;
}

.ticker-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ticker-badge.blue { background: #dbeafe; color: #1d4ed8; }
.ticker-badge.blue:hover { background: #bfdbfe; }

.ticker-badge.green { background: #d1fae5; color: #047857; }
.ticker-badge.green:hover { background: #a7f3d0; }

.ticker-badge.amber { background: #fef3c7; color: #b45309; }
.ticker-badge.amber:hover { background: #fde68a; }

.ticker-badge.purple { background: #ede9fe; color: #6d28d9; }
.ticker-badge.purple:hover { background: #ddd6fe; }

.ticker-badge.red { background: #fee2e2; color: #b91c1c; }
.ticker-badge.red:hover { background: #fecaca; }

.ticker-badge.teal { background: #ccfbf1; color: #0f766e; }
.ticker-badge.teal:hover { background: #99f6e4; }

.ticker-badge.yellow { background: #fef9c3; color: #a16207; }
.ticker-badge.yellow:hover { background: #fef08a; }

.ticker-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* ==========================================================================
   EXPLORE/RELATED SECTIONS
   ========================================================================== */

.explore-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (max-width: 640px) {
  .explore-grid {
    grid-template-columns: 1fr;
  }
}

.explore-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.explore-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.explore-card h4 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.explore-card p {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1rem 0;
}

.explore-card a {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.explore-card a:hover {
  text-decoration: underline;
}

/* Related articles - card style */
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.related-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.related-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.related-card h5 {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.related-card p {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.text-positive { color: #059669; }
.text-negative { color: #dc2626; }
.text-muted { color: #6b7280; }
.text-small { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.font-mono { font-family: ui-monospace, monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }

.border-t { border-top: 1px solid #e5e7eb; }
.border-b { border-bottom: 1px solid #e5e7eb; }

/* Responsive helpers */
@media (max-width: 640px) {
  .hide-sm { display: none; }
}
