/* ==========================================================================
   ImpactWeb ROI Pro - Design System & Styles
   Palette Professionnelle : Bleu / Blanc / Gris avec Accents Verts (Gains & Bénéfices)
   Version Épurée & Minimaliste (100% Client-Facing)
   ========================================================================== */

:root {
  /* Nuances de Blanc & Gris */
  --bg-base: #F8FAFC;         /* Fond principal gris très clair et lumineux */
  --bg-surface: #FFFFFF;      /* Fond de l'en-tête */
  --bg-card: #FFFFFF;         /* Fond des cartes blanches épurées */
  --bg-card-hover: #F8FAFC;
  --bg-subtle: #F1F5F9;       /* Puces, contrôles secondaires */
  --border-light: #E2E8F0;    /* Bordures douces */
  --border-focus: #2563EB;

  /* Nuances de Bleu (Identité & Actions) */
  --blue-primary: #2563EB;    /* Bleu royal vif et professionnel */
  --blue-hover: #1D4ED8;
  --blue-dark: #1E3A8A;       /* Bleu marine profond */
  --blue-subtle: #EFF6FF;     /* Fond teinté bleu très doux */
  --blue-border: #BFDBFE;

  /* Nuances de Vert (Mise en avant exclusive des GAINS & BÉNÉFICES) */
  --green-profit: #059669;    /* Vert émeraude intense et contrasté */
  --green-light: #10B981;
  --green-subtle: #ECFDF5;    /* Fond vert très doux pour les cartes de gain */
  --green-border: #A7F3D0;
  --green-glow: rgba(16, 185, 129, 0.2);

  /* Couleurs d'accentuation discrètes */
  --amber: #D97706;
  --amber-subtle: #FEF3C7;

  /* Typographie & Textes */
  --text-primary: #0F172A;     /* Bleu nuit / noir doux (très lisible) */
  --text-secondary: #334155;   /* Gris ardoise soutenu */
  --text-muted: #64748B;       /* Gris intermédiaire */
  --text-light: #94A3B8;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;

  /* Ombres & Arrondis */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px -1px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-green: 0 4px 16px rgba(16, 185, 129, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header / Barre de navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 24px;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.brand-logo-link:hover {
  transform: translateY(-1px) scale(1.02);
  opacity: 0.92;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
}

.brand-divider {
  width: 1px;
  height: 30px;
  background-color: var(--border-light);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Prospect Name Input */
.prospect-bar {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  gap: 8px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.prospect-bar:focus-within {
  border-color: var(--blue-primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.prospect-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.prospect-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  outline: none;
  min-width: 180px;
}

.prospect-input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Currency Toggle (Bleu / Blanc / Gris) */
.currency-selector {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.currency-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.currency-btn.active {
  background: #FFFFFF;
  color: var(--blue-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--blue-primary);
  color: #fff;
  border: 1px solid var(--blue-primary);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: var(--blue-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #CBD5E1;
  color: var(--text-primary);
}

/* Layout Principal */
.main-layout {
  max-width: 1540px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 28px;
  align-items: stretch; /* Les 2 colonnes font exactement la même hauteur */
}

/* Base Card (Blanc épuré avec bordure grise douce) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: #CBD5E1;
}

/* Sidebar Controls (Aérée & alignée en hauteur avec le tableau de droite) */
.sidebar-controls {
  height: 100%;
}

.panel-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px 30px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.link-btn:hover {
  color: var(--blue-primary);
}

/* Control Group Aéré */
.control-group {
  margin: 10px 0;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.control-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-currency-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.num-input {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 8px 40px 8px 14px;
  width: 155px;
  text-align: right;
  outline: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.num-input:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.currency-tag {
  position: absolute;
  right: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

/* Sliders Aérés (Bleu & Gris) */
.slider-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: 10px;
  outline: none;
  margin: 14px 0 8px 0;
  cursor: pointer;
  background-image: linear-gradient(to right, var(--blue-primary), var(--blue-primary));
  background-repeat: no-repeat;
  background-size: 15% 100%;
}

.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  cursor: pointer;
  border: 2.5px solid var(--blue-primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, background-color 0.15s;
}

.slider-range::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  background: var(--blue-subtle);
}

/* Scenarios Grid Aéré */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.scenario-card {
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.scenario-card:hover {
  border-color: #CBD5E1;
  transform: translateY(-2px);
}

.scenario-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.badge-pessimistic {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.badge-realistic {
  background: var(--blue-subtle);
  color: var(--blue-primary);
}

.badge-optimistic {
  background: var(--blue-subtle);
  color: var(--blue-dark);
}

.scenario-rate {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 3px 0 6px 0;
}

.scenario-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Carte de Scénario Active */
.scenario-card.active#scenarioPessimistic,
.scenario-card.active#scenarioRealistic,
.scenario-card.active#scenarioOptimistic {
  border-color: var(--blue-primary);
  background: var(--blue-subtle);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* Value Badges */
.val-badge {
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.val-badge.highlight-green {
  background: var(--green-subtle);
  border-color: var(--green-border);
  color: var(--green-profit);
}

.sub-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.35;
}

.sub-control-compact {
  padding: 16px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sub-control-compact strong {
  color: var(--text-primary);
}

.hint-compact {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ==========================================================================
   Dashboard Area (Right Column)
   ========================================================================== */
.dashboard-area {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* 4 Main KPIs Grid */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #CBD5E1;
  box-shadow: var(--shadow-lg);
}

/* HERO CARD : BÉNÉFICE NET MENSUEL (ACCENT VERT ÉMERAUDE POUR LE PROFIT) */
.hero-kpi {
  background: linear-gradient(145deg, #ECFDF5 0%, #FFFFFF 100%);
  border: 2px solid var(--green-light);
  box-shadow: var(--shadow-green);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

.kpi-tag.blue { background: var(--blue-subtle); color: var(--blue-primary); }
.kpi-tag.green { background: #D1FAE5; color: var(--green-profit); }
.kpi-tag.purple { background: #F1F5F9; color: var(--text-secondary); }
.kpi-tag.amber { background: var(--amber-subtle); color: var(--amber); }

.kpi-main-val {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  line-height: 1.1;
}

/* Chiffres en VERT pour les GAINS et BÉNÉFICES */
.kpi-main-val.text-green {
  color: var(--green-profit);
}

.kpi-main-val.text-purple {
  color: var(--green-profit);
}

.kpi-main-val.text-amber {
  color: var(--text-primary);
}

.kpi-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: auto;
}

.accent-val {
  color: var(--blue-primary);
  font-weight: 700;
}

.kpi-indicator-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-indicator-bar.blue { background: var(--blue-primary); }
.kpi-indicator-bar.green { background: var(--green-profit); }
.kpi-indicator-bar.purple { background: var(--green-light); }
.kpi-indicator-bar.amber { background: var(--blue-dark); }

.highlight-card {
  background: #FFFFFF;
  border-color: var(--border-light);
}

/* Chart Card */
.chart-card {
  padding: 26px;
  background: #FFFFFF;
}

.chart-header {
  margin-bottom: 20px;
}

.chart-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.chart-canvas-wrapper {
  position: relative;
  height: 390px;
  width: 100%;
}

/* 3-Year Horizon Metrics (Épuré à 2 métriques claires et aérées) */
.horizon-metrics {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 24px;
  padding: 16px 28px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}

.horizon-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.horizon-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.horizon-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
}

.horizon-value.green { color: var(--green-profit); }
.horizon-value.cyan { color: var(--blue-primary); }

.horizon-divider {
  width: 1px;
  height: 28px;
  background: var(--border-light);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  background: var(--green-profit);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.4);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-controls {
    position: static;
  }
  .kpis-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .kpis-grid {
    grid-template-columns: 1fr;
  }
  .scenarios-grid {
    grid-template-columns: 1fr;
  }
  .horizon-metrics {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .horizon-divider {
    display: none;
  }
}

/* Print / Export PDF Mode */
@media print {
  body {
    background: #fff !important;
  }
  .app-header,
  .sidebar-controls,
  .btn,
  .toast {
    display: none !important;
  }
  .main-layout {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .card, .kpi-card, .chart-card {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
  }
}
