/* ==========================================================================
   VantorKit Sidebar & Favorites System
   Scoped CSS: All rules prefixed with .vk-sidebar-*
   Dark SaaS Design Tokens & Full RTL / LTR Compliance
   ========================================================================== */

/* --- Hamburger Toggle Button in Navbar --- */
.vk-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main, #f8fafc);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  outline: none;
}

.vk-sidebar-toggle:hover,
.vk-sidebar-toggle:focus-visible {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(30, 41, 59, 0.85);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  transform: scale(1.04);
}

.vk-sidebar-toggle[aria-expanded="true"] {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

.vk-sidebar-toggle-icon {
  width: 20px;
  height: 20px;
  display: block;
}

/* Helper Brand/Toggle Wrapper if needed */
.vk-sidebar-nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vk-sidebar-meta-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-inline-start: auto;
}

/* --- Favorite Star Button on Homepage Cards --- */
.vk-sidebar-fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  z-index: 2;
  position: relative;
  outline: none;
}

.vk-sidebar-fav-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  transform: scale(1.08);
}

.vk-sidebar-fav-btn.vk-sidebar-fav-active {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.5);
  color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.vk-sidebar-fav-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease, fill 0.2s ease;
}

.vk-sidebar-fav-btn.vk-sidebar-fav-active .vk-sidebar-fav-icon {
  fill: #f59e0b;
  transform: scale(1.05);
}

/* --- Backdrop Overlay --- */
.vk-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
  cursor: pointer;
}

.vk-sidebar-backdrop.vk-sidebar-open {
  opacity: 1;
  visibility: visible;
}

/* --- Sidebar Drawer (Overlay) --- */
.vk-sidebar-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: 340px;
  max-width: 80vw;
  background: rgba(9, 12, 20, 0.97);
  background-image: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.07) 0%, transparent 65%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-left: none;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), visibility 220ms ease;
  will-change: transform;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main, #f8fafc);
}

.vk-sidebar-drawer.vk-sidebar-open {
  transform: translateX(0);
  visibility: visible;
}

/* --- RTL Drawer Placement & Direction --- */
html[dir="rtl"] .vk-sidebar-drawer {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(100%);
  font-family: 'Cairo', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: right;
}

html[dir="rtl"] .vk-sidebar-drawer.vk-sidebar-open {
  transform: translateX(0);
  visibility: visible;
}

/* Body scroll lock when sidebar is open */
body.vk-sidebar-body-lock {
  overflow: hidden !important;
}

/* --- Sidebar Header --- */
.vk-sidebar-header {
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 23, 42, 0.4);
  flex-shrink: 0;
}

.vk-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.vk-sidebar-brand-svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.vk-sidebar-brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}

