/* ===================================
   SIDEBAR STYLES
   =================================== */

/* Sidebar Container */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 256px;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

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

/* Layout Integration */
.layout-container {
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-color: #f7fafc;
}

.layout-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  margin-left: 0;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.layout-content {
  flex: 1;
  position: relative;
  overflow-y: auto;
  background-color: #f7fafc;
}

.layout-content-inner {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Desktop sidebar always visible */
@media (min-width: 1024px) {
  .sidebar {
    position: fixed;
    transform: translateX(0);
  }
  
  .layout-main {
    margin-left: 256px;
  }
}

/* Mobile backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 20;
  display: none;
}

.sidebar-backdrop.active {
  display: block;
}

@media (min-width: 1024px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.sidebar-logo-text {
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

@media (min-width: 1024px) {
  .sidebar-close-btn {
    display: none;
  }
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  overflow-y: auto;
}

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

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 0 8px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-nav-item:hover::before {
  opacity: 1;
}

.sidebar-nav-item:hover {
  color: white;
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.sidebar-nav-item.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.sidebar-nav-item.active::before {
  opacity: 1;
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  transition: all 0.3s ease;
}

.sidebar-nav-item:hover .sidebar-nav-icon {
  transform: scale(1.1);
}

.sidebar-nav-item.active .sidebar-nav-icon {
  color: #4facfe;
  transform: scale(1.1);
}

.sidebar-nav-text {
  font-weight: 500;
}

/* User Section */
.sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-user-avatar-text {
  color: white;
  font-weight: 600;
  font-size: 12px;
}

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

.sidebar-user-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin: 0;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  transform: scale(1.05);
}

.sidebar-logout-btn svg {
  width: 16px;
  height: 16px;
}

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

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Animation classes */
.sidebar-item-enter {
  opacity: 0;
  transform: translateX(-20px);
}

.sidebar-item-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: all 0.3s ease;
}

.sidebar-item-exit {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-item-exit-active {
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.3s ease;
}

/* Navbar Styles */
.navbar {
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #e5e7eb;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.navbar-menu-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.navbar-search {
  position: relative;
  display: none;
}

.navbar-search input {
  width: 300px;
  padding: 8px 12px 8px 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
}

.navbar-search input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.navbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #9ca3af;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-notification-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.navbar-notification-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.navbar-notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.navbar-user:hover {
  background: #f3f4f6;
}

.navbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
}

.navbar-user-info {
  display: none;
  flex-direction: column;
  align-items: flex-start;
}

.navbar-user-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin: 0;
}

.navbar-user-role {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  text-transform: capitalize;
}

/* Responsive adjustments */
@media (min-width: 640px) {
  .navbar-search {
    display: block;
  }
  
  .navbar-user-info {
    display: flex;
  }
  
  .navbar {
    padding: 0 24px;
  }
}

@media (min-width: 1024px) {
  .navbar-menu-btn {
    display: none;
  }
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    z-index: 40;
  }
  
  .sidebar-nav {
    padding-bottom: 80px; /* Extra space for mobile navigation */
  }
  
  .layout-main {
    margin-left: 0;
  }
}

/* Dark mode variations */
@media (prefers-color-scheme: dark) {
  .sidebar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  }
  
  .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
  }
  
  .sidebar-user {
    border-top-color: rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
  }
}

/* Accessibility improvements */
.sidebar-nav-item:focus {
  outline: 2px solid #4facfe;
  outline-offset: 2px;
}

.sidebar-close-btn:focus,
.sidebar-logout-btn:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Loading states */
.sidebar-loading {
  opacity: 0.6;
  pointer-events: none;
}

.sidebar-loading .sidebar-nav-item {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .sidebar {
    background: #000;
    border-right: 2px solid #fff;
  }
  
  .sidebar-nav-item {
    color: #fff;
    border: 1px solid transparent;
  }
  
  .sidebar-nav-item:hover,
  .sidebar-nav-item.active {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }
}