textarea:focus,
.mapping-row input[type="text"]:focus,
.mapping-search-input:focus {
  border-color: rgba(25, 118, 210, 0.62);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.12);
}

textarea[readonly] {
  background: #fbfcfe;
  cursor: copy;
}

textarea[readonly]:hover {
  border-color: rgba(25, 118, 210, 0.42);
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.mapping-row:hover {
  border-color: rgba(25, 118, 210, 0.35);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.mapping-row input[type="text"] {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-main);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.drag-handle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(25, 118, 210, 0.14);
  background: #fff;
  color: var(--text-muted);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  touch-action: none;
  cursor: grab;
  flex-shrink: 0;
}

.drag-handle span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.drag-handle:hover {
  border-color: rgba(25, 118, 210, 0.3);
  background: rgba(25, 118, 210, 0.05);
  color: var(--primary);
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.drag-handle:disabled:hover {
  border-color: rgba(25, 118, 210, 0.14);
  background: #fff;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 28px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-slider {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.12);
}

.button {
  min-height: 44px;
  padding: 0 16px;
}

.mapping-search-input {
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-main);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.mapping-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.language-switcher select {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-main);
  font: inherit;
  outline: none;
}

.language-switcher select:focus {
  border-color: rgba(25, 118, 210, 0.62);
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.12);
}

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(25, 118, 210, 0.2);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid rgba(25, 118, 210, 0.18);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.button-secondary:hover {
  background: rgba(25, 118, 210, 0.06);
  border-color: rgba(25, 118, 210, 0.32);
}

.mapping-row .delete-button {
  min-height: 44px;
  padding: 0 16px;
  background: var(--danger-soft);
  color: var(--danger-text);
}

#mappings {
  margin-bottom: 16px;
}

#mappings:empty::before {
  content: attr(data-empty-text);
  display: block;
  padding: 16px 20px;
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text-muted);
}

.status-message {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: calc(100vw - 48px);
  max-width: 320px;
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.status-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body.is-sorting-active {
  user-select: none;
  cursor: grabbing;
}

body.is-sorting-active .drag-handle {
  cursor: grabbing;
}

.mapping-row-chosen {
  border-color: rgba(25, 118, 210, 0.45);
  background: #f8fbff;
  box-shadow: 0 12px 28px rgba(25, 118, 210, 0.16);
}

.mapping-row-drag {
  border-color: rgba(25, 118, 210, 0.45);
  background: #f8fbff;
  box-shadow: 0 18px 36px rgba(25, 118, 210, 0.22);
  transform: rotate(0.3deg) scale(1.01);
}

.mapping-row-ghost {
  opacity: 0.22;
  background: rgba(25, 118, 210, 0.06);
  border-style: dashed;
}

@media (max-width: 800px) {
  .mapping-row {
    flex-wrap: wrap;
  }

  .mapping-row input[type="text"] {
    flex-basis: 100%;
  }

  .mapping-row .delete-button {
    width: 100%;
  }

  .drag-handle {
    width: 100%;
  }

  .status-message {
    right: 12px;
    left: 12px;
    bottom: 16px;
    max-width: none;
  }
}
