/* Inter font feature settings */
body { font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11'; }

/* ─── Theme Transitions ─────────────────────────────────────────────────────── */
html, body, * {
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}
/* Disable transitions on transforms/opacity to avoid sluggishness */
.btn-favorite, .range-thumb::-webkit-slider-thumb,
.animate-spin {
  transition: none !important;
}
.btn-favorite { transition: color 0.15s ease, transform 0.15s ease !important; }
.district-pill {
  transition: background-color 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease !important;
}

/* ─── Theme Toggle Sun/Moon Animation ───────────────────────────────────────── */
.theme-toggle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
}
.theme-icon {
  position: absolute;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease !important;
  line-height: 1;
}
/* Dark mode: sun visible, moon hidden */
html.dark #themeIconSun  { transform: rotate(0deg) scale(1);   opacity: 1; }
html.dark #themeIconMoon { transform: rotate(-90deg) scale(0.5); opacity: 0; }
/* Light mode: moon visible, sun hidden */
html:not(.dark) #themeIconSun  { transform: rotate(90deg) scale(0.5); opacity: 0; }
html:not(.dark) #themeIconMoon { transform: rotate(0deg) scale(1);   opacity: 1; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ─── Table Row Interactions ─────────────────────────────────────────────────── */
tbody tr { transition: background-color 0.15s ease !important; }
tbody tr.listing-row { cursor: pointer; }
tbody tr.listing-row:hover { background: rgba(99, 102, 241, 0.07) !important; }
tbody tr.listing-row:active { background: rgba(99, 102, 241, 0.12) !important; }

/* Light mode table hover */
html:not(.dark) tbody tr.listing-row:hover { background: rgba(99, 102, 241, 0.06) !important; }

/* Gone listings */
tbody tr.listing-gone { opacity: 0.4; cursor: default; }
tbody tr.listing-gone:hover { background: transparent !important; }

/* Unavailable listings — red background */
tbody tr.listing-unavailable { cursor: default; }
html:not(.dark) tbody tr.listing-unavailable {
  background-color: rgba(254, 226, 226, 0.7) !important;
}
html.dark tbody tr.listing-unavailable {
  background-color: rgba(127, 29, 29, 0.18) !important;
}
tbody tr.listing-unavailable:hover { filter: brightness(0.97); }
tbody tr.listing-unavailable .listing-strikethrough {
  text-decoration: line-through;
  text-decoration-color: rgba(148, 163, 184, 0.6);
}

/* New listing glow */
@keyframes newGlow {
  0%, 100% { box-shadow: inset 3px 0 0 #6366f1; }
  50% { box-shadow: inset 3px 0 0 #818cf8; }
}
tbody tr.listing-new { animation: newGlow 2s ease-in-out 3; box-shadow: inset 3px 0 0 #6366f1; }

/* ─── Scan Active State ───────────────────────────────────────────────────────── */
@keyframes scanPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.scan-active { animation: scanPulse 1.5s ease-in-out infinite; }

/* ─── Form Elements ──────────────────────────────────────────────────────────── */
html.dark select option { background: #1e293b; color: white; }
html:not(.dark) select option { background: #f8fafc; color: #0f172a; }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.3; }

/* Light mode inputs/selects */
html:not(.dark) input, html:not(.dark) select {
  color: #0f172a;
  background-color: #f8fafc;
}
html:not(.dark) input::placeholder { color: #64748b; }

/* ─── District Pills ─────────────────────────────────────────────────────────── */
.district-pill {
  transition: all 0.15s ease !important;
  user-select: none;
  -webkit-user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: badgeIn 0.15s ease-out;
}
.district-pill:hover { transform: translateY(-1px); }
.district-pill.active {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.district-pill .badge-remove {
  opacity: 0.6;
  transition: opacity 0.1s ease !important;
  line-height: 1;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
}
.district-pill.active .badge-remove { opacity: 0.6; }
.district-pill.active:hover .badge-remove { opacity: 1; }
.district-pill.active .badge-remove:hover { color: white; opacity: 1; }

@keyframes badgeIn {
  from { opacity: 0; transform: scale(0.85) translateY(2px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Dual-Range Slider */
.range-slider-wrap {
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
}
.range-track {
  position: absolute;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  pointer-events: none;
}
html.dark .range-track { background: rgba(51, 65, 85, 0.9); }
html:not(.dark) .range-track { background: rgba(203, 213, 225, 0.9); }

.range-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #6366f1);
  border-radius: 2px;
  pointer-events: none;
}
.range-thumb {
  position: absolute;
  width: 100%;
  height: 4px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  outline: none;
  border: none;
  padding: 0;
}
.range-thumb::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
}
.range-thumb::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6366f1;
  border: 2px solid #818cf8;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease !important;
  margin-top: -6px;
}
.range-thumb::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.2);
}
.range-thumb:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.25);
}
.range-thumb::-moz-range-track {
  background: transparent;
  height: 4px;
}
.range-thumb::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6366f1;
  border: 2px solid #818cf8;
  cursor: pointer;
  box-sizing: border-box;
  transition: box-shadow 0.1s ease !important;
}
.range-thumb::-moz-range-thumb:hover {
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.2);
}

/* Active filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  animation: badgeIn 0.15s ease-out;
}
html.dark .filter-chip {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
}
html:not(.dark) .filter-chip {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #4338ca;
}
html.dark .filter-chip:hover { background: rgba(99, 102, 241, 0.18); }
html:not(.dark) .filter-chip:hover { background: rgba(99, 102, 241, 0.14); }

.filter-chip-remove {
  display: flex;
  align-items: center;
  transition: color 0.1s ease !important;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}
html.dark .filter-chip-remove { color: rgba(165, 180, 252, 0.55); }
html:not(.dark) .filter-chip-remove { color: rgba(67, 56, 202, 0.5); }
html.dark .filter-chip-remove:hover { color: #c7d2fe; }
html:not(.dark) .filter-chip-remove:hover { color: #4338ca; }

/* Light mode inactive pills */
html:not(.dark) .district-pill:not(.active) {
  background-color: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}
html:not(.dark) .district-pill:not(.active):hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: #1e293b;
}

