/* ============================================================
   BAKERYLY BLOG — SIDEBAR STYLESHEET
   ============================================================ */

/* ── Sidebar Column ── */
.sidebar-column {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  max-height: calc(100vh - var(--header-height) - var(--space-12));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar-column::-webkit-scrollbar {
  width: 4px;
}
.sidebar-column::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-column::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

/* ── Search Box ── */
.sidebar-search {
  position: relative;
  margin-bottom: var(--space-6);
}

.sidebar-search input {
  width: 100%;
  padding: 9px 36px 9px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  background: var(--color-white);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.sidebar-search input::placeholder {
  color: var(--color-text-muted);
}

.sidebar-search input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108,62,244,0.12);
}

.sidebar-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.sidebar-search-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Table of Contents ── */
.toc-widget {
  margin-bottom: var(--space-6);
}

.sidebar-widget-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: 0.01em;
}

.toc-list {
  list-style: none;
  counter-reset: toc-counter;
}

.toc-list li {
  counter-increment: toc-counter;
  margin-bottom: var(--space-2);
}

.toc-list li a {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.toc-list li a::before {
  content: counter(toc-counter) ".";
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  min-width: 18px;
  flex-shrink: 0;
  padding-top: 1px;
}

.toc-list li a:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.toc-list li a.active {
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-light);
}

.toc-list li a.active::before {
  color: var(--color-primary);
}

/* ── Sidebar CTA Widget ── */
.sidebar-cta-widget {
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  border: 1px solid rgba(108,62,244,0.15);
  transition: box-shadow var(--transition-base);
}

.sidebar-cta-widget:hover {
  box-shadow: var(--shadow-md);
}

.sidebar-cta-widget h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
  line-height: 1.3;
}

.sidebar-cta-features {
  list-style: none;
  margin-bottom: var(--space-4);
}

.sidebar-cta-features li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.sidebar-cta-features li .check-icon {
  width: 15px;
  height: 15px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-cta-features li .check-icon svg {
  width: 8px;
  height: 8px;
  fill: white;
}

/* App Preview in Sidebar */
.sidebar-app-preview {
  background: var(--color-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.sidebar-app-topbar {
  background: var(--color-bg);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--color-border-light);
}

.sidebar-app-topbar-dots {
  display: flex;
  gap: 3px;
}

.sidebar-app-topbar-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.sidebar-app-topbar-title {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 500;
  flex: 1;
  text-align: center;
}

.sidebar-app-body {
  padding: 10px;
}

.sidebar-app-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--color-border-light);
}

.sidebar-app-row:last-child {
  border-bottom: none;
}

.sidebar-app-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar-app-info {
  flex: 1;
}

.sidebar-app-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.sidebar-app-date {
  font-size: 9px;
  color: var(--color-text-muted);
}

.sidebar-app-status {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 20px;
}

.sidebar-cta-widget .btn-primary {
  width: 100%;
  justify-content: center;
  font-size: var(--font-size-sm);
  padding: 11px 20px;
}

.sidebar-cta-no-cc {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* ── Popular Posts ── */
.popular-posts-widget {
  margin-bottom: var(--space-6);
}

.popular-post-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
}

.popular-post-item:last-child {
  border-bottom: none;
}

.popular-post-item:hover .popular-post-title {
  color: var(--color-primary);
}

.popular-post-thumb {
  width: 64px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-bg-alt);
  overflow: hidden;
}

.popular-post-thumb-placeholder {
  width: 64px;
  height: 50px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.popular-post-info {
  flex: 1;
  min-width: 0;
}

.popular-post-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
  transition: color var(--transition-fast);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-post-read {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}
