/**
 * Sidebar Navigation Styles
 * Universal left-hand navigation for all pages
 * Version: 1.0.0
 * Date: November 25, 2025
 */

/* ===== LAYOUT STRUCTURE ===== */
body.sidebar-layout {
  display: flex;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* ===== PAGE HEADER (UNIVERSAL TOP BAR) ===== */
.page-header {
  position: static;
  z-index: 1000;
  background: linear-gradient(135deg, 
    rgba(0, 48, 87, 0.98) 0%, 
    rgba(0, 65, 115, 0.98) 20%,
    rgba(0, 80, 140, 0.98) 35%, 
    rgba(0, 65, 115, 0.98) 50%,
    rgba(0, 50, 90, 0.98) 65%, 
    rgba(0, 35, 65, 0.98) 80%,
    rgba(0, 48, 87, 0.98) 100%);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border-bottom: 2px solid rgba(96, 165, 250, 0.4);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.25),
    0 6px 16px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  margin-bottom: 1.5rem;
  min-height: 64px;
  max-height: 64px;
  height: 64px;
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.3s ease;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(96, 165, 250, 0.6) 15%,
    rgba(147, 197, 253, 0.8) 50%, 
    rgba(96, 165, 250, 0.6) 85%,
    transparent 100%);
  box-shadow: 
    0 2px 12px rgba(96, 165, 250, 0.5),
    0 4px 20px rgba(96, 165, 250, 0.3);
  animation: headerGlow 3s ease-in-out infinite;
}

@keyframes headerGlow {
  0%, 100% { 
    opacity: 0.8;
    filter: brightness(1);
  }
  50% { 
    opacity: 1;
    filter: brightness(1.15);
  }
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.page-crest {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3))
          drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s ease;
}

.page-crest:hover {
  transform: scale(1.06) translateY(-2px);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35))
          drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25))
          drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
}

.page-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.3),
               0 2px 4px rgba(0, 0, 0, 0.2),
               0 1px 2px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.page-header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 2rem;
}

.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0.625rem 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.25),
    0 2px 6px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.welcome-message:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(96, 165, 250, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.welcome-text {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

.welcome-name {
  font-size: 0.9375rem;
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0.98) 0%, 
    rgba(250, 251, 252, 0.98) 40%, 
    rgba(248, 250, 252, 0.98) 60%, 
    rgba(255, 255, 255, 0.98) 100%);
  border-right: 2px solid rgba(96, 165, 250, 0.15);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    8px 0 32px rgba(0, 0, 0, 0.08),
    4px 0 16px rgba(0, 0, 0, 0.05),
    2px 0 6px rgba(0, 0, 0, 0.03),
    inset -1px 0 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  overflow: hidden;
}

/* Collapsed sidebar - icon-only mode */
.sidebar.collapsed {
  width: 60px;
  overflow-x: hidden;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer-text {
  display: none;
}

.sidebar.collapsed .nav-icon {
  margin-right: 0;
  font-size: 1.1rem;
}

.sidebar.collapsed .sidebar-nav a {
  justify-content: center;
  padding: 0.65rem;
  margin: 0;
  width: 100%;
}

.sidebar.collapsed .sidebar-logo {
  width: 28px;
  height: 28px;
}

.sidebar.collapsed .sidebar-toggle-btn span {
  transform: rotate(180deg);
}

/* Collapsed footer adjustments */
.sidebar.collapsed .staff-profile {
  flex-direction: column;
  padding: 0.5rem;
  gap: 0.25rem;
}

.sidebar.collapsed .staff-avatar {
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
}

.sidebar.collapsed .staff-name-sidebar {
  display: none;
}

.sidebar.collapsed .sidebar-logout {
  padding: 0.65rem;
  justify-content: center;
}

.sidebar.collapsed .sidebar-logout span:not(.nav-icon) {
  display: none;
}

/* Left accent stripe for visual interest */
.sidebar::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(102, 0, 0, 0.6) 20%,
    rgba(136, 0, 0, 0.7) 50%,
    rgba(102, 0, 0, 0.6) 80%,
    transparent 100%);
  opacity: 0.8;
  z-index: 1;
}