/* Favorite listing — green background + green border */
tbody tr.listing-favorite {
  box-shadow: inset 3px 0 0 #22c55e;
}
html:not(.dark) tbody tr.listing-favorite {
  background-color: rgba(240, 253, 244, 0.9) !important;
}
html.dark tbody tr.listing-favorite {
  background-color: rgba(20, 83, 45, 0.18) !important;
}
tbody tr.listing-favorite.listing-new {
  box-shadow: inset 3px 0 0 #22c55e;
  animation: none;
}

/* Seen listing — subtle gray (not amber) */
tbody tr.listing-seen:not(.listing-favorite):not(.listing-unavailable) {
  opacity: 0.82;
}
html:not(.dark) tbody tr.listing-seen:not(.listing-favorite):not(.listing-unavailable) {
  background-color: rgba(241, 245, 249, 0.8) !important; /* slate-100 */
}
html.dark tbody tr.listing-seen:not(.listing-favorite):not(.listing-unavailable) {
  background-color: rgba(30, 41, 59, 0.35) !important; /* slate-800/35 */
}
tbody tr.listing-seen:hover { opacity: 1 !important; }

/* Heart / favorite button */
.btn-favorite {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  color: #475569;
  transition: color 0.15s ease, transform 0.15s ease !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1rem;
}
.btn-favorite svg {
  width: 15px;
  height: 15px;
  display: block;
}
.btn-favorite i { font-size: 15px; }
.btn-favorite:hover {
  color: #22c55e;
  transform: scale(1.25);
}
.btn-favorite.active {
  color: #22c55e;
}

/* ─── Mobile Card View ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  table thead { display: none; }
  table tbody tr {
    display: block;
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
  }
  html.dark table tbody tr {
    border: 1px solid rgba(51, 65, 85, 0.5);
    background: rgba(15, 23, 42, 0.6);
  }
  html:not(.dark) table tbody tr {
    border: 1px solid rgba(203, 213, 225, 0.6);
    background: rgba(255, 255, 255, 0.8);
  }
  table tbody tr.listing-new {
    border-left: 3px solid #6366f1 !important;
    animation: none;
    box-shadow: none;
  }
  table tbody tr.listing-favorite {
    border-left: 3px solid #22c55e;
    box-shadow: none;
  }
  table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
    border: none !important;
  }
  table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  html.dark table tbody td::before { color: #64748b; }
  html:not(.dark) table tbody td::before { color: #94a3b8; }
  /* Hide Eigenmittel on mobile */
  table tbody td:nth-child(7) { display: none; }
  /* Heart column: show but no label */
  table tbody td:nth-child(9)::before { display: none; }
  table tbody td:nth-child(9) { justify-content: flex-end; }
}

/* ─── Loading State ──────────────────────────────────────────────────────────── */
.loading tbody { opacity: 0.3; pointer-events: none; }

