/* ============================================
   LAYOUT & SIDEBAR STYLES
   Apple-Inspired Layout System - 2025
   ============================================

   This file contains:
   - Layout variables and main structure
   - Apple-style sidebar with glassmorphism
   - Main content area and page headers
   - Two-column grid layouts
   - Apple-style cards and mode tabs
   - Settings page styles
   - Detailed mode 3-column layout
   - Mobile responsive styles
   ============================================ */

/* ============================================
   APPLE-INSPIRED SIDEBAR & LAYOUT
   New UI Redesign - 2025
   ============================================ */

/* Layout Variables */
:root {
  --sidebar-width: 260px;
  --column-gap: 28px;
  --content-padding: 32px;
}

/* Sidebar - Glassmorphism Style */
.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-right: 1px solid rgba(96, 165, 250, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--space-8) var(--space-6);
  border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-2);
}

.sidebar-logo-img {
  max-width: 100%;
  height: auto;
  max-height: 48px; /* Adjusted for sidebar header height */
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)); /* Optional: make it pop on dark background */
}

/* Legacy icon styles retained for fallback if needed */
.sidebar-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-pressed));
  border-radius: var(--radius-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}

.sidebar-title {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-high);
  letter-spacing: -0.02em;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-medium);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-base);
  cursor: pointer;
  min-height: 44px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(96, 165, 250, 0.08);
  color: var(--color-text-high);
}

.nav-item.active {
  background: rgba(96, 165, 250, 0.16);
  color: var(--color-accent-primary);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: linear-gradient(180deg, var(--color-accent-primary), var(--color-accent-pressed));
  border-radius: 0 2px 2px 0;
}

.nav-item-icon {
  font-size: 20px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-6);
  border-top: 1px solid rgba(96, 165, 250, 0.18);
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-signout {
  width: 100%;
  justify-content: center;
}

/* Main Content Area */
.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: transparent;
}

.page-container {
  max-width: 98%;
  margin: 0 auto;
  padding: var(--content-padding);
  background: rgba(17, 24, 39, 0.58);
  border-radius: 32px;
  box-shadow: 0 35px 90px rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(96, 165, 250, 0.18);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

/* Page Header */
.page-header {
  margin-bottom: var(--space-10);
}

/* Hide page-header on desktop - it only contains mobile menu button */
@media (min-width: 769px) {
  .page-header {
    display: none !important;
  }

  .page-container {
    padding: 0 !important; /* Remove all padding for desktop view */
  }
}

.page-title-main {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-high);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
}

.page-subtitle {
  font-size: var(--font-size-h4);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
}

/* Two-Column Grid Layout */
.two-column-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--column-gap);
  align-items: start;
}

.column-left,
.column-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Apple-Style Cards */
.apple-card {
  background: rgba(17, 24, 39, 0.85);
  border-radius: var(--radius-large);
  padding: var(--space-8);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(51, 65, 85, 0.5);
  transition: all var(--transition-base);
}

.apple-card:hover {
  box-shadow: var(--shadow-medium);
}

.card-title {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-high);
  margin-bottom: var(--space-6);
}

.card-section-title {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-high);
  margin-bottom: var(--space-4);
}

.card-divider {
  height: 1px;
  background: rgba(51, 65, 85, 0.5);
  margin: var(--space-6) 0;
}

/* Mode Tabs - Apple Segmented Control Style */
.mode-tabs {
  display: flex;
  gap: var(--space-2);
  background: rgba(96, 165, 250, 0.08);
  padding: 4px;
  border-radius: var(--radius-medium);
  margin-bottom: var(--space-6);
}

.mode-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-medium) - 2px);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 60px;
  color: var(--color-text-muted);
}

.mode-tab-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}

.mode-tab-btn.active {
  background: rgba(17, 24, 39, 0.85);
  box-shadow: var(--shadow-small);
  color: var(--color-text-high);
}

.mode-tab-icon {
  font-size: 22px;
}

.mode-tab-label {
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-semibold);
}

.mode-tab-time {
  font-size: var(--font-size-caption);
  color: rgba(148, 163, 184, 0.7);
}