/* Right edge gradient */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, 
    transparent 0%, 
    rgba(59, 130, 246, 0.2) 30%,
    rgba(59, 130, 246, 0.25) 50%,
    rgba(59, 130, 246, 0.2) 70%,
    transparent 100%);
  pointer-events: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
  position: absolute;
  top: 1rem;
  right: -14px;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1101;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4), 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5), 0 6px 20px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle-btn span {
  color: white;
  font-size: 1rem;
  font-weight: bold;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.sidebar-toggle-btn:active {
  transform: scale(0.95);
}

/* ===== SIDEBAR HEADER ===== */
.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.8);
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 50%, #f8fafc 100%);
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(96, 165, 250, 0.5) 30%,
    rgba(147, 197, 253, 0.7) 50%,
    rgba(96, 165, 250, 0.5) 70%,
    transparent 100%);
  box-shadow: 
    0 2px 12px rgba(96, 165, 250, 0.4),
    0 4px 20px rgba(96, 165, 250, 0.2);
  animation: sidebarGlow 3s ease-in-out infinite;
}

@keyframes sidebarGlow {
  0%, 100% { 
    opacity: 0.75;
  }
  50% { 
    opacity: 1;
  }
}

.sidebar-logo {
  width: 70px;
  height: 70px;
  margin-bottom: 0.5rem;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12))
          drop-shadow(0 1px 3px rgba(0, 0, 0, 0.08));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              filter 0.3s ease;
}

.sidebar-logo:hover {
  transform: scale(1.06) translateY(-2px);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15))
          drop-shadow(0 3px 6px rgba(0, 0, 0, 0.1))
          drop-shadow(0 0 16px rgba(59, 130, 246, 0.2));
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #003057;
  margin: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #003057 0%, #0066cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== NAVIGATION MENU ===== */
.sidebar-nav {
  flex: 1 1 auto;
  padding: 1rem 0.5rem;
  list-style: none;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.3) transparent;
}

/* Custom scrollbar for webkit browsers */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.3);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.5);
}

/* Admin menu visibility control */
/* Admin menu item - always visible */
.sidebar-nav .admin-menu-item {
  display: block;
}

.sidebar-nav .admin-menu-item.visible {
  display: block;
}

.sidebar-nav li {
  margin: 0 0 0.375rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #64748b;
  text-decoration: none;
  transition: all 0.25s ease;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  font-weight: 500;
  font-size: 0.875rem;
  position: relative;
  margin-left: 0.5rem;
}

/* Responsive sidebar spacing - prevent scrolling */
@media (max-height: 900px) {
  .sidebar-nav {
    padding: 0.75rem 0.5rem;
  }
  
  .sidebar-nav li {
    margin: 0 0 0.25rem 0;
  }
  
  .sidebar-nav a {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    gap: 0.625rem;
  }
  
  .sidebar-nav .nav-icon {
    font-size: 1.125rem;
    width: 24px;
  }
}

@media (max-height: 800px) {
  .sidebar-header {
    padding: 1rem;
  }
  
  .sidebar-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 0.375rem;
  }
  
  .sidebar-title {
    font-size: 1.125rem;
  }
  
  .sidebar-nav {
    padding: 0.5rem 0.5rem;
  }
  
  .sidebar-nav li {
    margin: 0 0 0.2rem 0;
  }
  
  .sidebar-nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .sidebar-footer {
    padding: 0.75rem;
  }
  
  .staff-profile {
    padding: 0.625rem;
    margin-bottom: 0.5rem;
  }
  
  .sidebar-logout {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }
}

