:root {
  --bs-font-sans-serif: "Inter", system-ui, sans-serif;
  --wb-color: #9438ff;
  --wb-bg-subtle: rgba(148, 56, 255, 0.15);
  --wb-border-subtle: rgba(148, 56, 255, 0.35);
  --wb-text: #8222e4;

  --model-bg: #fef3c7;
  --model-color: #92400e;
  --model-border: #fcd34d;
}

[data-bs-theme="dark"] {
  --wb-bg-subtle: rgba(148, 56, 255, 0.25);
  --wb-border-subtle: rgba(148, 56, 255, 0.5);
  --wb-text: #c482ff;

  --model-bg: rgba(245, 158, 11, 0.22);
  --model-color: #fbbf24;
  --model-border: rgba(245, 158, 11, 0.45);
}

/* Base card styling */
.card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Dark theme specific background, cards and borders */
[data-bs-theme="dark"] body {
  background-color: #161b22;
}

[data-bs-theme="dark"] .card {
  background-color: #21262d !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-bs-theme="dark"] .table-light {
  --bs-table-bg: #272d34;
  --bs-table-color: #f0f6fc;
  color: #f0f6fc !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background-color: #161b22;
  border-color: rgba(255, 255, 255, 0.2);
  color: #f0f6fc;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #161b22;
  border-color: var(--bs-primary);
  color: #f0f6fc;
}

[data-bs-theme="dark"] .nav-pills .nav-link.bg-body-secondary {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .bg-body-tertiary {
  background-color: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Marketplace badge: Wildberries */
.badge-wildberries {
  background-color: var(--wb-bg-subtle);
  color: var(--wb-text);
  border: 1px solid var(--wb-border-subtle);
}

/* Accent badge for Model / SKU */
.badge-model {
  display: inline-flex;
  align-items: center;
  font-family: var(--bs-font-monospace);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background-color: var(--model-bg);
  color: var(--model-color);
  border: 1px solid var(--model-border);
  vertical-align: middle;
  line-height: 1.2;
}

/* Uniform action icon buttons across tables */
.btn-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1;
}

/* High contrast secondary and muted text across themes */
.text-secondary {
  color: #475569 !important;
}

[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-muted {
  color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
  border-color: rgba(255, 255, 255, 0.22);
  color: #e2e8f0;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.flash-messages {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, calc(100% - 32px));
  z-index: 1090;
  pointer-events: none;
}

.flash-messages .alert {
  pointer-events: auto;
  overflow-wrap: anywhere;
}

/* Sidebar responsive layout */
.app-sidebar {
  --bs-offcanvas-width: 270px;
}

@media (min-width: 768px) {
  .app-sidebar {
    width: 260px !important;
    min-width: 260px;
    max-width: 260px;
    height: calc(100vh - 57px);
    position: sticky;
    top: 57px;
    z-index: 1020;
  }
}

.app-sidebar .sidebar-heading {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.app-sidebar .nav-link {
  transition: background-color 0.15s ease, color 0.15s ease;
  font-size: 0.92rem;
}

.app-sidebar .nav-link:hover:not(.active) {
  background-color: var(--bs-tertiary-bg);
}

.app-sidebar .nav-link.active {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
  font-weight: 600;
}

.app-sidebar .nav-link.active i {
  color: var(--bs-primary) !important;
}
