/* ── Modal ──────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 650px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  color: var(--text);
}

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input,
.form-textarea {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  width: 100%;
}

.form-input[type="range"] {
  padding: 0;
  cursor: pointer;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ── Type selection step ─────────────────────────────────── */

.modal-type-select {
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-type-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.modal-type-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4rem 2rem;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.type-card:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.type-card-icon {
  font-size: 32px;
  line-height: 1;
}

.type-card-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.type-card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Modal header back button ────────────────────────────── */

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-back {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px 0 0;
}

.modal-back:hover {
  color: var(--text);
}

/* ── Web search toggle ───────────────────────────────────── */

.form-group-toggle {
  padding: 12px 0 4px;
  border-top: 1px solid var(--border);
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 16px;
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toggle-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-switch {
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-switch.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch.on .toggle-knob {
  transform: translateX(18px);
}