/* ============================================================
   SIDEBAR.CSS - Mobile-responsive Sidebar Layout
   Works on both post.html and index.html pages
   All widget styles handled by main.css
   ============================================================ */

/* ============================================================
   DESKTOP SIDEBAR (Sticky)
   ============================================================ */
.post-sidebar,
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  position: sticky;
  top: var(--spacing-sm);
  height: fit-content;
  max-height: calc(100vh - var(--spacing-lg) * 2);
  overflow-y: auto;
}

/* ============================================================
   MOBILE SIDEBAR (Fixed Overlay)
   ============================================================ */
@media (max-width: 1024px) {
  .post-sidebar,
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -320px !important;
    width: 320px !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--spacing-md) !important;
    background: var(--bg-primary) !important;
    z-index: 998 !important;
    border-left: 1px solid var(--border-color) !important;
    overflow-y: auto !important;
    transition: right 0.3s ease !important;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1) !important;
    max-height: 100vh !important;
    padding: var(--spacing-md) !important;
  }

  .post-sidebar.active,
  .sidebar.active {
    right: 0 !important;
  }
}

/* ============================================================
   SIDEBAR OVERLAY (Mobile)
   ============================================================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 996;
  transition: background var(--duration-base) var(--easing-ease);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

@media (max-width: 1024px) {
  .sidebar-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
  }
}

/* ============================================================
   SIDEBAR MENU TRIGGER (Mobile Button)
   ============================================================ */
.sidebar-menu-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 60px;
  background: var(--accent-color);
  color: var(--text-inverse);
  border: none;
  cursor: pointer;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: var(--z-dropdown);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: 0 var(--spacing-sm);
}

.sidebar-menu-trigger:hover {
  background: var(--accent-dark);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%) translateX(-2px);
}

.sidebar-menu-trigger svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Hide on desktop */
@media (min-width: 1024px) {
  .sidebar-menu-trigger {
    display: none !important;
  }
}

/* ============================================================
   SIDEBAR WIDGET SCROLLBAR (Custom)
   ============================================================ */
.post-sidebar::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.post-sidebar::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.post-sidebar::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.post-sidebar::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}
.sidebar-search-form {
  width: 100%;
}

.sidebar-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search-input {
  width: 100%;
  padding: var(--spacing-xs) var(--spacing-sm);
  padding-right: 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-base);
  font-size: var(--font-size-sm);
  background: var(--bg-primary);
  font-family: inherit;
  transition: var(--transition-fast);
}

.sidebar-search-input:hover {
  border-color: #d0d0d0;
}

.sidebar-search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.sidebar-search-input::placeholder {
  color: var(--text-light);
}

.sidebar-search-btn {
  position: absolute;
  right: var(--spacing-xs);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.sidebar-search-btn:hover {
  color: var(--accent-color);
}

.sidebar-search-btn svg {
  width: 18px;
  height: 18px;
}
