/**
 * Simulation Form Redesign - "Créer Simulation"
 * 2-column equal layout with modern card-based design
 */

/* ═══════════════════════════════════════════════════════════════════
   CSS VARIABLES (extend existing)
   ═══════════════════════════════════════════════════════════════════ */

.simulation-form-view {
  --sf-bg-body: #0f172a;
  --sf-bg-card: #1e293b;
  --sf-bg-input: #334155;
  --sf-border-color: #475569;
  --sf-accent-primary: #3b82f6;
  --sf-accent-hover: #2563eb;
  --sf-text-main: #f8fafc;
  --sf-text-muted: #94a3b8;
  --sf-success: #10b981;
  --sf-font-display: 'Urbanist', sans-serif;
  --sf-font-body: 'Inter', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════
   VIEW CONTAINER
   ═══════════════════════════════════════════════════════════════════ */

.simulation-form-view {
  background-color: var(--sf-bg-body);
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sf-border-color);
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sim-form-header-titles h1 {
  font-family: var(--sf-font-display);
  font-size: 24px;
  margin: 0;
  font-weight: 700;
  color: var(--sf-text-main);
}

.sim-form-header-titles p {
  color: var(--sf-text-muted);
  margin: 4px 0 0 0;
  font-size: 13px;
}

.sim-form-header-actions {
  display: flex;
  gap: 12px;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--sf-font-display);
  font-size: 14px;
  transition: all 0.2s;
}