.vk-sidebar-brand-title span {
  background: linear-gradient(135deg, #38bdf8 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.vk-sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.vk-sidebar-close:hover,
.vk-sidebar-close:focus-visible {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  transform: scale(1.05);
}

/* --- Sidebar Scrollable Body --- */
.vk-sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.vk-sidebar-body::-webkit-scrollbar {
  width: 5px;
}

.vk-sidebar-body::-webkit-scrollbar-track {
  background: transparent;
}

.vk-sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

/* --- Section Headers --- */
.vk-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.vk-sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0 0.25rem;
}

.vk-sidebar-section-icon {
  width: 13px;
  height: 13px;
  color: #38bdf8;
  opacity: 0.85;
}

.vk-sidebar-section-icon.vk-sidebar-icon-fav {
  color: #f59e0b;
}

.vk-sidebar-section-icon.vk-sidebar-icon-cat {
  color: #a855f7;
}

/* --- Tool Lists & Items (Recently Used & Favorites) --- */
.vk-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vk-sidebar-tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: var(--text-main, #f8fafc);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.vk-sidebar-tool-item:hover,
.vk-sidebar-tool-item:focus-visible {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[dir="rtl"] .vk-sidebar-tool-item:hover,
html[dir="rtl"] .vk-sidebar-tool-item:focus-visible {
  transform: translateX(-3px);
}

.vk-sidebar-tool-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.vk-sidebar-tool-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  flex-shrink: 0;
}

.vk-sidebar-tool-icon svg {
  width: 15px;
  height: 15px;
}

.vk-sidebar-tool-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.vk-sidebar-tool-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vk-sidebar-tool-cat {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
}

.vk-sidebar-tool-arrow {
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
  margin-left: 0.35rem;
}

html[dir="rtl"] .vk-sidebar-tool-arrow {
  margin-left: 0;
  margin-right: 0.35rem;
  transform: rotate(180deg);
}

.vk-sidebar-tool-item:hover .vk-sidebar-tool-arrow {
  color: #38bdf8;
  transform: translateX(2px);
}

html[dir="rtl"] .vk-sidebar-tool-item:hover .vk-sidebar-tool-arrow {
  transform: rotate(180deg) translateX(2px);
}

/* Unstar button in favorites item */
.vk-sidebar-tool-unstar {
  background: none;
  border: none;
  color: #f59e0b;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
  outline: none;
}

.vk-sidebar-tool-unstar:hover {
  color: #ef4444;
  transform: scale(1.15);
}

/* --- Empty State --- */
.vk-sidebar-empty {
  padding: 1.1rem 0.85rem;
  text-align: center;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.vk-sidebar-empty-icon {
  width: 22px;
  height: 22px;
  color: #475569;
  margin-bottom: 0.15rem;
}

.vk-sidebar-empty-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
}

.vk-sidebar-empty-sub {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
}

/* --- Categories Section --- */
.vk-sidebar-cat-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vk-sidebar-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: var(--text-main, #f8fafc);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.vk-sidebar-cat-item:hover,
.vk-sidebar-cat-item:focus-visible {
  background: rgba(30, 41, 59, 0.7);
  transform: translateX(3px);
}

html[dir="rtl"] .vk-sidebar-cat-item:hover,
html[dir="rtl"] .vk-sidebar-cat-item:focus-visible {
  transform: translateX(-3px);
}

.vk-sidebar-cat-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.vk-sidebar-cat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Specific category theme colors matching homepage */
.vk-sidebar-cat-item[data-cat="all"] .vk-sidebar-cat-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
.vk-sidebar-cat-item[data-cat="all"]:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.vk-sidebar-cat-item[data-cat="math"] .vk-sidebar-cat-dot {
  background: var(--cat-math, #34d399);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}
.vk-sidebar-cat-item[data-cat="math"]:hover {
  border-color: rgba(52, 211, 153, 0.4);
}

.vk-sidebar-cat-item[data-cat="files"] .vk-sidebar-cat-dot {
  background: var(--cat-files, #fb923c);
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.4);
}
.vk-sidebar-cat-item[data-cat="files"]:hover {
  border-color: rgba(251, 146, 60, 0.4);
}

.vk-sidebar-cat-item[data-cat="images"] .vk-sidebar-cat-dot {
  background: var(--cat-images, #f472b6);
  box-shadow: 0 0 8px rgba(244, 114, 182, 0.4);
}
.vk-sidebar-cat-item[data-cat="images"]:hover {
  border-color: rgba(244, 114, 182, 0.4);
}

.vk-sidebar-cat-item[data-cat="text"] .vk-sidebar-cat-dot {
  background: var(--cat-text, #c084fc);
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.4);
}
.vk-sidebar-cat-item[data-cat="text"]:hover {
  border-color: rgba(192, 132, 252, 0.4);
}

.vk-sidebar-cat-item[data-cat="everyday"] .vk-sidebar-cat-dot {
  background: var(--cat-everyday, #60a5fa);
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}
.vk-sidebar-cat-item[data-cat="everyday"]:hover {
  border-color: rgba(96, 165, 250, 0.4);
}

.vk-sidebar-cat-arrow {
  color: #64748b;
  font-size: 0.75rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

html[dir="rtl"] .vk-sidebar-cat-arrow {
  transform: rotate(180deg);
}

.vk-sidebar-cat-item:hover .vk-sidebar-cat-arrow {
  color: #fff;
  transform: translateX(2px);
}

html[dir="rtl"] .vk-sidebar-cat-item:hover .vk-sidebar-cat-arrow {
  transform: rotate(180deg) translateX(2px);
}

/* --- Sidebar Footer --- */
.vk-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
}

.vk-sidebar-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.vk-sidebar-footer-link:hover,
.vk-sidebar-footer-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.vk-sidebar-footer-link svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Global Footer GitHub Link
   Styles the GitHub repository icon link in the global footer across all pages
   ========================================================================== */
.vk-sidebar-github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.vk-sidebar-github-link .vk-sidebar-github-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.vk-sidebar-github-link:hover .vk-sidebar-github-icon {
  transform: scale(1.12);
}

.vk-sidebar-github-link:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}