/* Import Section */
.import-controls {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.import-status {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(52, 199, 89, 0.08);
  border: 1px solid rgba(52, 199, 89, 0.2);
  border-radius: var(--radius-medium);
  font-size: var(--font-size-body-small);
  color: var(--color-text-high);
  display: none;
}

.import-status.show {
  display: block;
}

/* Form Grid */
.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* 4-Column Grid for Accordion Sections */
.form-grid-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* Results Section */
.results-header {
  text-align: center;
  padding: var(--space-6) 0;
}

.total-cost-display {
  font-size: 48px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-high);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
}

.annual-cost-display {
  font-size: var(--font-size-h4);
  color: var(--color-text-muted);
}

/* Cost Breakdown List */
.cost-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
}

.cost-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-body);
  color: var(--color-text-high);
}

.cost-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cost-value {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-high);
}

/* Action Buttons */
.card-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Responsive */
@media (max-width: 1200px) {
  .two-column-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .page-container {
    padding: var(--space-6);
  }
}

/* ========================================
   MOBILE RESPONSIVE: SIDEBAR & OVERLAY
   ======================================== */

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  padding: 8px;
  border: none;
  background: rgba(96, 165, 250, 0.14);
  border-radius: 8px;
  color: var(--color-accent-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 16px;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.mobile-menu-btn:hover {
  background: rgba(96, 165, 250, 0.18);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* Mobile Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Page Header Flex Layout */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-header-content {
  flex: 1;
}

/* Mobile Responsive Behavior */
@media (max-width: 768px) {
  /* Show mobile menu button */
  .mobile-menu-btn {
    display: block;
  }

  /* Sidebar slides in from left */
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Main content takes full width */
  .app-main {
    margin-left: 0;
  }

  /* Adjust page header on mobile */
  .page-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .page-title-main {
    font-size: 24px;
  }
}

/* ========================================
   SETTINGS PAGE STYLES
   ======================================== */

.settings-container {
  max-width: 1200px;
  margin: 0 auto;
}

.settings-intro {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.settings-card {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-high);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-help-text {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  font-style: italic;
}

/* TVS Barème Grid */
.tvs-bareme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.tvs-tranche-card {
  background: var(--color-neutral-50, #F9FAFB);
  border: 1px solid var(--color-neutral-200, #E5E7EB);
  border-radius: 12px;
  padding: 16px;
}

.tvs-tranche-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-high);
  margin-bottom: 12px;
}

.tvs-formula {
  font-size: 13px;
  color: var(--color-text-muted);
  font-family: 'SF Mono', 'Monaco', monospace;
  background: rgba(96, 165, 250, 0.08);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 12px;
  border-left: 3px solid rgba(96, 165, 250, 0.45);
}

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

/* ========================================
   DETAILED MODE - 2+1 LAYOUT (2 cols top, full width bottom)
   ======================================== */

.detailed-mode-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 100%;
  margin: 0 auto;
}

.detailed-top-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.detailed-scenarios-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detailed-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detailed-section-header {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-high);
  margin-bottom: 12px;
  text-align: center;
}

.detailed-column-header {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-medium);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* EcoScore Badge */
.ecoscore-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  margin-top: 16px;
}

.ecoscore-badge.green {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.85), rgba(16, 185, 129, 0.9));
  color: var(--color-text-high);
}

.ecoscore-badge.yellow {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.9), rgba(251, 191, 36, 0.85));
  color: var(--color-text-high);
}

.ecoscore-badge.red {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.85), rgba(239, 68, 68, 0.9));
  color: var(--color-text-high);
}

/* Usage Ratio Visualization */
.usage-ratio-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.usage-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-pressed));
  transition: all 0.3s ease;
}

.usage-ratio-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-ratio-label {
  font-size: 13px;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.usage-ratio-value {
  font-weight: 600;
  font-size: 16px;
  color: var(--color-text-high);
}

/* Toggle Switch */
.toggle-switch {
  margin: 12px 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-high);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.85);
  transition: background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.95), rgba(203, 213, 225, 0.9));
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
  transition: transform 0.25s ease;
}

.toggle-input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35);
}

