/* ==========================================================================
   SIDEBAR UI - GLASSMORPHIC STYLING WITH BUTTERY SMOOTH 60FPS TRANSITIONS
   Exact match to the reference BitTorrent glass design in expanded & minimized
   ========================================================================== */

/* Main Container */
.sb-container {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 740px;
  max-height: 94vh;
  box-sizing: border-box;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #ffffff;
  overflow: visible;

  /* Ultra-smooth Glassmorphism */
  background: linear-gradient(
    165deg,
    rgba(34, 38, 48, 0.74) 0%,
    rgba(22, 24, 31, 0.84) 40%,
    rgba(14, 16, 21, 0.9) 100%
  );
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);

  /* Delicate glass border & specular lighting */
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 30px;
  box-shadow:
    0 28px 60px -10px rgba(0, 0, 0, 0.78),
    0 10px 24px -5px rgba(0, 0, 0, 0.45),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 1px 0 rgba(0, 0, 0, 0.5);

  /* Butter-smooth ease curve for all dimensions */
  transition: width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

/* Expanded State */
.sb-container.sb-expanded {
  width: 276px;
  padding: 18px 14px 22px 14px;
}

/* Collapsed State - Enhanced width (88px) as requested */
.sb-container.sb-collapsed {
  width: 88px;
  padding: 18px 10px 22px 10px;
}

/* ==========================================================================
   FLOATING EDGE TOGGLE ARROW BUTTON
   ========================================================================== */
.sb-edge-toggle-btn {
  position: absolute;
  top: 36px;
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(26, 30, 40, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  padding: 0;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.25);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
}

.sb-edge-toggle-btn:hover {
  color: #ffffff;
  background: rgba(36, 42, 56, 1);
  border-color: rgba(181, 74, 248, 0.75);
  box-shadow:
    0 0 16px rgba(181, 74, 248, 0.65),
    0 6px 16px rgba(0, 0, 0, 0.6);
  transform: scale(1.12);
}

.sb-edge-toggle-btn:active {
  transform: scale(0.94);
}

.sb-toggle-arrow-svg {
  width: 14px;
  height: 14px;
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded state: points left ‹ (click to collapse) */
.sb-toggle-arrow-svg.expanded {
  transform: rotate(0deg);
}

/* Collapsed state: flips to point right › (click to extend) */
.sb-toggle-arrow-svg.collapsed {
  transform: rotate(180deg);
}

/* ==========================================================================
   TOP WINDOW CONTROLS (- ▢ ✕)
   ========================================================================== */
.sb-header-controls {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 26px;
  margin-bottom: 14px;
}

.sb-window-controls {
  position: absolute;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: right 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-window-controls {
  right: 0;
  left: auto;
  transform: translateX(0);
}

.sb-collapsed .sb-window-controls {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

.sb-win-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.45);
  border-radius: 3px;
  transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.sb-win-btn:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.1);
}

.sb-win-btn:active {
  transform: scale(0.9);
}

.sb-win-close:hover {
  color: #ff5f56;
}

/* ==========================================================================
   BRAND LOGO & TITLE
   ========================================================================== */
.sb-brand {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 20px;
  padding: 0 2px;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

.sb-brand:hover {
  opacity: 0.92;
}

.sb-expanded .sb-brand {
  justify-content: flex-start;
}

.sb-collapsed .sb-brand {
  justify-content: center;
  padding: 0;
}

.sb-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.sb-logo-svg {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

.sb-brand-text {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
  overflow: hidden;
  margin-left: 12px;
  transition: max-width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.28s ease,
              transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-brand-text {
  max-width: 180px;
  opacity: 1;
  transform: translateX(0);
}

.sb-collapsed .sb-brand-text {
  max-width: 0;
  opacity: 0;
  transform: translateX(-12px);
  margin-left: 0;
  pointer-events: none;
}

.sb-brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #ffffff;
}

/* ==========================================================================
   SEARCH BAR - UNIFIED SMOOTH MORPH (SQUARE IN MINIMIZED)
   ========================================================================== */
.sb-search-wrapper {
  margin-bottom: 18px;
}

.sb-search-box {
  display: flex;
  align-items: center;
  height: 48px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
  transition: width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background 0.2s ease;
}

/* In expanded state: full width search bar */
.sb-expanded .sb-search-box {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  cursor: text;
}

/* In minimized state: perfectly centered rounded-square button (48px x 48px) */
.sb-collapsed .sb-search-box {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  padding: 0;
  justify-content: center;
}

.sb-collapsed .sb-search-box:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.sb-expanded .sb-search-box:focus-within {
  border-color: rgba(180, 80, 248, 0.5);
  box-shadow: 0 0 12px rgba(180, 80, 248, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sb-search-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.46);
  transition: color 0.2s ease;
}

.sb-search-box:hover .sb-search-icon-wrapper {
  color: #ffffff;
}

.sb-search-icon-wrapper .sb-icon {
  width: 19px;
  height: 19px;
}

.sb-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 400;
  font-family: inherit;
  margin-left: 10px;
  transition: max-width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-search-input {
  max-width: 180px;
  opacity: 1;
}

.sb-collapsed .sb-search-input {
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  padding: 0;
  pointer-events: none;
}

.sb-search-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   SECTION TITLE (MENU)
   ========================================================================== */
.sb-section-title {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition: padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              text-align 0.42s ease;
}

.sb-expanded .sb-section-title {
  text-align: left;
  padding-left: 8px;
  margin-top: 14px;
}

.sb-collapsed .sb-section-title {
  text-align: center;
  padding-left: 0;
  margin-top: 20px;
  margin-bottom: 12px;
}

/* ==========================================================================
   NAVIGATION LIST & ITEMS
   ========================================================================== */
.sb-nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sb-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.62);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 450;
  padding: 0;
  transition: background 0.18s ease,
              color 0.18s ease,
              padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              justify-content 0.42s ease;
  outline: none;
  box-sizing: border-box;
}

