/**
 * Shared Input & Form Component Styles
 */

/* =============================================================================
   TEXT INPUT
   Standard text input field
   ============================================================================= */

.textInput {
  width: 100%;
  padding: var(--space-1-5) var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  color: var(--text-primary);
  font-size: var(--text-xs);
  transition: var(--transition-all);
}

.textInput::placeholder {
  color: var(--text-tertiary);
}

.textInput:hover {
  border-color: var(--text-tertiary);
}

.textInput:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px var(--border-focus);
}

.textInput:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Input with icon on the left */
.inputWithIcon {
  position: relative;
  display: flex;
  align-items: center;
}

.inputIcon {
  position: absolute;
  left: var(--space-2);
  color: var(--text-tertiary);
  pointer-events: none;
}

.inputWithIcon .textInput {
  padding-left: var(--space-7);
}

/* =============================================================================
   SEARCH INPUT
   Search field with icon
   ============================================================================= */

.searchInput {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  transition: var(--transition-all);
}

.searchInput:focus-within {
  border-color: var(--accent-secondary);
}

.searchInputField {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: var(--text-xs);
  min-width: 0;
}

.searchInputField::placeholder {
  color: var(--text-tertiary);
}

.searchInputIcon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* =============================================================================
   SELECT / DROPDOWN
   Standard select dropdown
   ============================================================================= */

.select {
  appearance: none;
  padding: var(--space-1-5) var(--space-6) var(--space-1-5) var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  color: var(--text-primary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: var(--transition-all);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-2) center;
}

.select:hover {
  border-color: var(--text-tertiary);
}

.select:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px var(--border-focus);
}

.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================================
   CHECKBOX
   Standard checkbox
   ============================================================================= */

.checkbox {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-all);
  flex-shrink: 0;
}

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

.checkbox:checked {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.checkbox:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

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

/* Checkbox with label container */
.checkboxLabel {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--text-primary);
}

/* =============================================================================
   RADIO BUTTON
   Standard radio button
   ============================================================================= */

.radio {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-all);
  flex-shrink: 0;
}

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

.radio:checked {
  background: var(--bg-tertiary);
  border-color: var(--accent-secondary);
  border-width: 4px;
}

.radio:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.radio:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================================
   TEXTAREA
   Multi-line text input
   ============================================================================= */

.textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-family: inherit;
  resize: vertical;
  transition: var(--transition-all);
}

.textarea::placeholder {
  color: var(--text-tertiary);
}

.textarea:hover {
  border-color: var(--text-tertiary);
}

.textarea:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px var(--border-focus);
}

.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  resize: none;
}

/* =============================================================================
   FORM GROUP
   Label + input wrapper
   ============================================================================= */

.formGroup {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.formLabel {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.formLabelRequired::after {
  content: ' *';
  color: var(--status-error);
}

.formHint {
  font-size: 10px;
  color: var(--text-tertiary);
}

.formError {
  font-size: 10px;
  color: var(--status-error);
}

/* Input error state */
.textInput.inputError,
.select.inputError,
.textarea.inputError {
  border-color: var(--status-error);
}

.textInput.inputError:focus,
.select.inputError:focus,
.textarea.inputError:focus {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