.toggle-input:checked + .toggle-slider {
  background: var(--color-success, #22C55E);
}

.toggle-input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

.toggle-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-stack {
  margin-top: var(--space-4, 20px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Feature Toggle List */
.feature-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.feature-toggle-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.feature-toggle-info {
  flex: 1;
}

.feature-toggle-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-high);
  cursor: pointer;
}

.feature-toggle-description {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Toggle Switch with checkbox input */
.toggle-switch {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch .toggle-slider {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.85);
  transition: background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.toggle-switch .toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.95), rgba(203, 213, 225, 0.9));
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
  transition: transform 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-success, #22C55E);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35);
}

/* Workflow Filter Bar */
.workflow-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.workflow-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 41, 59, 0.5);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.workflow-filter-chip:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
}

.workflow-filter-chip.active {
  background: var(--chip-color, rgba(96, 165, 250, 0.2));
  border-color: var(--chip-color, rgba(96, 165, 250, 0.4));
  color: var(--color-text-high);
}

.workflow-filter-chip .chip-count {
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 600;
}

.workflow-filter-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.2);
}

/* Workflow Status Badge */
.workflow-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.workflow-status-badge--cree {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.workflow-status-badge--soumis {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

.workflow-status-badge--accepte {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.workflow-status-badge--refuse {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.workflow-status-badge--expire {
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
}

/* Simulation Layout */
.simulation-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-6, 32px);
  margin-top: var(--space-6, 32px);
}

.simulation-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4, 24px);
}

.simulation-hero-copy {
  flex: 1 1 260px;
}

.simulation-hero-title {
  font-size: 28px;
  font-weight: 650;
  margin: 0 0 8px;
  color: var(--color-text-high);
}

.simulation-hero-subtitle {
  margin: 0;
  font-size: 16px;
  color: var(--color-text-muted);
}

.simulation-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.import-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.08);
  font-size: 13px;
  color: var(--color-text-muted);
}

.import-status-pill span:last-child {
  color: var(--color-text-high);
  font-weight: 600;
}

.import-status-inline {
  font-size: 13px;
  color: var(--color-text-muted);
}

.simulation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6, 32px);
}

.simulation-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 24px);
}

.form-card-header {
  margin-bottom: var(--space-4, 24px);
}

.form-card-header h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-high);
}

.form-card-header p {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

.form-card .form-grid-2col {
  gap: 18px;
}

.action-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
}

/* ============================================
   ACCORDION LAYOUT STYLES
   ============================================ */

.accordion-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 24px);
  padding-bottom: var(--space-6, 32px);
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-5, 28px);
  padding: var(--space-6, 32px) 0;
  border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

.view-header .header-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
  min-width: 240px;
}

.view-header .header-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-high);
}

.view-header .header-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

.view-header .header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2, 8px);
  min-width: 280px;
}

/* Compact header for views with separate toolbars */
.view-header--compact {
  border-bottom: none;
  padding-bottom: var(--space-2, 8px);
  margin-bottom: var(--space-2, 8px);
}

/* Toolbar Area container */
.view-toolbar-area {
  margin-bottom: var(--space-6, 24px);
}

.header-actions-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2, 8px);
}

.header-actions-group .btn {
  border-radius: var(--radius-full);
  padding: 10px 20px;
}

.header-actions-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.header-help-text {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
  text-align: right;
}

.accordion-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 16px);
}

/* Accordion Section Styles */
.accordion-section {
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: var(--radius-large, 12px);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.55);
}

.accordion-section.collapsed .section-content {
  max-height: 0;
  opacity: 0;
  visibility: hidden;
}

.accordion-section:not(.collapsed) .section-content {
  max-height: 2000px;
  opacity: 1;
  visibility: visible;
}

/* Section Header (Clickable) */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5, 24px);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.92) 100%);
  border-bottom: 1px solid rgba(96, 165, 250, 0.18);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.accordion-section:not(.collapsed) .section-header {
  border-bottom: 1px solid rgba(96, 165, 250, 0.25);
  box-shadow: inset 0 -1px 0 rgba(37, 99, 235, 0.18);
}

.section-header:hover {
  background: linear-gradient(135deg, rgba(37, 56, 83, 0.95) 0%, rgba(24, 33, 45, 0.92) 100%);
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-high);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-badge {
  background: rgba(96, 165, 250, 0.16);
  color: var(--color-text-high);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-small);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}

.toggle-icon {
  background: none;
  border: none;
  font-size: 16px;
  padding: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
  color: rgba(203, 213, 225, 0.85);
}

