/* ==========================================================================
   ULTRA-COMPACT THEME & MODE CONTROLLER — TOP RIGHT CORNER
   Small footprint, zero overlay on content, with dropdown panel
   ========================================================================== */

.theme-compact-hub {
  position: fixed;
  top: 0.55rem;
  right: 0.75rem;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

/* Floating Ultra-Compact Pill Bar */
.theme-compact-bar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.15rem 0.25rem;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Theme Dropdown Trigger Button */
.theme-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.theme-dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.24);
}

.theme-active-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: #38bdf8;
  flex-shrink: 0;
}

.theme-caret-icon {
  font-size: 0.6rem;
  opacity: 0.75;
  transition: transform 0.2s ease;
}

.theme-compact-hub.menu-open .theme-caret-icon {
  transform: rotate(180deg);
}

/* Divider */
.theme-compact-sep {
  width: 1px;
  height: 15px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 0.1rem;
}

/* Mode & Utility Icon Buttons */
.theme-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #cbd5e1;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  transition: all 0.2s ease;
  padding: 0;
}

.theme-tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.theme-tool-btn.active {
  color: #38bdf8;
}

/* Dropdown Menu Popover */
.theme-menu-popover {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  width: 240px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 0.4rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  animation: popoverFadeIn 0.18s ease-out forwards;
}

.theme-compact-hub.menu-open .theme-menu-popover {
  display: flex;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-menu-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0.4rem 0.6rem 0.2rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.2rem;
  display: flex;
  justify-content: space-between;
}

.theme-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-size: 0.8rem;
  font-weight: 600;
}

.theme-menu-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.theme-menu-item.is-selected {
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
}

.theme-menu-item-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-item-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.theme-menu-key {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-family: monospace;
}

.theme-menu-item.is-selected .theme-menu-key {
  background: #e2e8f0;
  color: #475569;
}

/* Header Clearance Utility across all themes so header items NEVER overlap with top-right widget */
.maly-masthead,
.glass-header-nav,
.bio-navbar,
.swiss-top-rail {
  padding-right: 250px !important;
}

@media (max-width: 900px) {
  .maly-masthead,
  .glass-header-nav,
  .bio-navbar,
  .swiss-top-rail {
    padding-right: 170px !important;
  }
}

@media (max-width: 600px) {
  .theme-compact-hub {
    top: 0.4rem;
    right: 0.4rem;
  }
  .theme-dropdown-label {
    display: none;
  }
  .maly-masthead,
  .glass-header-nav,
  .bio-navbar,
  .swiss-top-rail {
    padding-right: 120px !important;
  }
}
