/**
 * Scenario Card Styles
 *
 * Shared styles for scenario result cards used in:
 * - index.html (main app) - 5-scenario comparison
 * - share.html (public share page) - single scenario display
 *
 * Design System: Apple-inspired with glassmorphism effects
 */

/* ============================================
   CSS VARIABLES (can be overridden)
   ============================================ */
:root {
  --sc-bg-card: rgba(17, 24, 39, 0.82);
  --sc-border: rgba(96, 165, 250, 0.18);
  --sc-border-hover: rgba(96, 165, 250, 0.35);
  --sc-border-best: rgba(34, 197, 94, 0.55);
  --sc-bg-best: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(15, 118, 110, 0.25));
  --sc-text-high: #f8fafc;
  --sc-text-medium: #cbd5e1;
  --sc-text-muted: #94a3b8;
  --sc-accent-primary: #3b82f6;
  --sc-success: #22c55e;
  --sc-error: #ef4444;
  --sc-radius: 16px;
  --sc-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
}

/* Light mode overrides for share.html */
.light-theme {
  --sc-bg-card: #ffffff;
  --sc-border: #e2e8f0;
  --sc-border-hover: #cbd5e1;
  --sc-border-best: rgba(34, 197, 94, 0.7);
  --sc-bg-best: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.15));
  --sc-text-high: #1e293b;
  --sc-text-medium: #475569;
  --sc-text-muted: #64748b;
  --sc-accent-primary: #2563eb;
  --sc-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ============================================
   SCENARIO CARD CONTAINER
   ============================================ */
.scenario-breakdown-card {
  background: var(--sc-bg-card);
  border: 2px solid var(--sc-border);
  border-radius: var(--sc-radius);
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: var(--sc-shadow);
}

.scenario-breakdown-card:hover {
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.45);
  transform: translateY(-2px);
  border-color: var(--sc-border-hover);
}

.scenario-breakdown-card.best {
  border-color: var(--sc-border-best);
  background: var(--sc-bg-best);
}

/* ============================================
   CARD HEADER
   ============================================ */
.scenario-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.scenario-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--sc-text-high);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.scenario-card-badge {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(16, 185, 129, 0.95));
  color: var(--sc-text-high);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.scenario-card-badge-container {
  min-width: 70px;
  text-align: right;
}

/* ============================================
   MONTHLY / ANNUAL COST DISPLAY
   ============================================ */
.scenario-card-monthly {
  font-size: 36px;
  font-weight: 700;
  color: var(--sc-text-high);
  margin-bottom: 4px;
  line-height: 1.2;
}

.scenario-breakdown-card.best .scenario-card-monthly {
  color: var(--sc-success);
}

.scenario-card-annual {
  font-size: 14px;
  color: var(--sc-text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

/* ============================================
   HORIZONTAL STACKED BAR CHART
   ============================================ */
.scenario-stacked-bar {
  width: 100%;
  height: 40px;
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.4);
}

.bar-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sc-text-high);
  font-size: 12px;
  font-weight: 600;
  transition: filter 0.2s ease;
  position: relative;
}

.bar-segment:hover {
  filter: brightness(1.05);
  cursor: pointer;
}

.bar-segment.loyer {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.9), rgba(59, 130, 246, 0.95));
}

.bar-segment.assurance {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.9), rgba(20, 184, 166, 0.95));
}

.bar-segment.fiscal {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.9), rgba(245, 158, 11, 0.95));
}

.bar-segment.aen {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.9), rgba(139, 92, 246, 0.95));
}

.bar-segment.tvs {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.9), rgba(239, 68, 68, 0.95));
}

/* ============================================
   BREAKDOWN DETAILS LIST
   ============================================ */
.scenario-breakdown-details {
  font-size: 13px;
  line-height: 1.8;
  margin-top: 16px;
}

.breakdown-group {
  margin-bottom: 12px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--sc-text-medium);
}

.breakdown-item.main {
  font-weight: 600;
  color: var(--sc-text-high);
  margin-top: 8px;
}

