/* Gateway color themes */
:root,
[data-gateway-theme="default"] {
  --brand: #128c7e;
  --brand-dark: #075e54;
  --brand-rgb: 18, 140, 126;
  --surface: #f4f7f6;
  --panel: #ffffff;
  --auth-bg:
    radial-gradient(circle at top left, rgba(18, 140, 126, 0.18), transparent 40%),
    radial-gradient(circle at bottom right, rgba(7, 94, 84, 0.12), transparent 35%),
    linear-gradient(160deg, #eef6f4, #f8faf9 45%, #e8f1ef);
  --nav-hover-bg: rgba(var(--brand-rgb), 0.12);
  --nav-active-color: var(--brand-dark);
}

[data-gateway-theme="dark"] {
  --brand: #25d366;
  --brand-dark: #128c7e;
  --brand-rgb: 37, 211, 102;
  --surface: #121816;
  --panel: #1a221f;
  --auth-bg:
    radial-gradient(circle at top left, rgba(37, 211, 102, 0.12), transparent 40%),
    linear-gradient(160deg, #0f1614, #15201c);
  --nav-hover-bg: rgba(var(--brand-rgb), 0.15);
  --nav-active-color: #7dd3c7;
}

[data-gateway-theme="midnight"] {
  --brand: #38bdf8;
  --brand-dark: #0284c7;
  --brand-rgb: 56, 189, 248;
  --surface: #0c1222;
  --panel: #151d2e;
  --auth-bg:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 45%),
    linear-gradient(160deg, #030712, #0c4a6e 55%, #111827);
  --nav-hover-bg: rgba(var(--brand-rgb), 0.14);
  --nav-active-color: #7dd3fc;
}

[data-gateway-theme="ocean"] {
  --brand: #0ea5e9;
  --brand-dark: #0369a1;
  --brand-rgb: 14, 165, 233;
  --surface: #f0f9ff;
  --panel: #ffffff;
  --auth-bg:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.2), transparent 42%),
    linear-gradient(160deg, #e0f2fe, #f0f9ff 50%, #dbeafe);
  --nav-hover-bg: rgba(var(--brand-rgb), 0.12);
  --nav-active-color: #0369a1;
}

[data-gateway-theme="violet"] {
  --brand: #8b5cf6;
  --brand-dark: #6d28d9;
  --brand-rgb: 139, 92, 246;
  --surface: #f5f3ff;
  --panel: #ffffff;
  --auth-bg:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.18), transparent 42%),
    linear-gradient(160deg, #ede9fe, #faf5ff 50%, #e9d5ff);
  --nav-hover-bg: rgba(var(--brand-rgb), 0.12);
  --nav-active-color: #6d28d9;
}

/* Theme picker */
.theme-panel-wrap {
  position: relative;
}

.theme-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 260px;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  z-index: 1050;
  padding: 0.85rem;
  animation: themePanelIn 0.2s ease;
}

[data-bs-theme="dark"] .theme-panel {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.theme-panel.open {
  display: block;
}

.theme-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.4rem;
  border: 2px solid transparent;
  border-radius: 0.65rem;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.theme-option:hover {
  transform: translateY(-1px);
}

.theme-option.active {
  border-color: var(--brand);
  background: var(--nav-hover-bg);
}

.theme-option span {
  font-size: 0.75rem;
  font-weight: 600;
}

.theme-swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-swatch.default { background: linear-gradient(135deg, #128c7e, #075e54); }
.theme-swatch.dark { background: linear-gradient(135deg, #1a221f, #0f1614); }
.theme-swatch.midnight { background: linear-gradient(135deg, #38bdf8, #0c4a6e); }
.theme-swatch.ocean { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
.theme-swatch.violet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.login-theme {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .login-theme {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.login-theme-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  margin-bottom: 0.55rem;
}

@keyframes themePanelIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
