/* Form Component Styles */

/* Form Groups */
.form-group {
  margin-bottom: var(--space-4);
}

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

/* Labels */
.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--gray-700);
}

.form-label-required::after {
  content: " *";
  color: var(--color-error);
}

/* Base Input Styles */
.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--gray-900);
  background-color: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-input:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled),
.form-textarea:hover:not(:focus):not(:disabled) {
  border-color: var(--gray-400);
}

/* Input Sizes */
.form-input-sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-sm);
}

.form-input-lg {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-lg);
}

/* Textarea Specific */
.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Select Specific */
.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L2 5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px;
  padding-right: calc(var(--space-3) * 3);
  appearance: none;
}

/* Disabled State */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Validation States */
.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
  border-color: var(--color-success);
  padding-right: calc(var(--space-3) * 3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2310b981' d='M13.8 4.2a1 1 0 0 0-1.4 0L6 10.6 3.6 8.2a1 1 0 0 0-1.4 1.4l3 3a1 1 0 0 0 1.4 0l7-7a1 1 0 0 0 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;
}

.form-input.is-valid:focus,
.form-select.is-valid:focus,
.form-textarea.is-valid:focus {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--color-error);
  padding-right: calc(var(--space-3) * 3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='%23ef4444' stroke-width='2'/%3E%3Cpath fill='%23ef4444' d='M8 5v4m0 2v.01'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Help Text */
.form-help {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--gray-600);
}

.form-error {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-error);
}

/* Input Groups */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  border-radius: 0;
  flex: 1;
}

.input-group .form-input:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.input-group .form-input:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.input-group-addon {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background-color: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--gray-600);
}

.input-group-addon:first-child {
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-addon:last-child {
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* File Upload Areas */
.file-upload-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  background-color: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}

.file-upload-area:hover {
  background-color: var(--gray-100);
  border-color: var(--gray-400);
}

.file-upload-area.dragover {
  background-color: var(--brand-secondary);
  background-color: rgba(74, 144, 226, 0.05);
  border-color: var(--brand-secondary);
  border-style: solid;
}

.file-upload-icon {
  font-size: 48px;
  margin-bottom: var(--space-3);
  color: var(--gray-400);
}

.file-upload-text {
  font-size: var(--font-size-base);
  color: var(--gray-700);
  margin-bottom: var(--space-1);
}

.file-upload-text strong {
  color: var(--brand-secondary);
  font-weight: var(--font-weight-semibold);
}

.file-upload-hint {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
}

.file-upload-area.has-file {
  background-color: var(--color-success-light);
  border-color: var(--color-success);
  border-style: solid;
}

.file-upload-area.has-file .file-upload-icon {
  color: var(--color-success);
}

/* Checkbox and Radio */
.form-checkbox,
.form-radio {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin-right: var(--space-4);
}

.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  margin-right: var(--space-2);
  cursor: pointer;
}

/* Range Input */
.form-range {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--brand-secondary);
  cursor: pointer;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.form-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--brand-secondary);
  cursor: pointer;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  border: none;
}