@media (max-height: 700px) {
  .sidebar-header {
    padding: 0.75rem;
  }
  
  .sidebar-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 0.25rem;
  }
  
  .sidebar-title {
    font-size: 1rem;
  }
  
  .sidebar-nav {
    padding: 0.375rem 0.5rem;
  }
  
  .sidebar-nav li {
    margin: 0 0 0.15rem 0;
  }
  
  .sidebar-nav a {
    padding: 0.4rem 0.625rem;
    font-size: 0.75rem;
    gap: 0.5rem;
  }
  
  .sidebar-nav .nav-icon {
    font-size: 1rem;
    width: 20px;
  }
  
  .sidebar-footer {
    padding: 0.625rem;
  }
  
  .staff-profile {
    padding: 0.5rem;
    margin-bottom: 0.375rem;
    gap: 0.5rem;
  }
  
  .staff-avatar {
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
  }
  
  .staff-name-sidebar {
    font-size: 0.8125rem;
  }
  
  .sidebar-logout {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    gap: 0.5rem;
  }
  
  .sidebar-logout .nav-icon {
    font-size: 1.125rem;
  }
}

/* Even smaller heights - very compact mode */
@media (max-height: 600px) {
  .sidebar-header {
    padding: 0.5rem;
  }
  
  .sidebar-logo {
    width: 40px;
    height: 40px;
    margin-bottom: 0.125rem;
  }
  
  .sidebar-title {
    font-size: 0.875rem;
    letter-spacing: 0.05em;
  }
  
  .sidebar-nav {
    padding: 0.25rem 0.375rem;
  }
  
  .sidebar-nav li {
    margin: 0 0 0.1rem 0;
  }
  
  .sidebar-nav a {
    padding: 0.3rem 0.5rem;
    font-size: 0.6875rem;
    gap: 0.375rem;
    margin-left: 0.25rem;
    border-radius: 0 6px 6px 0;
  }
  
  .sidebar-nav .nav-icon {
    font-size: 0.875rem;
    width: 18px;
  }
  
  .sidebar-footer {
    padding: 0.5rem;
  }
  
  .staff-profile {
    padding: 0.375rem;
    margin-bottom: 0.25rem;
    gap: 0.375rem;
  }
  
  .staff-avatar {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  
  .staff-name-sidebar {
    font-size: 0.75rem;
  }
  
  .sidebar-logout {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.375rem;
  }
  
  .sidebar-logout .nav-icon {
    font-size: 1rem;
  }
  
  .sidebar-header::after {
    height: 2px;
  }
}

/* Ultra-compact for very small screens */
@media (max-height: 500px) {
  .sidebar-header {
    padding: 0.375rem;
  }
  
  .sidebar-logo {
    width: 32px;
    height: 32px;
    margin-bottom: 0;
  }
  
  .sidebar-title {
    font-size: 0.75rem;
  }
  
  .sidebar-nav {
    padding: 0.125rem 0.25rem;
  }
  
  .sidebar-nav li {
    margin: 0;
  }
  
  .sidebar-nav a {
    padding: 0.25rem 0.375rem;
    font-size: 0.625rem;
    gap: 0.25rem;
    margin-left: 0.125rem;
  }
  
  .sidebar-nav .nav-icon {
    font-size: 0.75rem;
    width: 16px;
  }
  
  .sidebar-footer {
    padding: 0.375rem;
  }
  
  .staff-profile {
    padding: 0.25rem;
    margin-bottom: 0.125rem;
  }
  
  .staff-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.875rem;
  }
  
  .staff-name-sidebar {
    font-size: 0.6875rem;
  }
  
  .sidebar-logout {
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
  }
  
  .sidebar-logout .nav-icon {
    font-size: 0.875rem;
  }
}

.sidebar-nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
  border-radius: 0 8px 8px 0;
  transition: all 0.25s ease;
  z-index: -1;
}