.accordion-section:not(.collapsed) .toggle-icon {
  transform: rotate(90deg);
}

/* Section Content */
.section-content {
  padding: var(--space-5, 24px);
  transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.section-content.hidden {
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  padding: 0;
}

/* Subsections within Advanced Parameters */
.subsection {
  margin-bottom: var(--space-6, 32px);
}

.subsection h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-medium);
  margin: 0 0 var(--space-4, 20px) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   STICKY ACTION BAR
   ============================================ */

.simulation-results {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.results-placeholder {
  text-align: center;
  padding: 40px 24px;
}

.results-placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: auto;
  gap: 20px;
  width: 100%;
}

.scenario-card-divider {
  height: 1px;
  background: rgba(96, 165, 250, 0.18);
  margin: 16px 0;
}

@media (max-width: 1024px) {
  .simulation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .simulation-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .simulation-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ============================================
   RESPONSIVE ACCORDION LAYOUT
   ============================================ */

/* Wide screens: 4-column grid */
@media (min-width: 1400px) {
  .form-grid-4col {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Medium-large screens: 3-column grid */
@media (max-width: 1399px) and (min-width: 1025px) {
  .form-grid-4col {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Medium screens: 2-column grid */
@media (max-width: 1024px) and (min-width: 769px) {
  .form-grid-4col {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1-column grid */
@media (max-width: 768px) {
  .form-grid-4col {
    grid-template-columns: 1fr;
  }

  .view-header {
    flex-direction: column;
    gap: var(--space-4);
    align-items: flex-start;
  }

  .view-header .header-actions {
    align-items: flex-start;
    width: 100%;
  }

  .header-actions-group {
    justify-content: flex-start;
  }

  .header-actions-meta {
    align-items: flex-start;
  }

  .header-help-text {
    text-align: left;
  }

  .section-header {
    padding: var(--space-4, 20px);
  }

  .section-content {
    padding: var(--space-4, 20px);
  }
}

.usage-ratio-visual {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-ratio-bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(24, 33, 45, 0.75);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.usage-ratio-bar-fill,
.usage-ratio-bar-empty {
  height: 100%;
  transition: width 0.25s ease;
}

.usage-ratio-bar-fill {
  background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-pressed));
  width: 100%;
}

.usage-ratio-bar-empty {
  background: rgba(51, 65, 85, 0.45);
  width: 0%;
}

/* Usage Ratio Labels */
.usage-ratio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.usage-ratio-labels strong {
  color: var(--color-text-high);
  font-weight: 600;
}

/* Range Slider - Apple Style */
.form-range-apple {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-accent-primary) 100%, rgba(24, 33, 45, 0.75) 100%);
  outline: none;
  transition: background 0.3s ease;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.form-range-apple::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-pressed));
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.form-range-apple::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.form-range-apple::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-pressed));
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.form-range-apple::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.form-range-apple:focus {
  outline: none;
}

.form-range-apple:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--color-accent-glow);
}

.form-range-apple:focus::-moz-range-thumb {
  box-shadow: 0 0 0 4px var(--color-accent-glow);
}



/* Radio Buttons - Apple Style */
.radio-group-apple {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-option-apple {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid rgba(96, 165, 250, 0.18);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(24, 33, 45, 0.68);
}

.radio-option-apple:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(37, 99, 235, 0.14);
}

.radio-option-apple.selected {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.2);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.25);
}

.radio-option-apple input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-accent-primary);
}

.radio-option-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-high);
}

/* Scenario Tabs */
.scenario-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.scenario-tab {
  padding: 12px 16px;
  border: 2px solid rgba(96, 165, 250, 0.18);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.75);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  color: var(--color-text-medium);
}

.scenario-tab:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(24, 33, 45, 0.85);
  color: var(--color-text-high);
}

.scenario-tab.active {
  border-color: rgba(96, 165, 250, 0.55);
  background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-pressed));
  color: var(--color-text-high);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.32);
}

.scenario-tab .best-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(16, 185, 129, 0.95));
  color: var(--color-text-high);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
}

/* Comparison Chart Container */
.comparison-chart-container {
  background: rgba(24, 33, 45, 0.78);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.35);
  margin-bottom: 20px;
}

/* Metrics Table */
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 20px;
}