.sb-expanded .sb-nav-item {
  padding: 0 10px;
  justify-content: flex-start;
}

.sb-collapsed .sb-nav-item {
  padding: 0;
  justify-content: center;
}

.sb-nav-item:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
}

/* Active State */
.sb-nav-item.sb-active {
  color: #ffffff;
  font-weight: 600;
}

/* Active background in expanded */
.sb-expanded .sb-nav-item.sb-active {
  background: linear-gradient(
    90deg,
    rgba(181, 74, 248, 0.24) 0%,
    rgba(181, 74, 248, 0.06) 45%,
    transparent 100%
  );
}

/* Active background in collapsed - Luxuriously radiates purple haze onto the Home icon */
.sb-collapsed .sb-nav-item.sb-active {
  background: radial-gradient(
    ellipse at 0% 50%,
    rgba(181, 74, 248, 0.42) 0%,
    rgba(181, 74, 248, 0.18) 45%,
    rgba(181, 74, 248, 0.04) 75%,
    transparent 100%
  );
}

/* Active Indicator Bar on Left Edge */
.sb-active-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3.5px;
  height: 24px;
  background: #b54af8;
  border-radius: 4px;
  box-shadow:
    0 0 12px 2px #a855f7,
    0 0 24px 5px rgba(168, 85, 247, 0.65);
  transition: left 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-active-indicator {
  left: -14px;
}

.sb-collapsed .sb-active-indicator {
  left: -10px;
}

/* Icon Container */
.sb-nav-icon-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.sb-icon {
  width: 18px;
  height: 18px;
}

/* Nav Label and Badges */
.sb-nav-label-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-left: 14px;
  white-space: nowrap;
  overflow: hidden;
  transition: max-width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.28s ease,
              transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-nav-label-wrapper {
  max-width: 180px;
  opacity: 1;
  transform: translateX(0);
}

.sb-collapsed .sb-nav-label-wrapper {
  max-width: 0;
  opacity: 0;
  transform: translateX(-10px);
  margin-left: 0;
  pointer-events: none;
}

.sb-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Purple Pill Badge for Torrents */
.sb-pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #a855f7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  box-shadow: 0 2px 6px rgba(168, 85, 247, 0.4);
}

/* Collapsed Purple Glowing Dot Badge (Exact match to screenshot) */
.sb-dot-badge {
  position: absolute;
  top: -2px;
  right: -5px;
  width: 7px;
  height: 7px;
  background: #c084fc;
  border-radius: 50%;
  box-shadow:
    0 0 10px 2px #a855f7,
    0 0 14px rgba(168, 85, 247, 0.85);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-dot-badge {
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
}

.sb-collapsed .sb-dot-badge {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   DIVIDER
   ========================================================================== */
.sb-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  transition: width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-divider {
  width: calc(100% - 8px);
  margin: 16px 4px;
}

.sb-collapsed .sb-divider {
  width: 42px;
  margin: 18px auto;
}

/* ==========================================================================
   FOOTER ITEMS (PRO & DOWNLOAD FASTER)
   ========================================================================== */
.sb-footer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
}

.sb-footer-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.65);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 0;
  transition: background 0.18s ease,
              color 0.18s ease,
              padding 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              justify-content 0.42s ease;
  outline: none;
  box-sizing: border-box;
}

.sb-expanded .sb-footer-item {
  padding: 0 10px;
  justify-content: flex-start;
}

.sb-collapsed .sb-footer-item {
  padding: 0;
  justify-content: center;
}

.sb-footer-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.sb-footer-label-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-left: 14px;
  white-space: nowrap;
  overflow: hidden;
  transition: max-width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.28s ease,
              transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.sb-expanded .sb-footer-label-wrapper {
  max-width: 180px;
  opacity: 1;
  transform: translateX(0);
}

.sb-collapsed .sb-footer-label-wrapper {
  max-width: 0;
  opacity: 0;
  transform: translateX(-10px);
  margin-left: 0;
  pointer-events: none;
}

.sb-footer-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.sb-pro-item .sb-footer-label {
  font-weight: 600;
  color: #ffffff;
}

/* Pro Badge Pill */
.sb-pro-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #ffffff;
  color: #12151b;
  border-radius: 50%;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.sb-arrow-icon {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  color: #ffffff;
  flex-shrink: 0;
}

/* ==========================================================================
   TOOLTIPS (FOR COLLAPSED MODE)
   ========================================================================== */
.sb-tooltip {
  display: none;
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 23, 30, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 100;
  animation: sbTooltipFade 0.15s ease-out;
}

.sb-collapsed .sb-nav-item:hover .sb-tooltip,
.sb-collapsed .sb-footer-item:hover .sb-tooltip {
  display: block;
}

@keyframes sbTooltipFade {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}
