/* ============================================================================
   SIDEBAR — 3D Glassmorphism Capsule Navigation
   Matching the toggle-dock visual language: depth, shimmer, spring physics
   ============================================================================ */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --sb-w:             78px;
  --sb-inset:         14px;
  --sb-pad:           14px;
  --sb-gap:           8px;
  --sb-radius:        22px;
  --sb-btn-size:      52px;
  --sb-btn-radius:    14px;
  --sb-module-h:      60px;

  /* Legacy aliases — consumed by nav-panel.css + sidebar.js */
  --sidebar-w:        var(--sb-w);
  --sidebar-inset:    var(--sb-inset);

  --sb-bg:            rgba(250, 251, 255, 0.78);
  --sb-border:        rgba(255, 255, 255, 0.88);
  --sb-blur:          44px;
  --sb-saturate:      180%;
  --sb-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.045),
    0 1px 4px rgba(0, 0, 0, 0.04),
    0 6px 24px rgba(0, 0, 0, 0.08),
    0 24px 56px rgba(0, 0, 0, 0.06),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(0, 0, 0, 0.025);

  --sb-btn-hover:     rgba(0, 0, 0, 0.05);
  --sb-btn-active-bg: var(--primary, #14AE5C);
  --sb-sep:           rgba(0, 0, 0, 0.055);

  --sb-icon:          rgba(18, 18, 28, 0.62);
  --sb-icon-hover:    rgba(8, 8, 18, 0.92);
  --sb-icon-active:   #ffffff;

  --sb-tooltip-bg:    rgba(10, 11, 18, 0.88);
  --sb-tooltip-fg:    rgba(255, 255, 255, 0.94);
}

[data-theme="dark"] {
  --sb-bg:          rgba(14, 16, 26, 0.82);
  --sb-border:      rgba(255, 255, 255, 0.09);
  --sb-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 1px 4px rgba(0, 0, 0, 0.35),
    0 6px 24px rgba(0, 0, 0, 0.28),
    0 24px 56px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.065);

  --sb-btn-hover:   rgba(255, 255, 255, 0.065);
  --sb-sep:         rgba(255, 255, 255, 0.06);

  --sb-icon:        rgba(255, 255, 255, 0.62);
  --sb-icon-hover:  rgba(255, 255, 255, 0.95);

  --sb-tooltip-bg:  rgba(232, 234, 244, 0.92);
  --sb-tooltip-fg:  rgba(10, 11, 18, 0.92);
}

/* ── Sidebar container ─────────────────────────────────────────────────── */

.gp-sidebar {
  position: fixed;
  top: var(--sb-inset);
  left: var(--sb-inset);
  width: var(--sb-w);
  z-index: 1000;

  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sb-pad) 6px;
  gap: var(--sb-gap);

  background: var(--sb-bg);
  backdrop-filter: blur(var(--sb-blur)) saturate(var(--sb-saturate));
  -webkit-backdrop-filter: blur(var(--sb-blur)) saturate(var(--sb-saturate));
  border: 1px solid var(--sb-border);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);

  will-change: border-radius;
  transition:
    background    0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color  0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow    0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-radius 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Inner gradient shimmer — the signature 3D depth layer */
.gp-sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    170deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.06) 30%,
    rgba(255, 255, 255, 0) 55%
  );
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .gp-sidebar::after {
  background: linear-gradient(
    170deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.015) 30%,
    rgba(255, 255, 255, 0) 55%
  );
}

/* Theme-switch shimmer (mirrors dock) */
.gp-sidebar--shimmer { animation: sbShimmer 0.7s ease; }

