/* ═══════════════════════════════════════════════
   Left Sidebar Navigation — Premium Redesign
   ═══════════════════════════════════════════════ */

/* ── Shell ───────────────────────────────────── */
.left-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 68px;
  height: 100vh;
  background: var(--card-background);
  border-right: 1px solid var(--border-color);
  z-index: 9999;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.28s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Expand on hover (unless just closed) */
.left-sidebar:hover:not(.manually-closed) {
  width: 240px;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.18);
}

/* Locked-open state */
.left-sidebar.active {
  width: 240px;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.18);
}

/* ── Overlay ─────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  display: none;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Header / Logo area ──────────────────────── */
.sidebar-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  min-height: 64px;
}

.sidebar-logo {
  height: 30px;
  width: auto;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  position: absolute;
  left: -100px;
  white-space: nowrap;
}

.sidebar-logo img {
  height: 28px;
  width: auto;
}

.left-sidebar:hover .sidebar-logo,
.left-sidebar.active .sidebar-logo {
  opacity: 1;
  transform: translateX(0);
  position: relative;
  left: 0;
}

/* ── Close button ────────────────────────────── */
.sidebar-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-60);
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 10002;
}

.left-sidebar:hover .sidebar-close,
.left-sidebar.active .sidebar-close {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ── Scrollable nav area ─────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.left-sidebar:hover .sidebar-nav,
.left-sidebar.active .sidebar-nav {
  scrollbar-color: var(--border-color) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 0; }
.left-sidebar:hover .sidebar-nav::-webkit-scrollbar,
.left-sidebar.active .sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* ── Section titles (collapsed = hidden) ─────── */
.sidebar-section-title {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-60);
  padding: 0.75rem 0.875rem 0.35rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease 0.08s, max-height 0.25s ease, padding 0.25s ease;
  white-space: nowrap;
  user-select: none;
}

.left-sidebar:hover .sidebar-section-title,
.left-sidebar.active .sidebar-section-title {
  opacity: 1;
  max-height: 40px;
  padding: 0.75rem 1.15rem 0.35rem;
}

/* ── Nav item (link) ─────────────────────────── */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  margin: 0 0.5rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background 0.18s ease,
              color 0.18s ease,
              padding 0.25s ease,
              margin 0.25s ease,
              transform 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  justify-content: center;
  position: relative;
}

.left-sidebar:hover .sidebar-item,
.left-sidebar.active .sidebar-item {
  padding: 0.55rem 0.75rem;
  margin: 0 0.625rem;
  justify-content: flex-start;
}

/* Hover state */
.sidebar-item:hover {
  background: var(--primary-color-10, rgba(99, 102, 241, 0.08));
  color: var(--text-color);
  transform: translateX(2px);
}

/* Active state — gradient accent bar + tinted BG */
.sidebar-item.active {
  background: var(--primary-color-10, rgba(99, 102, 241, 0.1));
  color: var(--primary-color);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color, var(--primary-color)));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.left-sidebar:hover .sidebar-item.active::before,
.left-sidebar.active .sidebar-item.active::before {
  opacity: 1;
}

/* ── Tooltip (collapsed mode only) ───────────── */
.sidebar-item::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.92);
  background: var(--card-background);
  color: var(--text-color);
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  z-index: 10001;
}

.sidebar-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.left-sidebar:hover .sidebar-item::after,
.left-sidebar.active .sidebar-item::after {
  opacity: 0 !important;
  display: none;
}

/* ── Icon containers ─────────────────────────── */
.sidebar-icon {
  font-size: 1.25rem;
  line-height: 1.6;
  flex-shrink: 0;
  width: 32px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 8px;
  overflow: visible;
  transition: background 0.2s ease, transform 0.2s ease;
}

/* WordPress converts emoji to <img class="emoji"> SVGs —
   override inline/vertical-align defaults to fit correctly */
.sidebar-icon img.emoji {
  display: block !important;
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: unset !important;
  border: none !important;
  box-shadow: none !important;
  background: none !important;
}

.sidebar-item:hover .sidebar-icon {
  transform: scale(1.08);
}

.sidebar-item.active .sidebar-icon {
  background: var(--primary-color-15, rgba(99, 102, 241, 0.12));
}

/* ── Labels ──────────────────────────────────── */
.sidebar-label {
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  width: 0;
  transition: opacity 0.2s ease, width 0.25s ease;
}

