/* ── Modal ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(400px, 90vw);
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-content.settings {
  width: min(520px, 92vw);
}

.modal-content.trash {
  width: min(560px, 94vw);
  max-height: min(620px, 90vh);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

.modal-input {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}

.modal-input::placeholder {
  color: var(--text-tertiary);
}

.modal-textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 12px 16px 16px;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}

.modal-textarea::placeholder {
  color: var(--text-tertiary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.settings-body {
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 12px 14px;
  gap: 16px;
}

.settings-row .settings-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 65%;
}

.settings-row .settings-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-row .settings-description {
  font-size: 13px;
  color: var(--text-tertiary);
}

.settings-row.settings-theme-select {
  align-items: center;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.settings-select {
  appearance: none;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-select:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px var(--accent-secondary-light);
  outline: none;
}

.settings-row.settings-slider {
  align-items: center;
}

.settings-row.settings-slider .settings-info {
  max-width: 60%;
}

.settings-slider-control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.settings-slider-control input[type="range"] {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-border);
  outline: none;
}

.settings-slider-control input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-border);
}

.settings-slider-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-secondary);
  box-shadow: 0 0 0 3px var(--accent-secondary-light);
  cursor: pointer;
}

.settings-slider-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-secondary);
  border: none;
  box-shadow: 0 0 0 3px var(--accent-secondary-light);
  cursor: pointer;
}

.slider-value {
  min-width: 42px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-secondary);
}

.trash-body {
  padding: 18px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.trash-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

.trash-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trash-section-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.trash-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  gap: 16px;
}

.trash-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.trash-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.trash-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.trash-item-note {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: pre-line;
}

.btn-restore {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent-secondary);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-restore:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.btn-restore:disabled {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.25);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--accent-secondary);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

/* ── Buttons ── */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-cancel:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-save {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  border: none;
  transition: all 0.2s ease;
  box-shadow: 0 0 8px rgba(0, 217, 255, 0.2);
}

.btn-save:hover {
  box-shadow: 0 0 16px rgba(0, 217, 255, 0.4);
  transform: translateY(-2px);
}