@keyframes sbShimmer {
  0%   { box-shadow: var(--sb-shadow); }
  40%  {
    box-shadow:
      var(--sb-shadow),
      0 0 36px color-mix(in srgb, var(--primary, #14AE5C) 22%, transparent),
      inset 0 0 28px rgba(255, 255, 255, 0.05);
  }
  100% { box-shadow: var(--sb-shadow); }
}

/* Panel open → flush right edge */
@media (min-width: 721px) {
  body:has(.nav-panel.open:not(.collapsed)) .gp-sidebar {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* ── Logo ──────────────────────────────────────────────────────────────── */

.gp-sidebar__logo {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 10px;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: 12px;
  will-change: transform;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter    0.3s ease;
}

.gp-sidebar__logo:hover {
  transform: scale(1.08);
  filter: brightness(1.05);
}

.gp-sidebar__logo:active {
  transform: scale(0.93);
  transition-duration: 0.06s;
}

.gp-sidebar__logo img {
  width: 70%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ── Dividers (luminous hairline) ──────────────────────────────────────── */

.gp-sidebar__divider {
  width: 34px;
  height: 1px;
  background: var(--sb-sep);
  margin: 10px 0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border-radius: 0.5px;
  box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.5);
  transition: opacity 0.4s ease, width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .gp-sidebar__divider {
  box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.04);
}

/* Hide the divider right before actions — the recessed zone self-separates */
.gp-sidebar__divider + .gp-sidebar__actions { }
.gp-sidebar__divider:has(+ .gp-sidebar__actions) { display: none; }

/* ── Modules section ───────────────────────────────────────────────────── */

.gp-sidebar__modules {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sb-gap);
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ── Button — Base ─────────────────────────────────────────────────────── */

.gp-sidebar__btn {
  --_accent: var(--sb-icon);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: var(--sb-btn-size);
  height: var(--sb-btn-size);
  border: none;
  border-radius: var(--sb-btn-radius);
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  color: var(--sb-icon);
  font-family: inherit;
  line-height: 1;
  overflow: visible;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
  transition:
    background 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform  0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter     0.25s ease;
}

.gp-sidebar__btn i {
  font-size: 1.05rem;
  color: var(--sb-icon);
  will-change: transform, color;
  transition:
    color     0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.gp-sidebar__label {
  font-size: 0.54rem;
  font-weight: 680;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--sb-icon);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(var(--sb-w) - 20px);
  text-align: center;
  line-height: 1;
  opacity: 0.72;
  transition: color 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

/* Hover — scale pop + frosted bg */
.gp-sidebar__btn:hover {
  background: var(--sb-btn-hover);
  transform: scale(1.08);
}

.gp-sidebar__btn:hover i { color: var(--sb-icon-hover); }

.gp-sidebar__btn:hover .gp-sidebar__label {
  color: var(--sb-icon-hover);
  opacity: 1;
}

/* Press — spring squish */
.gp-sidebar__btn:active {
  transform: scale(0.90);
  transition-duration: 0.1s;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Focus visible */
.gp-sidebar__btn:focus-visible {
  outline: 2px solid var(--primary, #14AE5C);
  outline-offset: 2px;
}

/* ── Module button (Carte, Travaux) — Primary nav ──────────────────────── */

.gp-sidebar__btn--module {
  width: 100%;
  height: var(--sb-module-h);
  border-radius: var(--sb-btn-radius);
  gap: 4px;
}

.gp-sidebar__btn--module i {
  font-size: 1.15rem;
}

.gp-sidebar__btn--module .gp-sidebar__label {
  font-size: 0.55rem;
  max-width: calc(100% - 8px);
  white-space: normal;
  line-height: 1.2;
}

/* Hover — module: tinted glow */
.gp-sidebar__btn--module:hover {
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 10%, transparent);
  transform: scale(1.06);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cat-color, var(--primary)) 12%, transparent);
}

.gp-sidebar__btn--module:hover i {
  color: var(--cat-color, var(--primary));
  transform: scale(1.10);
}

.gp-sidebar__btn--module:hover .gp-sidebar__label {
  color: var(--cat-color, var(--primary));
  opacity: 1;
}

/* Active — solid fill + glow (matching dock [aria-pressed="true"]) */
.gp-sidebar__btn--module.active {
  background: var(--cat-color, var(--sb-btn-active-bg));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 4px 16px color-mix(in srgb, var(--cat-color, var(--primary)) 38%, transparent),
    0 1px 4px  color-mix(in srgb, var(--cat-color, var(--primary)) 26%, transparent);
  transform: scale(1);
}

.gp-sidebar__btn--module.active i {
  color: var(--sb-icon-active);
  transform: scale(1.06);
}

.gp-sidebar__btn--module.active .gp-sidebar__label {
  color: var(--sb-icon-active);
  opacity: 1;
}

.gp-sidebar__btn--module.active:hover {
  filter: brightness(1.10);
  transform: scale(1.04);
}

.gp-sidebar__btn--module.active:active {
  transform: scale(0.93);
  filter: brightness(0.95);
  transition-duration: 0.1s;
}



/* ── Actions section (bottom) ── Recessed utility zone ─────────────────── */

.gp-sidebar__actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: calc(100% - 10px);
  margin-inline: 5px;
  padding: 6px 0 4px;
  position: relative;
  z-index: 1;
  border-radius: 12px;
  background: color-mix(in srgb, var(--gray-900, #1a1a2e) 5%, transparent);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.04),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.03),
    0 -0.5px 0 rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .gp-sidebar__actions {
  background: rgba(0, 0, 0, 0.12);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.15),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.03),
    0 -0.5px 0 rgba(255, 255, 255, 0.04);
}

/* Action buttons: compact, muted, softer interactions */
.gp-sidebar__actions .gp-sidebar__btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  opacity: 0.65;
  will-change: transform, opacity;
  transition:
    background 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform  0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity    0.3s ease;
}

.gp-sidebar__actions .gp-sidebar__btn i {
  font-size: 0.82rem;
  transition: color 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gp-sidebar__actions .gp-sidebar__btn .gp-sidebar__label {
  display: none;
}

/* Hover — fade in + gentle lift */
.gp-sidebar__actions .gp-sidebar__btn:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--_accent, var(--sb-icon-hover)) 8%, transparent);
  transform: scale(1.08);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--_accent, var(--sb-icon-hover)) 12%, transparent);
}

