/* ─────────────────────────────────────────────────────────────────────── */
/* Input Component — Text, Textarea, Select Fields                          */
/* ─────────────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────────── */
/* Base Input Styles (covered in base.css, extended here)                   */
/* ─────────────────────────────────────────────────────────────────────── */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="search"],
textarea,
select {
  width: 100%;
  color: var(--text);
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition-colors);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Input Focus State                                                         */
/* ─────────────────────────────────────────────────────────────────────── */

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Input Group (label + input wrapper)                                      */
/* ─────────────────────────────────────────────────────────────────────── */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-label.required::after {
  content: "*";
  color: var(--t-bug);
}

.input-help {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-mute);
  margin-top: -4px;
}

.input-error {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--t-bug);
  margin-top: -4px;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Error State                                                               */
/* ─────────────────────────────────────────────────────────────────────── */

.input-group.error input,
.input-group.error textarea,
.input-group.error select {
  border-color: var(--t-bug);
  background-color: var(--t-bug-bg);
}

.input-group.error input:focus,
.input-group.error textarea:focus,
.input-group.error select:focus {
  box-shadow: 0 0 0 3px rgba(var(--t-bug-rgb), 0.1);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Textarea                                                                  */
/* ─────────────────────────────────────────────────────────────────────── */

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
  font-family: var(--font-body);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Select (dropdown)                                                         */
/* ─────────────────────────────────────────────────────────────────────── */

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
}

html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%9ca3af' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Checkbox & Radio (custom styling)                                        */
/* ─────────────────────────────────────────────────────────────────────── */

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Checkbox Group                                                            */
/* ─────────────────────────────────────────────────────────────────────── */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-item input {
  cursor: pointer;
}

.checkbox-item label {
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Range Input                                                               */
/* ─────────────────────────────────────────────────────────────────────── */

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: var(--transition-colors);
}

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

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-h);
}

input[type="range"]::-moz-range-thumb:hover {
  background: var(--accent-h);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Disabled State                                                            */
/* ─────────────────────────────────────────────────────────────────────── */

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--bg-1);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Placeholder                                                               */
/* ─────────────────────────────────────────────────────────────────────── */

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

/* ─────────────────────────────────────────────────────────────────────── */
/* Search Input (with icon)                                                 */
/* ─────────────────────────────────────────────────────────────────────── */

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

.input-search::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  font-size: 14px;
  pointer-events: none;
}

.input-search input {
  padding-left: 32px;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Inline Edit (for card titles, metadata)                                  */
/* ─────────────────────────────────────────────────────────────────────── */

.inline-edit {
  position: relative;
  display: inline-block;
}

.inline-edit-display {
  padding: 4px 0;
  cursor: text;
  border-bottom: 1px dashed transparent;
  transition: border-color var(--transition-colors);
}

.inline-edit.editing .inline-edit-display {
  display: none;
}

.inline-edit-input {
  display: none;
  padding: 4px 6px;
  border: 1px solid var(--focus-border);
  border-radius: 4px;
}

.inline-edit.editing .inline-edit-input {
  display: block;
}