.sim-form-btn-primary {
  background: var(--sf-accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sim-form-btn-primary:hover {
  background: var(--sf-accent-hover);
  transform: translateY(-1px);
}

.sim-form-btn-secondary {
  background: transparent;
  border-color: var(--sf-border-color);
  color: var(--sf-text-muted);
}

.sim-form-btn-secondary:hover {
  border-color: var(--sf-text-muted);
  color: var(--sf-text-main);
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN LAYOUT GRID
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 32px;
}

@media (max-width: 1024px) {
  .sim-form-grid {
    grid-template-columns: 1fr;
    padding: 0 16px;
    margin: 16px auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-card {
  background: var(--sf-bg-card);
  border-radius: 16px;
  border: 1px solid var(--sf-border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sim-form-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sim-form-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--sf-accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sim-form-card-icon .material-symbols-rounded {
  font-size: 20px;
}

.sim-form-card-title {
  font-family: var(--sf-font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--sf-text-main);
}

/* Collapsible Card (Paramètres Avancés) */
.sim-form-card.collapsible .sim-form-card-header {
  cursor: pointer;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  transition: margin-bottom 0.2s, padding-bottom 0.2s;
}

.sim-form-card.collapsible.expanded .sim-form-card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sim-form-card.collapsible .sim-form-card-body {
  display: none;
}

.sim-form-card.collapsible.expanded .sim-form-card-body {
  display: block;
}

.sim-form-card-toggle {
  margin-left: auto;
  color: var(--sf-text-muted);
  transition: transform 0.2s;
}

.sim-form-card.collapsible.expanded .sim-form-card-toggle {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════════════════════════
   FORM GRIDS
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.sim-form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.sim-form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* Battery price grid: Prix Batterie | Remise (small) | Prix Net | Options */
.sim-form-grid-battery {
  display: grid;
  grid-template-columns: 1fr 100px 1fr 1fr;
  gap: 16px;
  align-items: end;
}

@media (max-width: 768px) {
  .sim-form-grid-2,
  .sim-form-grid-3,
  .sim-form-grid-4,
  .sim-form-grid-battery {
    grid-template-columns: 1fr;
  }
}

.sim-form-row {
  margin-top: 20px;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM GROUPS
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sim-form-group.full-width {
  grid-column: 1 / -1;
}

/* Row layout for side-by-side inputs within a group */
.sim-form-group.sim-form-group-row {
  flex-direction: row;
  gap: 12px;
}

.sim-form-subgroup {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sim-form-subgroup-small {
  flex: 0 0 110px;
  min-width: 110px;
}

/* Reduce padding for small subgroup inputs */
.sim-form-subgroup-small .sim-form-input-suffix input {
  padding-right: 32px;
}

.sim-form-subgroup-small .sim-form-input-suffix .suffix {
  right: 8px;
}

/* Computed/readonly input style */
.sim-form-input-computed {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
  cursor: default;
  font-weight: 600;
}

.sim-form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sf-text-muted);
  display: flex;
  justify-content: space-between;
}

.sim-form-input,
.sim-form-select {
  background: var(--sf-bg-input);
  border: 1px solid var(--sf-border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: white;
  font-family: var(--sf-font-body);
  font-size: 14px;
  transition: all 0.2s;
  width: 100%;
}

.sim-form-input:focus,
.sim-form-select:focus {
  border-color: var(--sf-accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  outline: none;
}

.sim-form-input::placeholder {
  color: var(--sf-text-muted);
}

/* Highlighted Input (Prix Négocié) */
.sim-form-input.highlighted {
  border-color: var(--sf-accent-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   INPUT WITH SUFFIX
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-input-suffix {
  position: relative;
}

.sim-form-input-suffix input {
  width: 100%;
  padding-right: 25px;
}

.sim-form-input-suffix .suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sf-text-muted);
  font-size: 12px;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
   CLIENT SELECTOR
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-client-wrapper {
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 32px;
}

@media (max-width: 1024px) {
  .sim-form-client-wrapper {
    padding: 0 16px;
  }
}

.sim-form-client-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sf-text-muted);
  margin-bottom: 8px;
  display: block;
}

.sim-form-client-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sf-bg-card);
  border: 1px solid var(--sf-border-color);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.sim-form-client-trigger:hover {
  border-color: var(--sf-accent-primary);
  background: rgba(59, 130, 246, 0.05);
}

.sim-form-client-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-form-client-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sf-accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--sf-font-display);
  font-size: 14px;
}

.sim-form-client-avatar.placeholder {
  background: var(--sf-bg-input);
  color: var(--sf-text-muted);
}

.sim-form-client-name {
  font-weight: 600;
  color: var(--sf-text-main);
}

.sim-form-client-placeholder {
  color: var(--sf-text-muted);
  font-style: italic;
}

/* Styled client select */
.sim-form-client-select-styled {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  background: var(--sf-bg-card);
  border: 1px solid var(--sf-border-color);
  border-radius: 12px;
}

/* ═══════════════════════════════════════════════════════════════════
   TEMPLATE SELECTOR
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-template-wrapper {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 0 32px;
}

@media (max-width: 1024px) {
  .sim-form-template-wrapper {
    padding: 0 16px;
  }
}

.sim-form-template-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sf-text-muted);
  margin-bottom: 8px;
  display: block;
}

.sim-form-template-select-styled {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  background: var(--sf-bg-card);
  border: 1px solid var(--sf-border-color);
  border-radius: 12px;
}

.sim-form-template-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--sf-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-form-template-hint::before {
  content: 'info';
  font-family: 'Material Symbols Rounded';
  font-size: 16px;
  color: var(--sf-accent-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   BRAND SELECTOR
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-brand-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.sim-form-brand-select-container {
  flex: 1;
}

.sim-form-brand-preview {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--sf-bg-input);
  border: 1px solid var(--sf-border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sim-form-brand-preview img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sim-form-brand-preview.hidden {
  display: none;
}

.sim-form-brand-custom {
  display: none;
}

.sim-form-brand-custom.visible {
  display: flex;
  gap: 8px;
}

.sim-form-brand-custom input {
  flex: 1;
}

.sim-form-brand-cancel {
  padding: 10px;
  background: var(--sf-bg-input);
  border: 1px solid var(--sf-border-color);
  border-radius: 8px;
  color: var(--sf-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.sim-form-brand-cancel:hover {
  color: var(--sf-text-main);
  border-color: var(--sf-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   ECO SCORE CARD
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-eco-card {
  background: rgba(16, 185, 129, 0.05);
  border: 1px dashed rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
}

.sim-form-eco-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--sf-success);
  margin-top: 2px;
  cursor: pointer;
}

.sim-form-eco-content h4 {
  margin: 0 0 4px 0;
  color: var(--sf-success);
  font-family: var(--sf-font-display);
  font-size: 14px;
  font-weight: 600;
}

.sim-form-eco-content p {
  margin: 0;
  font-size: 13px;
  color: var(--sf-text-muted);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════
   USAGE SLIDER
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-usage-section {
  margin-bottom: 24px;
}

.sim-form-usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sim-form-usage-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sf-text-muted);
}

.sim-form-usage-values {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.sim-form-usage-values .pro {
  color: var(--sf-accent-primary);
}

.sim-form-usage-values .personal {
  color: var(--sf-success);
}

.sim-form-usage-values strong {
  font-weight: 600;
}

.sim-form-usage-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--sf-accent-primary) 0%, var(--sf-accent-primary) var(--value, 100%), var(--sf-success) var(--value, 100%), var(--sf-success) 100%);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.sim-form-usage-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--sf-accent-primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sim-form-usage-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--sf-accent-primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sim-form-usage-bars {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.sim-form-usage-bar-pro {
  background: var(--sf-accent-primary);
  transition: width 0.2s;
}

.sim-form-usage-bar-personal {
  background: var(--sf-success);
  transition: width 0.2s;
}

/* ═══════════════════════════════════════════════════════════════════
   DROPZONE
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-dropzone {
  border: 2px dashed var(--sf-border-color);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: var(--sf-text-muted);
  transition: all 0.2s;
  cursor: pointer;
}

.sim-form-dropzone:hover,
.sim-form-dropzone.dragover {
  border-color: var(--sf-accent-primary);
  background: rgba(59, 130, 246, 0.05);
  color: var(--sf-accent-primary);
}

.sim-form-dropzone .material-symbols-rounded {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.sim-form-dropzone-text {
  font-size: 14px;
}

.sim-form-file-input {
  display: none;
}

/* File List */
.sim-form-file-list {
  margin-top: 16px;
}

.sim-form-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--sf-bg-input);
  border-radius: 8px;
  margin-bottom: 8px;
}

.sim-form-file-icon {
  color: var(--sf-accent-primary);
}

.sim-form-file-info {
  flex: 1;
  min-width: 0;
}

.sim-form-file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--sf-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sim-form-file-size {
  font-size: 11px;
  color: var(--sf-text-muted);
}

.sim-form-file-remove {
  background: none;
  border: none;
  color: var(--sf-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.sim-form-file-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════
   RESULTS SECTION
   ═══════════════════════════════════════════════════════════════════ */

.sim-form-results {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px 32px;
}

@media (max-width: 1024px) {
  .sim-form-results {
    padding: 0 16px 16px;
  }
}

.sim-form-results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sf-border-color);
}

.sim-form-results-title {
  font-family: var(--sf-font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--sf-text-main);
  margin: 0;
}

/* Scenarios Grid */
.sf-scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Scenario Card */
.sf-scenario-card {
  background: var(--sf-bg-card);
  border: 1px solid var(--sf-border-color);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  transition: all 0.2s;
}

.sf-scenario-card:hover {
  border-color: var(--sf-accent-primary);
  transform: translateY(-2px);
}

.sf-scenario-best {
  border-color: var(--sf-success);
  background: rgba(16, 185, 129, 0.05);
}

.sf-scenario-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--sf-success);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sf-scenario-header {
  margin-bottom: 16px;
}

.sf-scenario-title {
  font-family: var(--sf-font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--sf-text-main);
  margin: 0 0 4px 0;
}

.sf-scenario-subtitle {
  font-size: 12px;
  color: var(--sf-text-muted);
  margin: 0;
}

.sf-scenario-main-value {
  text-align: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 16px;
}

.sf-scenario-amount {
  font-family: var(--sf-font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--sf-accent-primary);
}

.sf-scenario-best .sf-scenario-amount {
  color: var(--sf-success);
}

.sf-scenario-period {
  font-size: 14px;
  color: var(--sf-text-muted);
}

.sf-scenario-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sf-scenario-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.sf-scenario-row span:first-child {
  color: var(--sf-text-muted);
}

.sf-scenario-row span:last-child {
  color: var(--sf-text-main);
  font-weight: 500;
}

.sf-scenario-savings {
  color: var(--sf-success) !important;
}

.sf-scenario-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  font-weight: 600;
}

.sf-scenario-total span:first-child {
  color: var(--sf-text-muted);
}

.sf-scenario-total span:last-child {
  color: var(--sf-text-main);
}

/* Results Actions */
.sf-results-actions {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.sf-results-actions .sim-form-btn {
  min-width: 250px;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sim-form-header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    align-items: flex-start;
  }

  .sim-form-header-actions {
    width: 100%;
  }

  .sim-form-btn {
    flex: 1;
    justify-content: center;
  }
}
/* UI50-05: the eco-score box has a real label; disabled outside electric vehicles. */
.sim-form-eco-content h4 label { cursor: pointer; color: inherit; font: inherit; margin: 0; }
.sim-form-eco-checkbox:disabled, .sim-form-eco-checkbox:disabled ~ .sim-form-eco-content { opacity: .55; cursor: not-allowed; }
/* UI50-07 (revue UI .50): while the icon font loads, its ligature names are wide text; the header buttons
   overflowed the 390 px viewport by 31 px at that moment. Icons get a fixed box and the row may wrap. */
.sim-form-header-actions { flex-wrap: wrap; max-width: 100%; }
.sim-form-btn { min-width: 0; max-width: 100%; }
.sim-form-btn .material-symbols-rounded { display: inline-block; width: 1em; overflow: hidden; flex-shrink: 0; }
