/*
 * Tell Chrome/Edge which scheme the admin is using.
 * Without this, "Auto Dark Mode for Web Contents" can paint a near-black panel
 * on light pages when the OS theme is dark.
 */
html,
html.light {
  color-scheme: light;
}
html.dark {
  color-scheme: dark;
}

/* Header Light / Dark toggle (top-right) */
.icam-admin-theme-switch {
  display: flex;
  align-items: center;
}

.icam-theme-toggle {
  display: inline-flex;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0.15rem;
  border: 1px solid color-mix(in oklch, var(--admin-border, #e2e8f0), transparent 0%);
  border-radius: 999px;
  background: color-mix(in oklch, var(--admin-surface, #ffffff), var(--admin-accent-soft, #ecfdf5) 35%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.icam-theme-toggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 1.9rem;
  padding: 0.25rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.icam-theme-toggle__btn .material-symbols-outlined {
  font-size: 1.05rem !important;
  line-height: 1 !important;
}

.icam-theme-toggle__btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.icam-theme-toggle__btn:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--admin-primary, #0d9488), transparent 35%);
  outline-offset: 1px;
}

.icam-theme-toggle__btn.is-active {
  background: #ffffff;
  color: color-mix(in oklch, var(--admin-primary, #0d9488), black 8%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

html.dark .icam-theme-toggle {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
}

html.dark .icam-theme-toggle__btn {
  color: #94a3b8;
}

html.dark .icam-theme-toggle__btn:hover {
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.85);
}

html.dark .icam-theme-toggle__btn.is-active {
  background: #1e293b;
  color: #5eead4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
  .icam-theme-toggle__label {
    display: none;
  }

  .icam-theme-toggle__btn {
    padding: 0.3rem 0.55rem;
  }
}

/* Admin Appearance page — inline Light / Dark row */
.appearance-panel--display-mode {
  margin-top: 1.25rem;
}

.appearance-display-mode .border-b,
.appearance-display-mode .icam-theme-mode-switch {
  border: 1px solid var(--admin-border, #e5e7eb) !important;
  border-radius: var(--admin-radius, 0.75rem) !important;
  background: #fff !important;
  padding: 0.35rem !important;
  margin: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem !important;
}

.appearance-display-mode a {
  justify-content: center !important;
  border-radius: calc(var(--admin-radius, 0.75rem) * 0.85) !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

.appearance-display-mode a .material-symbols-outlined {
  font-size: 1.05rem !important;
}

/* Keep sidebar user-menu theme popup above section cards */
#nav-sidebar-inner > .border-t {
  overflow: visible !important;
  position: relative;
  z-index: 40;
}

#nav-sidebar-inner > .border-t > nav {
  z-index: 50;
  min-width: 12.5rem;
}

#nav-sidebar-inner > .border-t > nav .icam-theme-mode-switch {
  border: 0 !important;
  margin: 0.15rem 0 0.35rem !important;
  padding: 0.15rem 0.25rem 0.35rem !important;
  gap: 0.15rem !important;
}

#nav-sidebar-inner > .border-t > nav .icam-theme-mode-switch a {
  width: 100%;
  min-height: 2.25rem;
  white-space: nowrap;
}

#nav-sidebar-inner > .border-t > nav .icam-theme-mode-switch a .material-symbols-outlined {
  flex: 0 0 auto;
}