/* ─── Tooltip ────────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  font-size: 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}
html.dark [data-tooltip]:hover::after {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
}
html:not(.dark) [data-tooltip]:hover::after {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ─── Stats Bar (light mode) ─────────────────────────────────────────────────── */
html:not(.dark) .stats-total-badge {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

/* ─── Gradient Text ──────────────────────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Focus Ring Utility ─────────────────────────────────────────────────────── */
*:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: 2px;
}

/* ─── Login shake animation ──────────────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ─── Filter Panel Animation ─────────────────────────────────────────────────── */
#filterPanel {
  overflow: hidden;
  max-height: 2000px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, border-color 0.25s ease !important;
}
#filterPanel.panel-collapsed {
  max-height: 0;
  opacity: 0;
  border-top-color: transparent !important;
}

/* ─── Stats Bar Badges ───────────────────────────────────────────────────────── */
#statsBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
/* Better contrast for source badges in light mode */
html:not(.dark) #statsBar span[onclick] {
  filter: saturate(1.3);
}
html:not(.dark) #statsBar span[onclick] {
  background-color: rgba(0,0,0,0.05) !important;
}

/* ─── Sort Toggle Button — match select height ───────────────────────────────── */
#sortOrderBtn {
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─── Admin Toggle Button ────────────────────────────────────────────────────── */
.admin-toggle-btn {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease !important;
}
html:not(.dark) .admin-toggle-btn {
  background-color: rgba(255, 255, 255, 0.9);
  color: #374151;
  border-color: #d1d5db;
}
html:not(.dark) .admin-toggle-btn:hover {
  color: #111827;
  border-color: rgba(99, 102, 241, 0.5);
  background-color: #fff;
}
.admin-toggle-active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(99, 102, 241, 0.15)) !important;
  border-color: rgba(99, 102, 241, 0.5) !important;
  color: #a5b4fc !important;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}
html:not(.dark) .admin-toggle-active {
  color: #4338ca !important;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(99, 102, 241, 0.08)) !important;
}

/* ── Admin Tabs Container ── */
.admin-tabs-container {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 0.75rem;
  padding: 4px;
}
html:not(.dark) .admin-tabs-container {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(203, 213, 225, 0.9);
}