.gp-sidebar__actions .gp-sidebar__btn:hover i {
  color: var(--_accent, var(--sb-icon-hover));
  transform: scale(1.06);
}

/* Press — subtle spring */
.gp-sidebar__actions .gp-sidebar__btn:active {
  transform: scale(0.90);
  transition-duration: 0.06s;
  opacity: 1;
}

/* ── Action variants — Semantic accent colors ──────────────────────────── */

.gp-sidebar__btn--theme { --_accent: var(--color-warning); }
.gp-sidebar__btn--info  { --_accent: var(--color-info); }
.gp-sidebar__btn--help  { --_accent: var(--color-warning); }
.gp-sidebar__btn--login { --_accent: var(--primary); }

/* Contribute — always subtly tinted, the one "warm" action */
.gp-sidebar__btn--contribute {
  --_accent: var(--primary);
  opacity: 0.72;
}

.gp-sidebar__btn--contribute i {
  color: color-mix(in srgb, var(--primary) 55%, var(--sb-icon));
}

.gp-sidebar__btn--contribute:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  box-shadow:
    0 2px 10px color-mix(in srgb, var(--primary) 16%, transparent),
    inset 0 0 0 0.5px color-mix(in srgb, var(--primary) 15%, transparent);
}

.gp-sidebar__btn--contribute:hover i {
  color: var(--primary);
}

/* Logout — danger, dimmer baseline */
.gp-sidebar__btn--logout {
  --_accent: var(--color-danger);
  opacity: 0.52;
}

.gp-sidebar__btn--logout:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--color-danger) 12%, transparent);
}

.gp-sidebar__btn--logout:hover i {
  color: var(--color-danger);
}

/* ── Auth visibility ───────────────────────────────────────────────────── */

.gp-sidebar__btn[data-auth="connected"]    { display: none; }
.gp-sidebar__btn[data-auth="disconnected"] { display: flex; }

.gp-sidebar[data-connected="true"] .gp-sidebar__btn[data-auth="connected"]    { display: flex; }
.gp-sidebar[data-connected="true"] .gp-sidebar__btn[data-auth="disconnected"] { display: none; }

/* ── Tooltip (frosted glass pill — matching dock) ──────────────────────── */

.gp-sidebar__btn[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  padding: 5px 12px;
  border-radius: 9px;
  background: var(--sb-tooltip-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--sb-tooltip-fg);
  font-size: 0.67rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.025em;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition:
    opacity   0.2s ease 0.05s,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s;
}