.left-sidebar:hover .sidebar-label,
.left-sidebar.active .sidebar-label {
  opacity: 1;
  width: auto;
  transition: opacity 0.2s ease 0.08s, width 0.25s ease;
}

/* ── Category count badge (expanded only) ────── */
.sidebar-count {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-60);
  background: var(--card-background-40, rgba(255,255,255,0.06));
  border-radius: 6px;
  flex-shrink: 0;
  /* Collapsed: zero size + no margin so icon stays centered */
  width: 0;
  padding: 0;
  margin-left: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, width 0.25s ease, padding 0.25s ease, margin-left 0.25s ease;
}

.left-sidebar:hover .sidebar-count,
.left-sidebar.active .sidebar-count {
  width: auto;
  padding: 0.125rem 0.4rem;
  margin-left: auto;
  overflow: visible;
  opacity: 1;
  transition: opacity 0.2s ease 0.12s, width 0.25s ease, padding 0.25s ease, margin-left 0.25s ease;
}

.sidebar-item.active .sidebar-count {
  background: var(--primary-color-15, rgba(99, 102, 241, 0.12));
  color: var(--primary-color);
}

/* ── Divider ─────────────────────────────────── */
.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.35rem 0.75rem;
  transition: margin 0.25s ease;
}

.left-sidebar:hover .sidebar-divider,
.left-sidebar.active .sidebar-divider {
  margin: 0.35rem 1rem;
}

/* ── Menu Toggle (in header) ─────────────────── */
.menu-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
}

.menu-toggle:hover {
  background: var(--card-background-40);
}

.menu-toggle svg {
  transition: transform 0.2s ease;
}

.menu-toggle:hover svg {
  transform: scale(1.1);
}

.header-container {
  display: flex;
  align-items: center;
}

/* ── Social links (bottom) ───────────────────── */
.sidebar-social {
  flex-shrink: 0;
  padding: 0.625rem 0;
  border-top: 1px solid var(--border-color);
  width: 100%;
  box-sizing: border-box;
}

.sidebar-social-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  width: 100%;
}

.left-sidebar:hover .sidebar-social-links,
.left-sidebar.active .sidebar-social-links {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0.875rem;
}

.sidebar-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-60);
  text-decoration: none;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.sidebar-social-link:hover {
  color: var(--primary-color);
  background: var(--primary-color-10);
  border-color: var(--primary-color-25);
  transform: translateY(-2px);
}

.sidebar-social-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.left-sidebar:hover .sidebar-social-link,
.left-sidebar.active .sidebar-social-link {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.left-sidebar:hover .sidebar-social-link svg,
.left-sidebar.active .sidebar-social-link svg {
  width: 18px;
  height: 18px;
}

.sidebar-social-link:hover svg {
  transform: scale(1.12);
}

/* ── Body offset ─────────────────────────────── */
body.has-sidebar-nav {
  padding-left: 68px;
  transition: padding-left 0.3s ease;
}

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  body.has-sidebar-nav {
    padding-left: 0;
  }

  .left-sidebar {
    width: 0;
    left: -260px;
    transition: left 0.3s ease, width 0.3s ease;
  }

  .left-sidebar.active {
    width: 260px;
    left: 0;
  }

  .left-sidebar.active .sidebar-close {
    opacity: 1;
    pointer-events: auto;
  }

  .left-sidebar.active .sidebar-logo {
    opacity: 1;
    transform: translateX(0);
    position: relative;
    left: 0;
  }

  .sidebar-overlay.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .sidebar-item {
    padding: 0.7rem 0;
    font-size: 0.875rem;
  }

  .left-sidebar.active .sidebar-item {
    padding: 0.7rem 1rem;
  }

  /* Section titles always visible on mobile when open */
  .left-sidebar.active .sidebar-section-title {
    opacity: 1;
    max-height: 40px;
  }

  .sidebar-social {
    padding: 0.625rem 0;
  }

  .left-sidebar.active .sidebar-social-links {
    gap: 10px;
  }

  .left-sidebar.active .sidebar-social-link {
    width: 38px;
    height: 38px;
  }

  .left-sidebar.active .sidebar-social-link svg {
    width: 20px;
    height: 20px;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .left-sidebar.active {
    width: 100%;
  }
}
