:root {
  --sand: #fbf7f4;
  --ink: #1f2328;
  --muted: #6c757d;
  --border: #e5e7eb;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: inherit;
  color: var(--ink);
}

.bg-sand {
  background: #f9fafb;
}

.btn-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: #374151;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 6px 10px;
  border-radius: 10px;
}

.btn.btn-ghost {
  border-color: transparent;
}

.btn-ghost:hover {
  background: #f3f4f6;
}

.btn-ghost:active,
.btn-ghost:focus,
.btn-ghost:focus-visible,
.btn.btn-ghost:active,
.btn.btn-ghost:focus,
.btn.btn-ghost:focus-visible {
  background: #f3f4f6;
  border-color: transparent !important;
  outline: none;
  box-shadow: none;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-primary:active,
.btn-primary:focus {
  background: #1e40af;
  border-color: #1e40af;
  box-shadow: none;
}

.btn-outline-secondary {
  border-color: #d1d5db;
  color: #374151;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:active,
.btn-outline-secondary:focus {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
  box-shadow: none;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #374151;
}

.icon-button:hover {
  background: #f3f4f6;
}

.icon-button:active,
.icon-button:focus,
.icon-button:focus-visible {
  background: #f3f4f6;
  border-color: transparent;
  box-shadow: none;
}

.icon-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-xs {
  width: 14px;
  height: 14px;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-md {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 28px;
  height: 28px;
}

.toggle-pill {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: #e5e7eb;
  position: relative;
}

.toggle-pill span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 999px;
  transition: transform 0.2s ease;
}

.toggle-pill.is-active {
  background: #2563eb;
}

.toggle-pill.is-active span {
  transform: translateX(20px);
}

.add-collection-search {
  position: relative;
  padding: 12px 20px 8px;
  background: #fff;
}

.add-collection-search.px-0 {
  padding-left: 0;
  padding-right: 0;
}

.add-collection-search .icon-sm {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-45%);
  color: #9ca3af;
}

.add-collection-search.px-0 .icon-sm {
  left: 10px;
}

.add-collection-search .form-control {
  height: 38px;
  padding: 0.375rem 0.75rem 0.375rem 36px;
  border-radius: 10px;
  border-color: #d1d5db;
  background: #fff;
}

.add-collection-search.px-0 .form-control {
  padding-left: 32px;
}

.custom-dropdown.dropdown-menu-end {
  right: 0;
  left: auto;
}

.add-collection-success {
  display: none;
  margin: 12px 24px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.85rem;
  align-items: center;
  gap: 8px;
}

.add-collection-success.is-visible {
  display: inline-flex;
}

.add-collection-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 20px 16px;
  background: #f9fafb;
}

.add-collection-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-align: left;
}

.add-collection-row:last-child {
  margin-bottom: 0;
}

.add-collection-row:hover {
  background: #f3f4f6;
}

.add-collection-row.is-selected {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.add-collection-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #d1d5db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.add-collection-row.is-selected .add-collection-check {
  background: #2563eb;
  border-color: #2563eb;
}

.add-collection-check .icon-xs {
  opacity: 0;
}

.add-collection-row.is-selected .add-collection-check .icon-xs {
  opacity: 1;
}

.add-collection-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
}

.add-collection-meta {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
}

.add-collection-badge {
  margin-left: auto;
  font-size: 0.72rem;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 8px;
  border-radius: 999px;
  display: none;
  white-space: nowrap;
}

.add-collection-badge.is-visible {
  display: inline-flex;
}

/* Bootstrap modal refinements */
.modal-backdrop.show {
  opacity: 1;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-content {
  border-radius: 18px !important;
  border: 1px solid #e5e7eb;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  background-clip: padding-box;
}

.modal-header {
  align-items: flex-start;
  padding: 24px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.btn-close {
  width: 0.7rem !important;
  height: 0.7rem !important;
  padding: 0.35rem !important;
  background-size: 0.7rem 0.7rem;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding-right: 24px;
  padding-left: 24px;
}

/* Toast */
.app-toast {
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
  transform: translateY(-16px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  position: relative;
  --toast-accent: #22c55e;
  --toast-bg: #111827;
  --toast-text: #ffffff;
  --toast-border: transparent;
  --toast-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
  background: var(--toast-bg) !important;
  color: var(--toast-text);
  border: 1px solid var(--toast-border);
  box-shadow: var(--toast-shadow);
  z-index: 6000;
}

.app-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.app-toast .toast-body {
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 400;
}

.app-toast-icon {
  border-radius: 8px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-toast-icon.is-success {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
}

.app-toast-icon.is-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

.app-toast-icon.is-info {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.2);
}

.app-toast-icon.is-warn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.2);
}

.app-toast.toast-variant-1 {
  --toast-bg: var(--toast-accent);
  --toast-text: #ffffff;
  --toast-border: var(--toast-accent);
  --toast-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
  color: #ffffff !important;
}

.app-toast.toast-variant-1 .app-toast-icon {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
}

.app-toast.toast-variant-2 {
  --toast-bg: #ffffff;
  --toast-text: #111827;
  --toast-border: var(--toast-accent);
  --toast-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
  color: #111827 !important;
}

.app-toast.is-success {
  --toast-accent: #22c55e;
}

.app-toast.is-error {
  --toast-accent: #ef4444;
}

.app-toast.is-info {
  --toast-accent: #22d3ee;
}

.app-toast.is-warn {
  --toast-accent: #f59e0b;
}

.autogrow-textarea {
  overflow: hidden;
  resize: none;
}
