/* Theme panel + day/night toggle */

.feres-theme-wrap {
  display: inline-flex;
}

.feres-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.feres-theme-panel {
  width: min(300px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.feres-theme-panel__label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.feres-theme-custom-slot {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: rgba(248, 250, 252, 0.75);
}

.feres-theme-custom-slot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0.55rem;
  font-size: 0.86rem;
}

.feres-theme-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.feres-theme-color {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 0.75rem;
  color: #475569;
}

.feres-theme-color input[type="color"] {
  width: 100%;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
}

.feres-mode-toggle {
  width: 36px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.feres-mode-toggle[aria-pressed="true"] {
  background: rgba(86, 174, 87, 0.14);
  border-color: rgba(86, 174, 87, 0.45);
  color: var(--admin-accent, #56ae57);
}

html[data-ui-mode="dark"] .feres-theme-panel {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

html[data-ui-mode="dark"] .feres-theme-panel__label,
html[data-ui-mode="dark"] .feres-theme-color {
  color: #94a3b8;
}

html[data-ui-mode="dark"] .feres-theme-custom-slot {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-ui-mode="dark"] .feres-theme-color input[type="color"] {
  border-color: #475569;
  background: #0f172a;
}

/* ── Dark mode (system-wide) ── */
html[data-ui-mode="dark"] {
  color-scheme: dark;
  --content-canvas-bg: #0b1220;
  --content-page-bg: #0f172a;
  --content-card-bg: rgba(30, 41, 59, 0.82);
  --content-heading: #e2e8f0;
  --content-table-header-bg: rgba(30, 41, 59, 0.9);
  --content-table-header-border: rgba(255, 255, 255, 0.08);
  --content-table-row-hover: rgba(86, 174, 87, 0.12);
  --content-topbar-1: rgba(15, 23, 42, 0.88);
  --content-topbar-2: rgba(15, 23, 42, 0.82);
  --content-topbar-3: rgba(30, 41, 59, 0.78);
  --content-topbar-border: rgba(255, 255, 255, 0.1);
  --content-topbar-text: #cbd5e1;
  --content-topbar-heading: #f8fafc;
  --admin-border: rgba(255, 255, 255, 0.1);
  --admin-muted: #94a3b8;
  --content-glass-bg: rgba(30, 41, 59, 0.55);
  --content-glass-header: rgba(15, 23, 42, 0.65);
}

html[data-ui-mode="dark"] body.admin-body,
html[data-ui-mode="dark"] body.login-body {
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(86, 174, 87, 0.06), transparent 55%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(15, 48, 85, 0.08), transparent 50%),
    var(--content-page-bg);
  color: #e2e8f0;
}

html[data-ui-mode="dark"] .admin-topbar {
  background: rgba(15, 23, 42, 0.72) !important;
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-ui-mode="dark"] .admin-footer {
  background: rgba(15, 23, 42, 0.72) !important;
  border-top-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8;
}

html[data-ui-mode="dark"] .admin-card,
html[data-ui-mode="dark"] .settings-panel {
  background: rgba(30, 41, 59, 0.55) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-ui-mode="dark"] .admin-card-header,
html[data-ui-mode="dark"] .settings-panel-title {
  background: rgba(15, 23, 42, 0.55) !important;
  color: #e2e8f0;
}

html[data-ui-mode="dark"] .page-title,
html[data-ui-mode="dark"] .welcome-text {
  color: var(--content-topbar-heading) !important;
}

html[data-ui-mode="dark"] .form-control,
html[data-ui-mode="dark"] .form-select {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

html[data-ui-mode="dark"] .form-control:focus,
html[data-ui-mode="dark"] .form-select:focus {
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
}

html[data-ui-mode="dark"] .table {
  --bs-table-color: #e2e8f0;
  --bs-table-hover-color: #f8fafc;
}

html[data-ui-mode="dark"] .admin-content .table thead th {
  background: rgba(30, 41, 59, 0.85) !important;
  color: #94a3b8 !important;
}

html[data-ui-mode="dark"] .text-muted {
  color: #94a3b8 !important;
}

html[data-ui-mode="dark"] .login-glass-card {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-ui-mode="dark"] .login-glass-field input {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}

html[data-ui-mode="dark"] .feres-state-page__title {
  color: #e2e8f0;
}

html[data-ui-mode="dark"] .feres-state-page__message,
html[data-ui-mode="dark"] .feres-state-inline__message {
  color: #94a3b8;
}
