/* ============================================================
   FORM — input fields, labels, helper text, validation states
   Used on Settings, Auth, Sportsbook bet slip, etc.
   ============================================================ */

/* Form container */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-section__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.form-section__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.form-section__description {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: var(--leading-snug);
}

/* Form row — 2 fields side-by-side on desktop */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

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

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

@media (max-width: 720px) {
  .form-row,
  .form-row--3col {
    grid-template-columns: 1fr;
  }
}

/* Field group */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.field__label-required {
  color: var(--color-danger);
  margin-left: 2px;
}

.field__input,
.field__select,
.field__textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  height: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field__textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-3);
  resize: vertical;
  line-height: var(--leading-snug);
}

.field__input::placeholder,
.field__textarea::placeholder {
  color: var(--text-tertiary);
}

.field__input:hover:not(:disabled):not(:focus),
.field__select:hover:not(:disabled):not(:focus),
.field__textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--text-tertiary);
}

.field__input:focus,
.field__select:focus,
.field__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.field__input:disabled,
.field__select:disabled {
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Select arrow */
.field__select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: calc(var(--space-3) * 2 + 14px);
}

/* Helper / error / success */
.field__helper {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-snug);
}

.field--error .field__input,
.field--error .field__select,
.field--error .field__textarea {
  border-color: var(--color-danger);
}
.field--error .field__input:focus,
.field--error .field__select:focus,
.field--error .field__textarea:focus {
  box-shadow: 0 0 0 3px var(--color-danger-subtle);
}
.field--error .field__helper {
  color: var(--color-danger-text);
}

.field--success .field__input,
.field--success .field__select {
  border-color: var(--color-success);
}
.field--success .field__helper {
  color: var(--color-success-text);
}

/* Field with leading addon (e.g. "+1" for phone, "@" for username) */
.field__input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.field__input-addon {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.field__input-wrap .field__input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
  flex: 1;
  min-width: 0;
}

/* Right-side affix (e.g. "@example.com") */
.field__input-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.field__input-wrap--has-suffix .field__input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