/* ── Admin Tabs ── */
.admin-tab {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease !important;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
html.dark .admin-tab { color: #9ca3af; }
html:not(.dark) .admin-tab { color: #4b5563; }
html.dark .admin-tab:hover { color: #d1d5db; background: rgba(255,255,255,0.05); }
html:not(.dark) .admin-tab:hover { color: #111827; background: rgba(0,0,0,0.05); }
.admin-tab.active {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white !important;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

/* ── Admin Cards ── */
.admin-card {
  border-radius: 0.75rem;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s ease !important;
}
html.dark .admin-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
}
html:not(.dark) .admin-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(203, 213, 225, 0.8);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
html.dark .admin-card:hover { border-color: rgba(99, 102, 241, 0.3); }
html:not(.dark) .admin-card:hover { border-color: rgba(99, 102, 241, 0.4); }

/* ── Admin Panel Box (large panels) ── */
.admin-panel-box {
  border-radius: 0.75rem;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
html.dark .admin-panel-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
}
html:not(.dark) .admin-panel-box {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(203, 213, 225, 0.8);
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

/* ── Admin Table Rows ── */
.admin-table-row { transition: background 0.1s ease !important; }
html.dark .admin-table-row:hover { background: rgba(99, 102, 241, 0.06) !important; }
html:not(.dark) .admin-table-row:hover { background: rgba(99, 102, 241, 0.04) !important; }

/* ── Admin Inputs ── */
.admin-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}
html.dark .admin-input {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.8);
  color: white;
}
html:not(.dark) .admin-input {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}
.admin-input:focus {
  border-color: rgba(99,102,241,0.6);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
html.dark .admin-input::placeholder { color: #4b5563; }
html:not(.dark) .admin-input::placeholder { color: #94a3b8; }

/* ── Buttons ── */
.btn-primary {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease !important;
  white-space: nowrap;
}
.btn-primary:hover { background: linear-gradient(135deg, #6366f1, #818cf8); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease !important;
  white-space: nowrap;
}
html.dark .btn-secondary {
  background: rgba(30, 41, 59, 0.6);
  color: #9ca3af;
  border: 1px solid rgba(51, 65, 85, 0.8);
}
html:not(.dark) .btn-secondary {
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #cbd5e1;
}
html.dark .btn-secondary:hover { color: white; border-color: rgba(99,102,241,0.4); background: rgba(30,41,59,0.9); }
html:not(.dark) .btn-secondary:hover { color: #111827; border-color: rgba(99,102,241,0.4); background: #e2e8f0; }

/* ── Action Buttons in Table ── */
.action-btn {
  padding: 0.375rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease !important;
}
html.dark .action-btn {
  border: 1px solid rgba(51,65,85,0.6);
  background: rgba(30,41,59,0.5);
  color: #6b7280;
}
html:not(.dark) .action-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #6b7280;
}
html.dark .action-btn:hover { color: #a5b4fc; border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.1); }
html:not(.dark) .action-btn:hover { color: #4338ca; border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.08); }
.action-btn-warn:hover { color: #fbbf24 !important; border-color: rgba(251,191,36,0.4) !important; background: rgba(251,191,36,0.1) !important; }
.action-btn-danger:hover { color: #f87171 !important; border-color: rgba(248,113,113,0.4) !important; background: rgba(248,113,113,0.1) !important; }

/* ── Role Badges ── */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}
.role-admin {
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139,92,246,0.3);
}
html:not(.dark) .role-admin {
  background: rgba(139,92,246,0.1);
  color: #6d28d9;
  border-color: rgba(139,92,246,0.3);
}
.role-user {
  background: rgba(71,85,105,0.3);
  color: #94a3b8;
  border: 1px solid rgba(71,85,105,0.5);
}
html:not(.dark) .role-user {
  background: rgba(71,85,105,0.08);
  color: #475569;
  border-color: rgba(71,85,105,0.3);
}

/* ── Audit Action Badges ── */
.audit-action {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}
.audit-action-ok  { background: rgba(52,211,153,0.1); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }
.audit-action-err { background: rgba(248,113,113,0.1); color: #fca5a5; border: 1px solid rgba(248,113,113,0.2); }
.audit-action-warn { background: rgba(251,191,36,0.1); color: #fde68a; border: 1px solid rgba(251,191,36,0.2); }
.audit-action-info { background: rgba(99,102,241,0.1); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }
html:not(.dark) .audit-action-ok  { color: #059669; }
html:not(.dark) .audit-action-err { color: #dc2626; }
html:not(.dark) .audit-action-warn { color: #d97706; }
html:not(.dark) .audit-action-info { color: #4338ca; }

/* ── View Transition ── */
#adminView { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Light Mode Input/Select/Checkbox Contrast ──────────────────────────────── */
html:not(.dark) select,
html:not(.dark) input[type="text"],
html:not(.dark) input[type="password"],
html:not(.dark) input[type="number"] {
  background-color: #fff;
  color: #0f172a;
  border-color: #cbd5e1;
}
html:not(.dark) select:focus,
html:not(.dark) input:focus {
  background-color: #fff;
  border-color: rgba(99, 102, 241, 0.6);
}
/* Checkbox accent color */
input[type="checkbox"] {
  accent-color: #6366f1;
  width: 0.875rem;
  height: 0.875rem;
}

/* ─── Slider Track Visibility (Light Mode) ───────────────────────────────────── */
html:not(.dark) .range-track {
  background: #d1d5db !important; /* gray-300 — clearly visible */
}
html:not(.dark) .range-fill {
  background: linear-gradient(90deg, #4f46e5, #6366f1);
}
/* Kill the native browser track so only our custom track shows */
.range-thumb::-webkit-slider-runnable-track {
  background: transparent !important;
  height: 4px;
}
.range-thumb::-moz-range-track {
  background: transparent !important;
  height: 4px;
}

/* ─── PIN Eye-Toggle Button ──────────────────────────────────────────────────── */
.pin-wrap {
  position: relative;
}
.pin-eye-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: #94a3b8;
  transition: color 0.15s ease !important;
}
.pin-eye-btn:hover { color: #6366f1; }
html.dark .pin-eye-btn { color: #4b5563; }
html.dark .pin-eye-btn:hover { color: #a5b4fc; }

/* ─── Mobile Responsive Improvements ────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Filter grid: 1 column on mobile */
  #filterPanel .grid.grid-cols-1.sm\\:grid-cols-3 {
    grid-template-columns: 1fr;
  }
  #filterPanel .grid.grid-cols-2 {
    grid-template-columns: 1fr;
  }
  /* Sort bar: wrap tighter */
  #listingsBody ~ * .flex.items-center.gap-3 {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  /* Stats bar: smaller badges */
  #statsBar span {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
  }
}