.sidebar-nav a:hover {
  background: linear-gradient(90deg, 
    rgba(96, 165, 250, 0.15) 0%, 
    rgba(59, 130, 246, 0.12) 100%);
  color: #003057;
  border-left-color: rgba(96, 165, 250, 0.8);
  border-left-width: 4px;
  transform: translateX(4px);
  box-shadow: 
    0 4px 12px rgba(96, 165, 250, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sidebar-nav a:hover::before {
  width: 100%;
  height: 100%;
}

.sidebar-nav a:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.9);
  outline-offset: 3px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.16) 0%, rgba(147, 51, 234, 0.16) 100%);
  color: #003057;
}

.sidebar-nav a.active {
  background: linear-gradient(90deg, 
    rgba(96, 165, 250, 0.2) 0%, 
    rgba(59, 130, 246, 0.15) 100%);
  color: #003057;
  border-left-color: rgba(96, 165, 250, 1);
  border-left-width: 5px;
  font-weight: 600;
  box-shadow: 
    0 4px 16px rgba(96, 165, 250, 0.25),
    0 2px 8px rgba(96, 165, 250, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(96, 165, 250, 0.1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  transform: translateX(2px);
}

.sidebar-nav .nav-icon {
  font-size: 1.25rem;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  filter: grayscale(0.3);
  transition: filter 0.25s ease;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  filter: grayscale(0);
}

.sidebar-nav .nav-label {
  flex: 1;
  letter-spacing: 0.01em;
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  flex-shrink: 0;
  position: relative;
  margin-top: auto;
}

.sidebar-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(96, 165, 250, 0.4) 30%,
    rgba(147, 197, 253, 0.6) 50%,
    rgba(96, 165, 250, 0.4) 70%,
    transparent 100%);
  box-shadow: 
    0 1px 8px rgba(96, 165, 250, 0.3),
    0 2px 16px rgba(96, 165, 250, 0.2);
}

.staff-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.2);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.staff-profile:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(96, 165, 250, 0.4);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 6px 20px rgba(96, 165, 250, 0.2),
    0 3px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.staff-avatar {
  font-size: 1.5rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(59, 130, 246, 0.2);
}

.staff-name-sidebar {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(220, 38, 38, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sidebar-logout:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.12) 100%);
  border-color: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
  transform: translateY(-1px);
}

.sidebar-logout .nav-icon {
  font-size: 1.25rem;
}

/* ===== MOBILE TOGGLE BUTTON ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1200;
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: #003057;
  border-color: #003057;
}

.toggle-icon {
  font-size: 1.5rem;
  color: #003057;
  transition: color 0.2s ease;
  line-height: 1;
}

.sidebar-toggle:hover .toggle-icon {
  color: #ffffff;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  width: calc(100% - 220px);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Adjust main content when sidebar is collapsed */
.sidebar.collapsed ~ .main-content {
  margin-left: 60px;
  width: calc(100% - 60px);
}

/* Adjust dashboard container to not have extra left margin */
body.sidebar-layout .dashboard-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
  }
  
  .sidebar-toggle {
    display: flex;
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* Page header responsive adjustments */
  .page-header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .page-crest {
    width: 36px;
    height: 36px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .page-subtitle {
    font-size: 0.75rem;
  }

  .welcome-message {
    padding: 0.375rem 0.75rem;
  }

  .welcome-text {
    font-size: 0.625rem;
  }

  .welcome-name {
    font-size: 0.8125rem;
  }

  /* Overlay when sidebar is open on mobile */
  .sidebar.open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    pointer-events: all;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 200px;
  }
  
  .sidebar.open::after {
    left: 200px;
  }
  
  .sidebar-header {
    padding: 1rem;
  }
  
  .sidebar-logo {
    width: 50px;
    height: 50px;
  }
  
  .sidebar-title {
    font-size: 1.125rem;
  }
}

/* ===== HIDE OLD HEADER WHEN SIDEBAR IS ACTIVE ===== */
body.sidebar-layout .enhanced-app-header,
body.sidebar-layout .header-section {
  display: none;
}