.metrics-table th {
  text-align: left;
  padding: 12px;
  background: rgba(24, 33, 45, 0.85);
  font-weight: 600;
  color: var(--color-text-medium);
  border-bottom: 2px solid rgba(96, 165, 250, 0.18);
}

.metrics-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.14);
  color: var(--color-text-high);
}

.metrics-table tr:hover {
  background: rgba(37, 56, 83, 0.45);
}

.best-value {
  color: var(--color-success);
  font-weight: 700;
}

/* Scenarios Comparison Grid - 4 columns for side-by-side comparison */
.scenarios-comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.scenario-breakdown-card {
  background: rgba(17, 24, 39, 0.82);
  border: 2px solid rgba(96, 165, 250, 0.18);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-card);
}

.scenario-breakdown-card:hover {
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.45);
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.35);
}

.scenario-breakdown-card.best {
  border-color: rgba(34, 197, 94, 0.55);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(15, 118, 110, 0.25));
}

.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(--color-text-high);
  margin: 0;
}

.scenario-card-badge {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(16, 185, 129, 0.95));
  color: var(--color-text-high);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

/* Monthly Cost - Primary (Big Number) */
.scenario-card-monthly {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-text-high);
  margin-bottom: 4px;
  line-height: 1.2;
}

.scenario-breakdown-card.best .scenario-card-monthly {
  color: var(--color-success);
}

/* Annual Cost - Secondary */
.scenario-card-annual {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

/* Legacy styles (keep for backward compatibility if needed) */
.scenario-card-total {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-high);
  margin-bottom: 4px;
}

.scenario-breakdown-card.best .scenario-card-total {
  color: var(--color-success);
}

.scenario-card-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.scenario-section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-medium);
  margin-bottom: 12px;
}

/* 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(--color-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));
}

/* Detailed Breakdown 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(--color-text-medium);
}

.breakdown-item.main {
  font-weight: 600;
  color: var(--color-text-high);
  margin-top: 8px;
}

.breakdown-item.sub {
  padding-left: 20px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.breakdown-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breakdown-icon {
  font-size: 14px;
}

.breakdown-value {
  font-weight: 600;
  color: var(--color-text-high);
}

/* Responsive for Detailed Mode */
@media (max-width: 1200px) {
  .detailed-top-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .scenarios-comparison-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .detailed-top-section {
    grid-template-columns: 1fr;
  }

  .scenario-tabs {
    grid-template-columns: 1fr;
  }

  .scenarios-comparison-grid {
    grid-template-columns: 1fr;
  }

  .detailed-section-header {
    font-size: 20px;
  }
}

/* UI50-04 (revue UI .50): fiscal barèmes and data administration are folded under the organisation profile. */
.settings-advanced { margin-top: var(--space-4, 16px); border: 1px solid var(--border-color, rgba(148,163,184,.25)); border-radius: 14px; padding: 0 var(--space-4, 16px); background: var(--surface-1, transparent); }
.settings-advanced[open] { padding-bottom: var(--space-4, 16px); }
.settings-advanced__summary { cursor: pointer; display: flex; align-items: center; gap: 8px; padding: var(--space-4, 16px) 0; font-weight: 600; font-size: 1.05rem; list-style-position: inside; }
.settings-advanced__hint { margin-left: auto; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.settings-advanced__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 0 0 var(--space-4, 16px); }
.settings-advanced > .settings-card { margin-top: var(--space-4, 16px); }

/* UI50-07 (revue UI .50): measured at 325 and 390 px wide (zoom 100 %), Paramètres overflowed to 427 px:
   two-column grids never stacked and the toggle row did not shrink. */
@media (max-width: 600px) {
  #settings-view .form-grid-2col, #settings-view .tvs-bareme-grid { grid-template-columns: minmax(0, 1fr); }
  #settings-view .feature-toggle-item { flex-wrap: wrap; }
  #settings-view .feature-toggle-info { min-width: 0; flex: 1 1 200px; }
  #settings-view .settings-advanced__actions .btn, #settings-view .form-grid-2col .btn { width: 100%; justify-content: center; }
  #settings-view .org-usage-display { flex-wrap: wrap; }
  #settings-view .input-group, #settings-view .input-field { min-width: 0; max-width: 100%; }
}
