/**
 * CHM Solar - Form Styles
 */

/* Form Layout */
.form-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.form-container {
  flex: 1;
  padding: 2rem 0;
}

/* Form Header */
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}

.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.form-title {
  font-size: 1.5rem;
  color: var(--primary);
}

.form-subtitle {
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* Form Steps */
.form-steps {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
  overflow-x: auto;
}

.form-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: var(--transition);
}

.form-step.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.form-step.completed {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.form-step-number {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: currentColor;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
}

.form-step.active .form-step-number {
  background: white;
  color: var(--primary);
}

.form-step.completed .form-step-number {
  background: var(--accent);
  color: white;
}

/* Form Sections */
.form-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-bottom: 1px solid #e5e7eb;
}

.form-section-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
}

.form-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
}

.form-section-body {
  padding: 1.5rem;
}

/* Type Selection */
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.type-card {
  position: relative;
  padding: 1.5rem;
  background: var(--bg-hover);
  border: 3px solid transparent;
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.type-card:hover {
  border-color: var(--primary-100);
  transform: translateY(-2px);
}

.type-card.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

.type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.type-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.type-context {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  padding: 0.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.type-card.selected .type-context {
  background: var(--primary-100);
  color: var(--primary);
}

/* PVGIS Input */
.pvgis-input {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.pvgis-month {
  text-align: center;
}

.pvgis-month label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 0.375rem;
}

.pvgis-month input {
  width: 100%;
  padding: 0.625rem;
  text-align: center;
  font-size: 0.875rem;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.pvgis-month input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Autoconsommation Options */
.autoconso-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.autoconso-option {
  padding: 1rem;
  background: var(--bg-hover);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.autoconso-option:hover {
  border-color: var(--primary-100);
}

.autoconso-option.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

.autoconso-option input[type="radio"] {
  display: none;
}

.autoconso-option-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.autoconso-option-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-100);
  color: var(--primary);
  border-radius: var(--radius-sm);
}

.autoconso-option-title {
  font-weight: 600;
  color: var(--ink);
}

.autoconso-option-desc {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* Profil Enedis Select */
.profil-select {
  display: grid;
  gap: 0.5rem;
}

.profil-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-hover);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.profil-item:hover {
  border-color: var(--primary-100);
}

.profil-item.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

.profil-item input {
  display: none;
}

.profil-code {
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
}

.profil-info {
  flex: 1;
}

.profil-name {
  font-weight: 600;
  color: var(--ink);
}

.profil-desc {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.profil-taux {
  font-weight: 700;
  color: var(--accent);
}

/* Toggle Switch */
.input-with-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.input-with-toggle .form-input {
  flex: 1;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

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

/* Financing Options */
.financing-grid {
  display: grid;
  gap: 1rem;
}

.financing-option {
  padding: 1.25rem;
  background: var(--bg-hover);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.financing-option.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

.financing-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.financing-check {
  width: 24px;
  height: 24px;
  accent-color: var(--primary);
}

.financing-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-100);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
}

.financing-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
}

.financing-desc {
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.financing-fields {
  display: none;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.financing-option.selected .financing-fields {
  display: block;
}

/* Module Specs Card */
.module-card {
  padding: 1.25rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: var(--radius);
}

.module-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #dee2e6;
}

.module-icon {
  font-size: 1.5rem;
}

.module-title {
  font-weight: 700;
  color: var(--primary);
}

.module-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  font-size: 0.875rem;
}

.module-spec {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: white;
  border-radius: var(--radius-sm);
}

.module-spec-label {
  color: var(--ink-muted);
}

.module-spec-value {
  font-weight: 600;
  color: var(--ink);
}

/* Image Upload */
.image-upload {
  position: relative;
  padding: 2rem;
  background: var(--bg-hover);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.image-upload:hover {
  border-color: var(--primary);
  background: var(--primary-50);
}

.image-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-upload-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.image-upload-text {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.image-upload-hint {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.image-preview {
  margin-top: 1rem;
  position: relative;
  display: inline-block;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.image-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}

/* Form Navigation */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 1rem;
  margin-top: 1rem;
}

.form-nav-left,
.form-nav-right {
  display: flex;
  gap: 0.75rem;
}

.form-nav-center {
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* Preview Panel */
.preview-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 400px;
  background: var(--bg-card);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: var(--transition-slow);
  z-index: 200;
  overflow-y: auto;
}

.preview-panel.open {
  transform: translateX(0);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
}

.preview-title {
  font-weight: 700;
}

.preview-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

.preview-body {
  padding: 1.25rem;
}

.preview-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.preview-section:last-child {
  border-bottom: none;
}

.preview-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.preview-item {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  font-size: 0.9375rem;
}

.preview-item-label {
  color: var(--ink-muted);
}

.preview-item-value {
  font-weight: 600;
  color: var(--ink);
}

.preview-item-value.positive {
  color: var(--accent);
}

.preview-item-value.negative {
  color: var(--danger);
}

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

  .pvgis-input {
    grid-template-columns: repeat(3, 1fr);
  }

  .autoconso-options {
    grid-template-columns: 1fr;
  }

  .form-navigation {
    flex-direction: column;
    gap: 1rem;
  }

  .form-nav-left,
  .form-nav-right {
    width: 100%;
    justify-content: center;
  }

  .preview-panel {
    width: 100%;
  }

  .module-specs-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .pvgis-input {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-steps {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
}

/* PDF Upload Zone */
.pdf-upload-zone {
  margin-bottom: 1rem;
}

.pdf-upload-box {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  background: var(--bg-hover);
  transition: var(--transition);
  overflow: hidden;
}

.pdf-upload-box:hover,
.pdf-upload-zone.dragover .pdf-upload-box {
  border-color: var(--primary);
  background: var(--primary-50);
}

.pdf-upload-content {
  padding: 2rem;
  text-align: center;
  cursor: pointer;
}

.pdf-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.pdf-upload-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.pdf-upload-hint {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.pdf-upload-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #f8f9fa;
  border-top: 1px solid #e5e7eb;
}

.pdf-upload-status .status-icon {
  font-size: 1.25rem;
}

.pdf-upload-status .status-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.pdf-upload-status.status-loading {
  background: #fff8e1;
}

.pdf-upload-status.status-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.pdf-upload-status.status-warning {
  background: #fff3e0;
  color: #e65100;
}

.pdf-upload-status.status-error {
  background: #ffebee;
  color: #c62828;
}

/* Bifacial Toggle */
.bifacial-option {
  margin-top: 1.5rem;
}

.bifacial-toggle {
  display: block;
  cursor: pointer;
}

.bifacial-toggle input {
  display: none;
}

.bifacial-toggle-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-hover);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.bifacial-toggle:hover .bifacial-toggle-content {
  border-color: var(--primary-100);
}

.bifacial-toggle.active .bifacial-toggle-content {
  border-color: var(--accent);
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.bifacial-toggle-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-100);
  border-radius: var(--radius);
  font-size: 1.5rem;
}

.bifacial-toggle.active .bifacial-toggle-icon {
  background: var(--accent);
  color: white;
}

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

.bifacial-toggle-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.125rem;
}

.bifacial-toggle-desc {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.bifacial-toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
}

.bifacial-toggle-switch .switch-track {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 14px;
  transition: var(--transition);
}

.bifacial-toggle-switch .switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: var(--transition);
}

.bifacial-toggle.active .switch-track {
  background: var(--accent);
}

.bifacial-toggle.active .switch-track::after {
  transform: translateX(24px);
}

.bifacial-bonus {
  margin-top: 1rem;
}

/* Alert Success variant */
.alert-success {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-left: 4px solid var(--accent);
  color: #2e7d32;
}

/* Utility classes */
.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 1rem;
}
