/*
 * assets/css/forms.css — reusable form-control components for every
 * redesigned screen that has a form outside the auth card (app.css
 * already covers login's .field/.btn pattern for the standalone auth
 * layout). Built on the tokens in tokens.css only -- no raw colors --
 * so it re-themes and re-brands the same way everything else does.
 *
 * Classes here are deliberately generic (.form-group, .form-label,
 * .form-control, .form-select, .form-textarea, .form-check,
 * .form-file, .form-help, .form-actions, .btn-secondary/.btn-outline,
 * .alert-success) so every future form migration (create/edit
 * screens) can reuse them without inventing new component CSS per
 * page. Extend this file rather than writing page-specific form CSS.
 */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.form-control,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.form-control:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.25a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
}

/* Color swatch input -- native <input type="color">, styled to sit
   inline with a readable hex value next to it (used by pages that
   store a hex color string, e.g. site branding theme colors). */
.form-color-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.form-color-row input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}
.form-color-row .form-control { max-width: 140px; }

/* File input -- plain native control, styled to match the rest of the
   form system instead of pulling in a JS plugin (bs-custom-file-input
   etc.) just to relabel it. */
.form-file {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 13px;
}
.form-file:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}
.form-check label {
  font-size: 14px;
  color: var(--color-text);
}

.form-help {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--color-text-muted);
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ---- Buttons (extends app.css's .btn/.btn-primary) ---- */

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
}

.btn-outline-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

/* app.css's .btn defaults to width:100% for the auth layout; form
   buttons inside a card should size to content instead. */
.card .btn,
.form-actions .btn {
  width: auto;
}

/* ---- Alerts (extends app.css's .alert/.alert-danger) ---- */

.alert-success {
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
  color: var(--color-success);
  border: 1px solid color-mix(in srgb, var(--color-success) 35%, transparent);
}

.alert-dismissible {
  position: relative;
  padding-right: var(--space-8);
}
.alert-dismissible .close {
  position: absolute;
  top: 50%;
  right: var(--space-3);
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: var(--space-1);
}
.alert-dismissible .close:hover { opacity: 1; }
