.sidebar_serie {
  background: #344362;
  color: white;
  padding: 14px 20px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(52, 67, 98, 0.3);
}

.sidebar_serie_content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.sidebar_serie_toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: inline-block;
}

.sidebar_serie_toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar_serie_toggle:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.95);
}

.sidebar_serie_toggle_text {
  display: inline-block;
  transition: all 0.3s ease;
  transform-origin: center;
}

.sidebar_serie_toggle_text.rotating {
  animation: textRotate 0.3s ease;
}

.sidebar_serie_toggle_text.expanding {
  animation: textExpand 0.3s ease;
}

.sidebar_serie_toggle_text.collapsing {
  animation: textCollapse 0.3s ease;
}

@keyframes textRotate {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.3);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes textExpand {
  0% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.5) rotate(90deg);
  }
  50% {
    transform: scale(0.7) rotate(180deg);
  }
  75% {
    transform: scale(1.2) rotate(270deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

@keyframes textCollapse {
  0% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.5) rotate(-90deg);
  }
  50% {
    transform: scale(0.7) rotate(-180deg);
  }
  75% {
    transform: scale(1.2) rotate(-270deg);
  }
  100% {
    transform: scale(1) rotate(-360deg);
  }
}

.sidebar_serie_sets {
  transition:
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
  overflow: hidden;
}

.sidebar_serie_sets.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

.sidebar_serie_name_abrv {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

.sidebar_serie_name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  letter-spacing: -0.2px;
}

.set_link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.set_link:hover {
  background: rgba(52, 67, 98, 0.08);
}

.set_link:active {
  background: rgba(52, 67, 98, 0.12);
}

.sidebar_set {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
}

.set_link.active .sidebar_set {
  background: var(--tertiary-color) !important;
  border-left: 3px solid var(--tertiary-color) !important;
  padding-left: 17px;
}

.sidebar_set_name {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary) !important;
}

.set_link.active .sidebar_set_name {
  color: var(--on-tertiary) !important;
}

.set_link.active .sidebar_set_stats {
  color: var(--on-tertiary) !important;
}

.sidebar_serie.mt-3 {
  margin-top: 20px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  background: var(--bg-secondary, #f5f5f7);
  border: 1px solid var(--border-color, #e5e5e7);
  border-radius: var(--radius-lg, 8px);
  margin: 8px 12px;
  padding: 0 8px;
  gap: 4px;
}

.sidebar-search input {
  flex: 1;
  padding: 8px 4px;
  border: 0;
  border-radius: inherit;
  font-size: 14px;
  background: transparent;
  outline: none;
  box-sizing: border-box;
}

.sidebar-search input:focus {
  border-color: var(--primary-color, #344362);
  box-shadow: none;
}

/* Bouton intégré dans la recherche sidebar */
.sidebar-search .dex-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
  color: var(--text-secondary, #666);
  box-shadow: none;
}

.sidebar-search .dex-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: none;
}

.sidebar-search .dex-btn:active {
  box-shadow: none;
}

.sidebar-search .dex-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.sidebar_serie.hidden {
  display: none !important;
}

.sidebar_set.hidden {
  display: none !important;
}

.set_link.hidden {
  display: none !important;
}

/* ===== MODERN SIDEBAR TABS (iOS Style) ===== */

/* Wrapper - solid background */
.sidebar-tabs-wrapper {
  display: flex;
  background: #f8f8f8;
  border-bottom: 0.33px solid rgba(60, 60, 67, 0.29);
}

.sidebar-tabs {
  display: flex;
  background: transparent;
  flex: 1;
  position: relative;
  margin-top: 4px;
}

/* Sliding indicator */
.sidebar-tabs .tabs-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: var(--primary-color);
  border-radius: 3px;
  transition:
    left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: left, width;
  z-index: 1;
}

/* Tab button - base */
.tab-button {
  flex: 1;
  padding: 10px 20px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #8e8e93;
  cursor: pointer;
  position: relative;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 8px 8px 0 0;
  letter-spacing: -0.1px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

/* Ripple effect */
.tab-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: var(--primary-color);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    width 0.4s ease-out,
    height 0.4s ease-out,
    opacity 0.4s ease-out;
}

.tab-button:active::before {
  width: 80px;
  height: 80px;
  opacity: 0.08;
}

/* Remove old underline */
.tab-button::after {
  display: none;
}

/* Active state */
.tab-button.active {
  color: var(--primary-color);
  background: rgba(52, 67, 98, 0.08);
}

.tab-button:hover:not(.active) {
  color: #374151;
  background: rgba(52, 67, 98, 0.05);
}

.tab-button:active:not(.active) {
  transform: scale(0.97);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#sidebar_sets_header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8f8f8;
}

/* Tag menu button in sidebar */
.tag-menu-btn {
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  margin-right: 8px;
  border: none;
  background: transparent;
  color: #86868b;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.set_link:hover .tag-menu-btn,
.tag-menu-btn:focus,
.set_link.active .tag-menu-btn {
  opacity: 0.6;
}

.tag-menu-btn:hover {
  opacity: 1;
  color: #344362;
}

/* Tag dropdown menu */
.tag-dropdown {
  position: absolute;
  right: 16px;
  top: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  min-width: 140px;
  padding: 4px 0;
  margin-top: -4px;
}

.tag-dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  transition: background 0.15s ease;
}

.tag-dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.tag-dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}

.tag-dropdown-item:hover {
  background: #f5f5f7;
}

.tag-dropdown-item.edit {
  color: #1d1d1f;
}

.tag-dropdown-item.edit svg {
  color: #86868b;
}

.tag-dropdown-item.delete {
  color: #dc3545;
}

.tag-dropdown-item.delete svg {
  color: #dc3545;
}

.tag-dropdown-item:hover.edit {
  background: rgba(52, 67, 98, 0.08);
}

.tag-dropdown-item:hover.delete {
  background: #fee2e2;
}

/* System tags (Mes recherches, Mes ventes) */
.set_link.system-tag {
  background: linear-gradient(
    135deg,
    rgba(52, 67, 98, 0.04),
    rgba(52, 67, 98, 0.02)
  );
}

.set_link.system-tag:hover {
  background: linear-gradient(
    135deg,
    rgba(52, 67, 98, 0.08),
    rgba(52, 67, 98, 0.04)
  );
}

.set_link.system-tag.active {
  background: linear-gradient(
    135deg,
    rgba(52, 67, 98, 0.12),
    rgba(52, 67, 98, 0.06)
  );
}

.set_link.system-tag .sidebar_set_name {
  font-weight: 600;
}

.sidebar-tag-icon {
  width: 20px;
  height: 20px;
  margin-right: 5px;
  flex-shrink: 0;
  color: var(--accent-pink);
}

.sidebar-tag-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-tag-icon .lock-badge-bg {
  fill: #f5c542;
}

.sidebar-tag-icon .lock-badge-stroke {
  stroke: #d4a520;
  stroke-width: 1.5;
  fill: none;
}

.sidebar-tag-icon .lock-body {
  fill: #f5c542;
  stroke: #d4a520;
  stroke-width: 1.2;
}
