/* ==========================================================
   SolarPro Design System - Forms
   Form layouts, groups, custom controls
   ========================================================== */

/* ── Form Grid Layouts ── */
.form-grid {
  display: grid;
  gap: 20px;
}

.form-grid-1 {
  grid-template-columns: 1fr;
}

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

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

/* ── Form Group ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-label .required {
  color: var(--accent-red);
  font-size: 14px;
  line-height: 1;
}

/* ── Form Row (inline fields) ── */
.form-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.form-row > * {
  flex: 1;
}

/* ── Form Section ── */
.form-section {
  margin-bottom: 32px;
}

.form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-section-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.form-section-divider {
  height: 1px;
  background: var(--border-default);
  margin-bottom: 24px;
}

/* ── Form Actions ── */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 24px;
  border-top: 1px solid var(--border-default);
  margin-top: 24px;
}

.form-actions-left {
  justify-content: flex-start;
}

.form-actions-between {
  justify-content: space-between;
}

/* ── Custom Checkbox ── */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--text-primary);
}

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

.checkbox-mark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-hover);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.checkbox input:checked + .checkbox-mark {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.checkbox input:checked + .checkbox-mark::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.checkbox:hover .checkbox-mark {
  border-color: var(--accent-blue);
}

.checkbox input:focus-visible + .checkbox-mark {
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.checkbox input:disabled + .checkbox-mark {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Custom Radio ── */
.radio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--text-primary);
}

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

.radio-mark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.radio input:checked + .radio-mark {
  border-color: var(--accent-blue);
}

.radio input:checked + .radio-mark::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
}

.radio:hover .radio-mark {
  border-color: var(--accent-blue);
}

.radio input:focus-visible + .radio-mark {
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

/* ── Radio Group ── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-group.inline {
  flex-direction: row;
  gap: 20px;
}

/* ── Checkbox Group ── */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-group.inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
}

/* ── File Upload Dropzone ── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.dropzone:hover {
  border-color: var(--accent-blue);
  background: var(--accent-blue-glow);
}

.dropzone.active,
.dropzone.dragover {
  border-color: var(--accent-blue);
  background: var(--accent-blue-glow);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 22px;
}

.dropzone-text {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.dropzone-text strong {
  color: var(--accent-blue);
  font-weight: 500;
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.dropzone input[type="file"] {
  display: none;
}

/* ── File List ── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.file-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.file-item-info {
  flex: 1;
  min-width: 0;
}

.file-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.file-item-remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-item-remove:hover {
  background: var(--accent-red-glow);
  color: var(--accent-red);
}

/* ── Error State ── */
.form-group.has-error .input,
.form-group.has-error .select,
.form-group.has-error .textarea {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.form-group.has-error .form-label {
  color: var(--accent-red);
}

.form-error {
  font-size: 12px;
  color: var(--accent-red);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* ── Form Help Text ── */
.form-help {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-top: 2px;
}

/* ── Search Input (within forms) ── */
.form-search {
  position: relative;
}

.form-search .input {
  padding-left: 36px;
}

.form-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ── Date Picker Wrapper ── */
.date-input {
  position: relative;
}

.date-input .input {
  padding-right: 36px;
}

.date-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ── Range/Slider ── */
.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
}

/* ── Inline Edit ── */
.inline-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.inline-edit:hover {
  background: var(--bg-card-hover);
}

.inline-edit-icon {
  opacity: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  transition: opacity var(--transition-fast);
}

.inline-edit:hover .inline-edit-icon {
  opacity: 1;
}