[data-theme="dark"] .gp-sidebar__btn[data-tooltip]::before {
  background: var(--sb-tooltip-bg);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.40),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.gp-sidebar__btn:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (hover: none) {
  .gp-sidebar__btn::before { display: none !important; }
}

/* ── Entrance animation ────────────────────────────────────────────────── */

.gp-sidebar {
  animation: sbEnter 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sbEnter {
  0% {
    opacity: 0;
    transform: translateX(-16px) scale(0.94);
    filter: blur(6px);
  }
  60% {
    opacity: 1;
    filter: blur(0);
  }
  80% {
    transform: translateX(2px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

/* ── Layout offset ─────────────────────────────────────────────────────── */

.gp-sidebar ~ #container { margin-left: 0; }

.gp-sidebar ~ #container .toggle-dock {
  left: calc(var(--sb-inset) + var(--sb-w) + 16px);
}

@media (min-width: 721px) {
  .gp-sidebar ~ .mobile-fixed-logo { display: none !important; }
}

/* ── Sidebar panels (city menu etc.) ───────────────────────────────────── */

#city-menu.dock-panel--open {
  min-width: 260px;
  max-width: 320px;
  max-height: calc(100vh - 80px);
  border-radius: 20px;
  backdrop-filter: blur(var(--sb-blur)) saturate(var(--sb-saturate));
  -webkit-backdrop-filter: blur(var(--sb-blur)) saturate(var(--sb-saturate));
  box-shadow: var(--sb-shadow);
}

#city-menu.dock-panel--open::before { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 720px)  ·  Bottom-docked glass capsule
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 720px) {
  :root { --sb-w: 0px; --sidebar-w: 0px; }

  .gp-sidebar {
    position: fixed;
    top: auto;
    left: 50%;
    right: auto;
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
    transform: translateX(-50%);
    width: fit-content;
    max-width: calc(100vw - 20px);
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 6px;
    gap: 6px;
    border-radius: 20px;
    border: 1px solid var(--sb-border);
    background: var(--sb-bg);
    backdrop-filter: blur(var(--sb-blur)) saturate(var(--sb-saturate));
    -webkit-backdrop-filter: blur(var(--sb-blur)) saturate(var(--sb-saturate));
    box-shadow: var(--sb-shadow);
    overflow: hidden;
    animation: sbSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  /* Shimmer overlay on mobile too */
  .gp-sidebar::after {
    background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0) 50%
    );
  }

  [data-theme="dark"] .gp-sidebar::after {
    background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.06) 0%,
      rgba(255, 255, 255, 0) 50%
    );
  }

  @keyframes sbSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(24px) scale(0.95); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  }

  /* Layout resets */
  .gp-sidebar ~ #container { margin-left: 0; }
  .gp-sidebar ~ #container .toggle-dock { left: 16px; }
  .gp-sidebar__logo,
  .gp-sidebar__divider,
  .gp-sidebar__actions { display: none; }

  /* City panel */
  #city-menu.dock-panel--open {
    top: auto !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 90px !important;
    min-width: 0;
    max-width: none;
  }

  /* Module track */
  .gp-sidebar__modules {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: auto;
    gap: 6px;
    padding: 0;
    position: relative;
    z-index: 1;
  }

  /* Module tabs — 3D mini-cards */
  .gp-sidebar__btn--module {
    position: relative;
    isolation: isolate;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: clamp(106px, 34vw, 136px);
    min-width: 106px;
    max-width: 136px;
    height: 56px;
    padding: 8px 10px 6px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.60),
      inset 0 -0.5px 0 rgba(0, 0, 0, 0.03),
      0 2px 8px rgba(0, 0, 0, 0.04);
    opacity: 1;
    animation: none;
    transition:
      transform    0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
      background   0.22s ease,
      border-color 0.22s ease,
      box-shadow   0.22s ease,
      filter       0.18s ease;
  }

  [data-theme="dark"] .gp-sidebar__btn--module {
    background: rgba(255, 255, 255, 0.065);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 2px 8px rgba(0, 0, 0, 0.12);
  }

  /* Card shimmer */
  .gp-sidebar__btn--module::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.35) 0%,
      rgba(255, 255, 255, 0) 50%
    );
    opacity: 0.6;
    transition: opacity 0.22s ease;
    pointer-events: none;
    z-index: -1;
  }

  [data-theme="dark"] .gp-sidebar__btn--module::before {
    background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0) 50%
    );
  }

  .gp-sidebar__btn--module i {
    font-size: 1.1rem;
    color: var(--sb-icon);
    transition: color 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .gp-sidebar__btn--module .gp-sidebar__label {
    display: block;
    font-size: 0.60rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--sb-icon);
    opacity: 0.7;
    line-height: 1;
    transition: color 0.18s ease, opacity 0.18s ease;
  }

  .gp-sidebar__btn--module:hover {
    transform: translateY(-2px) scale(1.02);
    background: rgba(255, 255, 255, 0.52);
    border-color: rgba(255, 255, 255, 0.50);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.70),
      0 4px 14px rgba(0, 0, 0, 0.06);
  }

  [data-theme="dark"] .gp-sidebar__btn--module:hover {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 255, 255, 0.18);
  }

  .gp-sidebar__btn--module:hover::before { opacity: 1; }
  .gp-sidebar__btn--module:hover i { color: var(--sb-icon-hover); transform: translateY(-1px); }
  .gp-sidebar__btn--module:hover .gp-sidebar__label { color: var(--sb-icon-hover); opacity: 1; }

  /* Active — solid fill + glow, consistent with desktop */
  .gp-sidebar__btn--module.active {
    background: var(--cat-color, var(--sb-btn-active-bg));
    border-color: color-mix(in srgb, var(--cat-color, var(--primary)) 78%, white);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.30),
      inset 0 -1px 0 rgba(0, 0, 0, 0.08),
      0 6px 22px color-mix(in srgb, var(--cat-color, var(--primary)) 35%, transparent),
      0 2px 6px  color-mix(in srgb, var(--cat-color, var(--primary)) 22%, transparent);
    transform: translateY(-2px);
  }

  .gp-sidebar__btn--module.active::before {
    background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.25) 0%,
      rgba(255, 255, 255, 0) 45%
    );
    opacity: 1;
  }

  .gp-sidebar__btn--module.active i {
    color: #fff;
    transform: scale(1.06);
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.20));
  }

  .gp-sidebar__btn--module.active .gp-sidebar__label {
    color: #fff;
    opacity: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  }

  .gp-sidebar__btn--module.active:hover {
    transform: translateY(-3px) scale(1.02);
    filter: brightness(1.08);
  }

  .gp-sidebar__btn--module:active {
    transform: translateY(0) scale(0.96);
    transition-duration: 0.06s;
  }

  /* Generic button overrides */
  .gp-sidebar__btn:not(.gp-sidebar__btn--module) {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .gp-sidebar__btn:not(.gp-sidebar__btn--module) .gp-sidebar__label { display: none; }
  .gp-sidebar__btn:not(.gp-sidebar__btn--module) i { font-size: 1rem; }

  /* Tooltips → above on mobile */
  .gp-sidebar__btn[data-tooltip]::before {
    left: 50%;
    top: auto;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
  }

  .gp-sidebar__btn:hover::before {
    transform: translateX(-50%) translateY(0);
  }
}

/* ── Small phones (≤ 480px) ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .gp-sidebar {
    max-width: calc(100vw - 16px);
    padding: 5px;
    gap: 5px;
  }

  .gp-sidebar__btn--module {
    width: clamp(96px, 42vw, 118px);
    min-width: 96px;
    max-width: 118px;
    height: 52px;
    padding: 7px 8px 5px;
    gap: 3px;
  }

  .gp-sidebar__btn--module i { font-size: 1.02rem; }
  .gp-sidebar__btn--module .gp-sidebar__label { font-size: 0.57rem; }

  .gp-sidebar__btn:not(.gp-sidebar__btn--module) {
    width: 36px;
    height: 36px;
  }

  .gp-sidebar__btn i { font-size: 0.9rem; }
}

/* ── Accessibility ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .gp-sidebar,
  .gp-sidebar__btn,
  .gp-sidebar__btn i,
  .gp-sidebar__logo {
    transition: none !important;
    animation: none !important;
  }

  .gp-sidebar__btn--module {
    opacity: 1;
    animation: none !important;
  }
}
