:root {
  --sidebar-width: 280px;
  --sidebar-bg: #ffffff;
  --sidebar-border: #db2777;
  --sidebar-text: #334155;
  --sidebar-header-bg: #f8fafc;
  --sidebar-item-bg: #f1f5f9;
  --sidebar-item-border: #e2e8f0;
  --sidebar-item-hover: #fce7f3;
  --sidebar-accent: #db2777;
  --transition: 0.3s ease;
}

.dark {
  --sidebar-bg: #1e293b;
  --sidebar-border: #f9a8d4;
  --sidebar-text: #cbd5e1;
  --sidebar-header-bg: #0f172a;
  --sidebar-item-bg: #334155;
  --sidebar-item-border: #475569;
  --sidebar-item-hover: rgba(249, 168, 212, 0.2);
  --sidebar-accent: #f9a8d4;
}

#sidebar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9000;
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 2px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 9001;
  pointer-events: all;
  transform: translateX(-100%);
  transition: transform var(--transition);
}

#sidebar.sidebar-visible {
  transform: translateX(0);
}

#sidebar.sidebar-hidden {
  transform: translateX(-100%);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--sidebar-header-bg);
  border-bottom: 2px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-title {
  color: var(--sidebar-accent);
  font-size: 18px;
  margin: 0;
  font-weight: bold;
  letter-spacing: 1px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
}

.close-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.close-btn:hover {
  color: var(--sidebar-accent);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0;
}

.sidebar-section {
  padding: 0 15px;
  margin-bottom: 20px;
}

.sidebar-section:first-of-type {
  margin-bottom: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5px;
  margin-bottom: 12px;
  border-top: 1px solid var(--sidebar-item-border);
  padding-top: 12px;
}

.section-title {
  color: var(--sidebar-text);
  font-size: 12px;
  margin: 0;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count-badge {
  background: var(--sidebar-accent);
  color: white;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  background: var(--sidebar-item-bg);
  color: var(--sidebar-text);
  text-decoration: none;
  border: 1px solid var(--sidebar-item-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item:hover {
  background: var(--sidebar-item-hover);
  border-color: var(--sidebar-accent);
  color: var(--sidebar-accent);
  transform: translateX(4px);
}

.sidebar-item.active {
  background: var(--sidebar-accent);
  border-color: var(--sidebar-accent);
  color: white;
}

.sidebar-item .icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-item .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-home {
  background: linear-gradient(135deg, var(--sidebar-accent) 0%, #ec4899 100%);
  border: none;
  margin-bottom: 15px;
  font-weight: bold;
  color: white;
}

.back-home:hover {
  background: linear-gradient(135deg, #ec4899 0%, var(--sidebar-accent) 100%);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-item-border);
  padding: 15px;
}

.signout-btn {
  background: #ef4444;
  border: 1px solid #dc2626;
  color: white;
}

.signout-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.signin-link {
  background: var(--sidebar-accent);
  border: 1px solid var(--sidebar-accent);
  color: white;
}

.signin-link:hover {
  background: #ec4899;
  border-color: #ec4899;
  color: white;
}

.loading-state,
.empty-state {
  color: var(--sidebar-text);
  opacity: 0.6;
  font-size: 11px;
  padding: 15px 10px;
  text-align: center;
  font-style: italic;
}

.subscription-item,
.liked-video-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--sidebar-item-bg);
  border: 1px solid var(--sidebar-item-border);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--sidebar-text);
}

.subscription-item:hover,
.liked-video-item:hover {
  background: var(--sidebar-item-hover);
  border-color: var(--sidebar-accent);
  transform: translateX(2px);
}

.item-thumbnail {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--sidebar-item-border);
}

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

.item-title {
  color: var(--sidebar-text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  color: var(--sidebar-text);
  opacity: 0.6;
  font-size: 9px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle-btn {
  position: fixed;
  top: 100px;
  left: 20px;
  z-index: 8999;
  background: var(--sidebar-accent);
  color: white;
  border: none;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition: all 0.3s;
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  overflow: visible;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px !important;
  height: 24px !important;
  pointer-events: none;
}

.sidebar-toggle-icon svg {
  width: 24px !important;
  height: 24px !important;
  display: block;
  pointer-events: none;
}

.sidebar-toggle-btn:hover {
  background: #ec4899;
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 8998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

#sidebar-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: var(--sidebar-bg);
}

#sidebar::-webkit-scrollbar-thumb {
  background: var(--sidebar-accent);
  border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: #ec4899;
}

@media (max-width: 1023px) {
  #sidebar {
    width: 100%;
    max-width: var(--sidebar-width);
  }

  .sidebar-item:hover {
    transform: none;
  }

  .subscription-item:hover,
  .liked-video-item:hover {
    transform: none;
  }

  .sidebar-footer {
    padding: 10px;
  }

  .sidebar-item {
    padding: 10px 8px;
    font-size: 12px;
    gap: 8px;
  }

  .sidebar-item .icon {
    width: 18px;
    flex-shrink: 0;
  }

  .sidebar-item .label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-section {
    padding: 0 10px;
  }

  .section-header {
    padding: 0 3px;
  }
}
