/* Premium Sidebar Navigation - Tech Innovatives */
:root {
  --sidebar-bg: rgba(255, 255, 255, 0.98);
  --sidebar-width-mobile: min(85vw, 340px);
  --sidebar-width-tablet: 380px;
  --sidebar-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --overlay-bg: rgba(15, 23, 42, 0.4);
  --sidebar-blue: #6096ba;
  --sidebar-blue-dark: #274c77;
  --sidebar-ink: #274c77;
  --sidebar-muted: #8b8c89;
  --sidebar-line: rgba(18, 22, 35, 0.08);
  --sidebar-surface: #e7ecef;
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar Container */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width-mobile);
  background: var(--sidebar-bg);
  box-shadow: var(--sidebar-shadow);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.sidebar.active {
  transform: translateX(0);
}

@media (min-width: 768px) and (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-width-tablet);
  }
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
  overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--sidebar-line);
  background: linear-gradient(180deg, rgba(42, 109, 244, 0.03), transparent);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.sidebar-brand img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--sidebar-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-tagline {
  font-size: 11px;
  color: var(--sidebar-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  width: 100%;
  margin-top: -4px;
}

.sidebar-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: var(--sidebar-surface);
  color: var(--sidebar-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-close:hover {
  background: rgba(42, 109, 244, 0.1);
  color: var(--sidebar-blue);
}

.sidebar-close:focus {
  outline: 2px solid var(--sidebar-blue);
  outline-offset: 2px;
}

/* User Area */
.sidebar-user {
  padding: 20px;
  border-bottom: 1px solid var(--sidebar-line);
  background: var(--sidebar-surface);
}

.sidebar-user-guest {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  width: 100%;
}

.sidebar-user-btn.primary {
  background: linear-gradient(135deg, var(--sidebar-blue), var(--sidebar-blue-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(42, 109, 244, 0.25);
}

.sidebar-user-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(42, 109, 244, 0.3);
}

.sidebar-user-btn.secondary {
  background: white;
  color: var(--sidebar-ink);
  border: 1px solid var(--sidebar-line);
}

.sidebar-user-btn.secondary:hover {
  background: var(--sidebar-surface);
  border-color: var(--sidebar-blue);
}

.sidebar-user-btn.google {
  background: white;
  color: var(--sidebar-ink);
  border: 1px solid var(--sidebar-line);
}

.sidebar-user-btn.google:hover {
  background: var(--sidebar-surface);
}

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-line);
  margin: 8px 0;
}

.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--sidebar-blue), var(--sidebar-blue-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.sidebar-user-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--sidebar-ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 12px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(42, 109, 244, 0.1);
  color: var(--sidebar-blue);
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Navigation Section */
.sidebar-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-line);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sidebar-muted);
  margin-bottom: 12px;
  padding-left: 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-surface);
  color: var(--sidebar-blue);
}

.sidebar-nav-item.active {
  background: rgba(42, 109, 244, 0.08);
  color: var(--sidebar-blue);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--sidebar-blue);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav-item:focus {
  outline: none;
  background: var(--sidebar-surface);
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2;
}

/* Marketplace Accordion */
.sidebar-accordion {
  border: 1px solid var(--sidebar-line);
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.sidebar-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sidebar-accordion-header:hover {
  background: var(--sidebar-surface);
}

.sidebar-accordion-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-ink);
}

.sidebar-accordion-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2;
  transition: transform 0.3s ease;
}

.sidebar-accordion.open .sidebar-accordion-icon {
  transform: rotate(180deg);
}

.sidebar-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-accordion.open .sidebar-accordion-content {
  max-height: 500px;
}

.sidebar-category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
}

.sidebar-category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--sidebar-surface);
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-category-item:hover {
  background: rgba(42, 109, 244, 0.08);
  color: var(--sidebar-blue);
}

.sidebar-category-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}

/* Quick Actions */
.sidebar-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-line);
}

.sidebar-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px;
  border-radius: 12px;
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
}

.sidebar-quick-btn:hover {
  background: rgba(42, 109, 244, 0.08);
  border-color: var(--sidebar-blue);
  color: var(--sidebar-blue);
  transform: translateY(-2px);
}

.sidebar-quick-btn-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* Legal Links */
.sidebar-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-line);
}

.sidebar-legal-link {
  font-size: 12px;
  color: var(--sidebar-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.sidebar-legal-link:hover {
  color: var(--sidebar-blue);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  background: var(--sidebar-surface);
  border-top: 1px solid var(--sidebar-line);
}

.sidebar-footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.sidebar-version {
  font-size: 11px;
  color: var(--sidebar-muted);
}

.sidebar-copyright {
  font-size: 11px;
  color: var(--sidebar-muted);
}

.sidebar-social {
  display: flex;
  gap: 8px;
}

.sidebar-social-link {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--sidebar-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-muted);
  transition: all 0.2s ease;
}

.sidebar-social-link:hover {
  background: var(--sidebar-blue);
  border-color: var(--sidebar-blue);
  color: white;
}

.sidebar-social-link svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Hamburger Menu Button */
.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--sidebar-surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1001;
}

.sidebar-toggle:hover {
  background: rgba(42, 109, 244, 0.1);
}

.sidebar-toggle:focus {
  outline: 2px solid var(--sidebar-blue);
  outline-offset: 2px;
}

.sidebar-toggle-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  color: var(--sidebar-ink);
}

@media (max-width: 1024px) {
  .sidebar-toggle {
    display: flex;
  }
}

/* Ripple Effect */
.sidebar-nav-item,
.sidebar-quick-btn,
.sidebar-category-item,
.sidebar-user-btn {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(42, 109, 244, 0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Accessibility */
.sidebar-nav-item:focus-visible,
.sidebar-quick-btn:focus-visible,
.sidebar-category-item:focus-visible,
.sidebar-user-btn:focus-visible,
.sidebar-close:focus-visible,
.sidebar-toggle:focus-visible {
  outline: 2px solid var(--sidebar-blue);
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-overlay,
  .sidebar-accordion-content,
  .sidebar-accordion-icon {
    transition: none;
  }
  
  .ripple {
    display: none;
  }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

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

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

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--sidebar-muted);
}