/* Adjust content spacing */
body.sidebar-layout .dashboard-container {
  padding-top: 1rem;
}

/* ===== FOOTER ADJUSTMENTS ===== */
body.sidebar-layout .enhanced-footer,
body.sidebar-layout footer {
  margin-left: 0;
}

/* ===== ENHANCED FOOTER STYLES 2026 ===== */
.enhanced-app-footer-2026 {
  background: linear-gradient(135deg, 
    rgba(0, 48, 87, 0.98) 0%,
    rgba(0, 62, 112, 0.96) 50%,
    rgba(0, 48, 87, 0.98) 100%);
  border-top: 2px solid rgba(96, 165, 250, 0.3);
  box-shadow: 
    0 -8px 32px rgba(0, 0, 0, 0.3),
    0 -2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 1.25rem 2rem;
  margin-top: auto;
  position: relative;
}

.enhanced-app-footer-2026::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(96, 165, 250, 0.6) 20%, 
    rgba(147, 197, 253, 0.8) 50%, 
    rgba(96, 165, 250, 0.6) 80%, 
    transparent 100%);
  box-shadow: 
    0 0 12px rgba(96, 165, 250, 0.5),
    0 0 24px rgba(96, 165, 250, 0.3);
}

.footer-content-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px;
  margin: 0 auto;
  gap: clamp(1rem, 3vw, 2rem);
  flex-wrap: nowrap;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.footer-left,
.footer-center,
.footer-right {
  display: flex;
  align-items: center;
  min-width: 0;
}

.footer-left {
  flex: 1 1 auto;
  min-width: 0;
}

.footer-center {
  flex: 0 0 auto;
  white-space: nowrap;
}

.footer-right {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.footer-logo-section {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.footer-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  opacity: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.footer-branding {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.footer-brand-name {
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.01em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.footer-build-number {
  font-size: clamp(0.625rem, 1vw, 0.75rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.footer-tech {
  font-size: clamp(0.75rem, 1.2vw, 0.875rem);
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(96, 165, 250, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
  transition: all 0.3s ease;
}

.footer-tech:hover {
  background: rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.footer-credits {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  justify-content: flex-end;
  min-width: 0;
}

.footer-developer {
  font-size: clamp(0.75rem, 1.2vw, 0.875rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.01em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.footer-institution {
  font-size: clamp(0.625rem, 1vw, 0.75rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* Ensure footer stays at bottom of main-content */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
}

body.sidebar-layout .main-content {
  min-height: 100vh;
}

.main-content > *:last-child {
  margin-top: auto;
}

/* Condense footer for sidebar layout */
body.sidebar-layout .enhanced-app-footer-2026 {
  font-size: 0.8125rem;
}

body.sidebar-layout .footer-container-2026 {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 2rem;
  flex-wrap: wrap;
}

body.sidebar-layout .footer-column {
  margin-bottom: 0;
  flex: 0 1 auto;
}

body.sidebar-layout .footer-brand-column {
  flex: 0 0 auto;
}

body.sidebar-layout .footer-brand-section {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

body.sidebar-layout .footer-crest-2026 {
  width: 32px;
  height: 32px;
}

body.sidebar-layout .footer-brand-title {
  font-size: 1rem;
  margin-bottom: 0;
}

body.sidebar-layout .footer-tagline {
  display: none;
}

body.sidebar-layout .footer-badge-group {
  flex-direction: row;
  gap: 0.5rem;
  margin-top: 0;
}

body.sidebar-layout .footer-badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
}

body.sidebar-layout .footer-links-column h4,
body.sidebar-layout .footer-contact-column h4 {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
}

body.sidebar-layout .footer-link {
  padding: 0.25rem 0;
  font-size: 0.75rem;
}

body.sidebar-layout .footer-wave-divider {
  height: 40px;
}