.breakdown-item.sub {
  padding-left: 20px;
  font-size: 12px;
  color: var(--sc-text-muted);
}

.breakdown-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breakdown-icon {
  font-size: 14px;
}

.breakdown-value {
  font-weight: 600;
  color: var(--sc-text-high);
}

/* ============================================
   VERIFICATION FORMULAS SECTION
   ============================================ */
:root {
  --sc-verification-bg: rgba(15, 23, 42, 0.6);
  --sc-verification-border: rgba(59, 130, 246, 0.15);
  --sc-verification-divider: rgba(71, 85, 105, 0.45);
  --sc-verification-label: rgba(203, 213, 225, 0.85);
  --sc-verification-highlight: rgba(59, 130, 246, 0.05);
  --sc-verification-highlight-green: rgba(16, 185, 129, 0.1);
  --sc-verification-highlight-purple: rgba(139, 92, 246, 0.05);
  --sc-verification-highlight-yellow: rgba(245, 158, 11, 0.05);
  --sc-verification-highlight-orange: rgba(251, 146, 60, 0.1);
}

/* Light theme for share page */
.light-theme,
body:not(.dark-mode) .scenario-single {
  --sc-verification-bg: rgba(241, 245, 249, 0.95);
  --sc-verification-border: rgba(59, 130, 246, 0.2);
  --sc-verification-divider: rgba(148, 163, 184, 0.4);
  --sc-verification-label: #64748b;
  --sc-verification-highlight: rgba(59, 130, 246, 0.08);
  --sc-verification-highlight-green: rgba(16, 185, 129, 0.15);
  --sc-verification-highlight-purple: rgba(139, 92, 246, 0.08);
  --sc-verification-highlight-yellow: rgba(245, 158, 11, 0.08);
  --sc-verification-highlight-orange: rgba(251, 146, 60, 0.12);
}

.verification-section,
.breakdown-group.verification-container {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--sc-verification-border);
  background: var(--sc-verification-bg);
  padding: 16px;
  border-radius: 8px;
}

.light-theme .verification-section {
  background: rgba(241, 245, 249, 0.8);
  border-top-color: rgba(59, 130, 246, 0.2);
}

/* Verification subsections */
.verification-subsection {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--sc-verification-divider);
}

.verification-subsection:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Verification labels (italic helper text) */
.verification-label {
  font-style: italic;
  color: var(--sc-verification-label);
  margin-bottom: 4px;
}

/* Verification section header */
.verification-header {
  font-weight: 600;
  color: var(--sc-text-high);
  margin-bottom: 4px;
}

/* Highlight backgrounds for verification results */
.verification-highlight {
  background: var(--sc-verification-highlight);
  padding: 4px 0;
}

.verification-highlight-green {
  background: var(--sc-verification-highlight-green);
  padding: 4px 0;
}

.verification-highlight-purple {
  background: var(--sc-verification-highlight-purple);
  padding: 4px 0;
}

.verification-highlight-yellow {
  background: var(--sc-verification-highlight-yellow);
  padding: 4px 0;
}

.verification-highlight-orange {
  background: var(--sc-verification-highlight-orange);
  padding: 4px 0;
}

/* ============================================
   SCENARIO GRID (for multi-scenario view)
   ============================================ */
.results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: auto;
  gap: 20px;
  width: 100%;
}

.scenarios-comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 20px;
}

/* Single scenario (for share page) */
.scenario-single {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1200px) {
  .results-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .scenarios-comparison-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .results-grid,
  .scenarios-comparison-grid {
    grid-template-columns: 1fr;
  }

  .scenario-card-monthly {
    font-size: 28px;
  }

  .scenario-card-title {
    font-size: 14px;
  }

  .scenario-breakdown-card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .scenario-stacked-bar {
    height: 32px;
  }

  .bar-segment {
    font-size: 10px;
  }

  .breakdown-item.sub {
    padding-left: 12px;
    font-size: 11px;
  }
}
