/* Financials Section - Clean Full-Width Layout */

/* Override section-content grid for financials section */
#sec-financials .section-content {
  display: block !important;
  background: #fff !important;
  grid-template-columns: none !important;
}

#financialsContent {
  padding: 1rem;
}

/* Header with Score */
.fin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.fin-score {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.score-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid;
}

.score-circle.elite { background: rgba(34, 197, 94, 0.12); border-color: #22c55e; color: #22c55e; }
.score-circle.strong { background: rgba(59, 130, 246, 0.12); border-color: #3b82f6; color: #3b82f6; }
.score-circle.solid { background: rgba(234, 179, 8, 0.12); border-color: #eab308; color: #eab308; }
.score-circle.weak { background: rgba(239, 68, 68, 0.12); border-color: #ef4444; color: #ef4444; }

.score-label {
  font-size: 0.65rem;
  color: #64748b;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fin-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.fin-badge {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fin-badge.elite { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.fin-badge.strong { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.fin-badge.solid { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.fin-badge.weak { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.fin-badge.neutral { background: rgba(148, 163, 184, 0.2); color: #64748b; }

.fin-period-tag {
  font-size: 0.7rem;
  color: #64748b;
  padding: 0.25rem 0.5rem;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

/* Timeframe Toggle - TradingView Style */
.fin-timeframe-toggle {
  display: flex;
  gap: 0;
  margin-left: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  background: #f8fafc;
}

.fin-tf-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fin-tf-btn:not(:last-child) {
  border-right: 1px solid #e2e8f0;
}

.fin-tf-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.fin-tf-btn.active {
  background: #6366f1;
  color: white;
}

.fin-tf-btn.active:hover {
  background: #4f46e5;
}

/* Grid Layout - Full Width */
.financials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

/* Section Cards */
.fin-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
}

.fin-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Hero Values */
.fin-hero {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.fin-hero-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}

.fin-hero-growth {
  font-size: 0.85rem;
  font-weight: 600;
}

.fin-hero-growth .positive { color: #22c55e; }
.fin-hero-growth .negative { color: #ef4444; }
.fin-hero-growth .explosive { font-weight: 700; }
.fin-hero-growth small { font-size: 0.7rem; opacity: 0.7; }

.fin-cagr {
  font-size: 0.8rem;
  color: #6366f1;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.fin-cagr small {
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 400;
}

/* Spark Row */
.fin-spark-row {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.spark-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spark-years {
  font-size: 0.65rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-weight: 500;
}

/* Standard Rows */
.fin-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  gap: 0.5rem;
}

.fin-row + .fin-row {
  border-top: 1px solid #f8fafc;
}

.fin-label {
  flex: 1;
  font-size: 0.8rem;
  color: #64748b;
}

.fin-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  min-width: 70px;
  text-align: right;
}

.fin-value.positive { color: #22c55e; }
.fin-value.negative { color: #ef4444; }

/* Margin Stack */
.margin-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.margin-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.margin-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.margin-header span:first-child {
  color: #64748b;
}

.margin-pct {
  font-weight: 600;
  color: #1e293b;
}

.margin-pct.high {
  color: #22c55e;
}

.margin-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}

.margin-bar.full {
  height: 8px;
}

.margin-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.margin-fill.high {
  background: linear-gradient(90deg, #22c55e, #10b981);
}

.margin-fill.op {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.margin-fill.net {
  background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.margin-insight {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
}

/* Capital Structure Bar */
.capital-bar {
  display: flex;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.cap-equity {
  background: linear-gradient(135deg, #22c55e, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.cap-debt {
  background: linear-gradient(135deg, #ef4444, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.cap-equity span, .cap-debt span {
  font-size: 0.6rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
}

/* Ratio Grid */
.ratio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.ratio-card {
  padding: 0.6rem;
  border-radius: 6px;
  text-align: center;
  border: 1px solid #e2e8f0;
}

.ratio-card.good {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.2);
}

.ratio-card.ok {
  background: rgba(234, 179, 8, 0.06);
  border-color: rgba(234, 179, 8, 0.2);
}

.ratio-card.bad {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}

.ratio-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.ratio-card.good .ratio-value { color: #22c55e; }
.ratio-card.ok .ratio-value { color: #eab308; }
.ratio-card.bad .ratio-value { color: #ef4444; }

.ratio-label {
  font-size: 0.6rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 0.15rem;
}

.ratio-hint {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* Cash Section */
.cash-hero {
  text-align: center;
  padding: 0.6rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(16, 185, 129, 0.04));
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.cash-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #22c55e;
}

.cash-label {
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.cash-runway {
  position: relative;
  height: 20px;
  background: #f1f5f9;
  border-radius: 4px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.runway-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #10b981);
  border-radius: 4px;
}

.runway-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: #1e293b;
}

.cash-insight {
  font-size: 0.8rem;
  text-align: center;
  padding-top: 0.5rem;
}

.cash-insight strong {
  font-weight: 700;
}

.cash-insight .positive { color: #22c55e; }
.cash-insight .negative { color: #ef4444; }

/* Mini Charts */
.mini-chart {
  flex-shrink: 0;
}

/* Loading & Error States */
.financials-loading {
  padding: 2rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

.financials-loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: fin-spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes fin-spin {
  to { transform: rotate(360deg); }
}

.financials-error {
  padding: 1.5rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .financials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
  #financialsContent {
    padding: 0.75rem;
  }

  .fin-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
  }

  .fin-badges {
    order: 2;
    flex-basis: 100%;
    gap: 0.4rem;
  }

  .fin-period-tag {
    margin-left: 0;
  }

  .fin-timeframe-toggle {
    margin-left: 0;
    flex-basis: auto;
  }

  .fin-tf-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.65rem;
  }

  .financials-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .fin-section {
    padding: 0.75rem;
  }

  .fin-hero-value {
    font-size: 1.3rem;
  }

  .ratio-grid {
    gap: 0.4rem;
  }

  .ratio-card {
    padding: 0.5rem;
  }

  .ratio-value {
    font-size: 1rem;
  }
}
