/* Icon Sidebar - Google Classroom Style */
/* Always visible icon rail that expands on hover */

/* Icon Sidebar Rail - Always Visible */
.icon-sidebar {
  position: fixed;
  top: 73px; /* Match header height */
  left: 0;
  height: calc(100vh - 73px);
  width: 56px;
  background: #FFFFFF !important;
  border-right: none;
  z-index: 100; /* Below header (1100) */
  display: flex;
  flex-direction: column;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease, border-radius 0.4s ease;
  overflow: hidden;
  border-bottom-right-radius: 32px; /* Curve on bottom-right when collapsed */
  border-top-right-radius: 0; /* No curve on top */
}

.icon-sidebar:hover,
.icon-sidebar.expanded {
  border-bottom-right-radius: 32px; /* Maintain curve on bottom-right when expanded */
  border-top-right-radius: 0; /* Keep top straight */
}

/* Corner fill to connect header and sidebar */
.sidebar-corner-fill {
  position: fixed;
  top: 0;
  left: 0;
  width: 56px;
  height: 73px;
  background: #FFFFFF;
  z-index: 1099; /* Below header (1100) so sidebar doesn't overlap header */
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: none;
  border-right: none; /* Seamless with header */
}

.corner-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.corner-logo:hover {
  background: #F3F4F6;
  transform: scale(1.05);
}

.icon-sidebar:hover:not(.hover-prevented),
.icon-sidebar.expanded {
  width: 256px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.icon-sidebar.edit-mode {
  width: 300px; /* Wider for easier customization */
}

/* Header Spacer - No longer needed as sidebar starts below header */
.icon-sidebar-spacer {
  display: none;
}

/* Navigation Container */
.icon-sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.icon-sidebar-nav::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Navigation Sections */
.icon-nav-section {
  margin-bottom: 8px;
}

.icon-nav-section-title {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9CA3AF;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.icon-sidebar:hover .icon-nav-section-title,
.icon-sidebar.expanded .icon-nav-section-title {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

/* Navigation Items */
.icon-nav-item {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 48px;
  text-decoration: none;
  color: #374151;
  transition: all 0.15s ease;
  border-radius: 0;
  position: relative;
}

.icon-nav-item:hover {
  background: #F3F4F6;
}

.icon-nav-item.active {
  background: #EFF6FF;
  color: #2563EB;
}

.icon-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: #2563EB;
  border-radius: 0 2px 2px 0;
}

/* Icon Container */
.icon-nav-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.icon-nav-item:hover .icon-nav-icon {
  background: rgba(0, 0, 0, 0.04);
}

.icon-sidebar:hover .icon-nav-item:hover .icon-nav-icon,
.icon-sidebar.expanded .icon-nav-item:hover .icon-nav-icon {
  background: transparent;
}

.icon-nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
  color: #6B7280;
  transition: color 0.15s ease;
}

.icon-nav-item:hover .icon-nav-icon svg {
  color: #374151;
}

.icon-nav-item.active .icon-nav-icon svg {
  color: #2563EB;
}

/* Nav Text Label */
.icon-nav-text {
  margin-left: 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.icon-sidebar:hover .icon-nav-text,
.icon-sidebar.expanded .icon-nav-text {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

/* Sidebar Footer / User Section */
.icon-sidebar-footer {
  padding: 8px;
  border-top: 1px solid #F3F4F6;
  flex-shrink: 0;
}

/* Customize Button Specifics */
.icon-sidebar-footer .icon-nav-item {
  height: 32px; /* Smaller height */
  border-radius: 8px;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  padding: 0 8px; /* Reduced padding */
}

.icon-sidebar-footer .icon-nav-item:hover {
  background: #F3F4F6;
}

.icon-sidebar-footer .icon-nav-icon {
  width: 24px; /* Smaller icon container */
  height: 24px;
}

.icon-sidebar-footer .icon-nav-icon svg {
  width: 16px; /* Smaller icon */
  height: 16px;
}

.icon-sidebar-footer .icon-nav-text {
  font-size: 13px; /* Smaller text */
  margin-left: 8px;
}

/* Sidebar Avatar */
.icon-sidebar-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: 14px;
  flex-shrink: 0;
}

.icon-sidebar-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.icon-sidebar-user-info {
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
  min-width: 0;
}

.icon-sidebar:hover .icon-sidebar-user-info,
.icon-sidebar.expanded .icon-sidebar-user-info {
  opacity: 1;
}

.icon-sidebar-user-name {
  font-weight: 600;
  font-size: 14px;
  color: #1F2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-sidebar-user-email {
  font-size: 12px;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tooltip for collapsed state */
.icon-nav-item[data-tooltip] {
  position: relative;
}

.icon-nav-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 64px;
  top: 50%;
  transform: translateY(-50%);
  background: #1F2937;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.icon-nav-item[data-tooltip]::before {
  content: '';
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #1F2937;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Show tooltip only when sidebar is collapsed */
.icon-sidebar:not(:hover):not(.expanded) .icon-nav-item[data-tooltip]:hover::after,
.icon-sidebar:not(:hover):not(.expanded) .icon-nav-item[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Adjust main content margin */
body.has-icon-sidebar {
  /* Content margin handled by individual containers */
}

body.has-icon-sidebar .site-header {
  /* Header positioning is handled in header-content.css */
  /* left: 56px and width: calc(100% - 56px) already set there */
}

/* Hide hamburger when using icon sidebar */
body.has-icon-sidebar .hamburger-btn,
body.has-icon-sidebar .hamburger-nav {
  display: none !important;
}

/* Hide old sidebar elements */
body.has-icon-sidebar .sidebar-overlay,
body.has-icon-sidebar .modern-sidebar,
body.has-icon-sidebar .app-sidebar {
  display: none !important;
}

/* Mobile Responsive - Revert to hamburger menu on small screens */
@media (max-width: 768px) {
  .icon-sidebar {
    display: none;
  }
  
  .sidebar-corner-fill {
    display: none;
  }
  
  body.has-icon-sidebar {
    margin-left: 0;
  }
  
  body.has-icon-sidebar .site-header {
    left: 0;
    width: 100%;
  }
  
  body.has-icon-sidebar .hamburger-btn,
  body.has-icon-sidebar .hamburger-nav {
    display: flex !important;
  }
  
  body.has-icon-sidebar .sidebar-overlay,
  body.has-icon-sidebar .modern-sidebar {
    display: flex !important;
  }
}

/* Theme Support - Light mode forced for sidebar */
/* prefers-color-scheme dark mode removed to keep sidebar always white */

/* Dark theme overrides removed - sidebar stays white always */
/* Sidebar uses consistent light styling for a clean look */

/* Edit Mode Styles */
.visibility-toggle {
  display: none;
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #3B82F6;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.icon-sidebar.edit-mode .visibility-toggle {
  display: flex;
}

.icon-sidebar.edit-mode .icon-nav-item {
  position: relative; /* For absolute positioning of toggle */
  border: 1px dashed rgba(0, 0, 0, 0.1); /* Light dashed border for light theme */
}

.icon-sidebar.edit-mode .icon-nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Hidden Item Styles */
.icon-nav-item.hidden-item {
  opacity: 0.5;
  filter: grayscale(100%);
}

.icon-nav-item.hidden-item .visibility-toggle {
  background: #EF4444; /* Red for hidden */
}

/* Hide items completely when not in edit mode */
.icon-sidebar:not(.edit-mode) .icon-nav-item.hidden-item {
  display: none !important;
}

/* Customize Button Active State */
.icon-sidebar.edit-mode #sidebar-customize-btn {
  background: #3B82F6;
  color: white;
}

