/* ── Base inputs ── */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
input[type="password"],
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  font-family: var(--font-body);
  width: 100%;
  outline: none;
  transition: border-color var(--speed);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

input[readonly],
input.readonly {
  background: var(--bg-warm);
  color: var(--gold);
  font-weight: 600;
  cursor: default;
}

textarea { resize: vertical; }

/* ── Form layout helpers ── */

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: var(--font-body);
}

.form-field { display: flex; flex-direction: column; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-full { grid-column: 1 / -1; }

/* ── Range slider ── */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  padding: 0;
  border: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  cursor: pointer;
}

/* ── Input prefix (e.g. $ symbol) ── */

.input-prefix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
  line-height: 1;
}

.input-prefix-wrap > input { padding-left: 22px; }

/* ── Password reveal toggle ── */

.input-password-wrap {
  position: relative;
}

.input-password-wrap input { padding-right: 38px; }

.input-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

/* ── Tag / pill input (states, medications) ── */

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  min-height: 40px;
  cursor: text;
}

.tag-input-wrap:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gold-soft);
  border: 1px solid rgba(181,137,58,0.30);
  color: var(--gold);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-pill .tag-remove {
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  color: var(--gold);
  margin-left: 2px;
}

.tag-input-wrap input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  flex: 1;
  min-width: 80px;
  padding: 0;
}

/* ── Medication typeahead ── */

.typeahead-wrap { position: relative; }

.typeahead-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb),0.10);
  z-index: 600;
  max-height: 180px;
  overflow-y: auto;
}

.typeahead-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.typeahead-item:hover { background: var(--gold-soft); color: var(--gold); }

/* Secondary detail on a typeahead row — the carrier beside a client's name in
   the "Referred By" picker. Dimmed so the name stays the thing you scan for. */
.typeahead-meta {
  color: var(--text-dim);
  font-size: 12px;
  margin-left: 6px;
}

/* ── File drop zone ── */

.file-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-control);
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed), color var(--speed);
}

.file-dropzone:hover,
.file-dropzone.drag-over {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}

.file-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--bg-warm);
  border-radius: 4px;
}

.file-item-remove {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  background: none;
  border: none;
  padding: 0 2px;
  line-height: 1;
}

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

/* ── Status select with color indicator ── */

.status-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-select-wrap select { flex: 1; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}

/* ── State filterable combobox ── */

.state-combobox { position: relative; }

.state-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb),0.10);
  z-index: 700;
  max-height: 200px;
  overflow-y: auto;
}

.state-option {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-body);
}

.state-option:hover { background: var(--gold-soft); color: var(--gold); }
