﻿.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  width: 100%;
  z-index: 1100;
  background: var(--light-blue);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.admin-header .header-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-left: 1rem; /* Add padding back to content */
}
.admin-header .header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.admin-header .header-actions h4 {
  color: var(--primary-color) !important;
}

/* Sidebar */
.admin-sidebar {
  position: fixed;
  top: 100px; /* Starts below header */
  left: 0;
  bottom: 50px; /* Ends above footer */
  width: 300px;
  background: var(--light-blue);
  color: var(--black);
  border-right: 1px solid var(--gray-100);
  transition: width 0.3s ease-in-out;
  z-index: 1040;
  overflow: visible;
  display: flex;
  flex-direction: column;
  /* Submenu - Default (Expanded Sidebar) */
}
.admin-sidebar .sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  /* Ensure submenu active items also use the active styling */
}
.admin-sidebar .sidebar-nav > .nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.admin-sidebar .sidebar-nav .nav-item {
  position: relative;
}
.admin-sidebar .sidebar-nav .nav-item.active > .nav-link {
  color: var(--primary-color) !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
  font-weight: bold !important;
}
.admin-sidebar .sidebar-nav .nav-item.active > .nav-link i {
  color: var(--primary-color) !important;
}
.admin-sidebar .sidebar-nav .nav-item.submenu-open > .nav-link .submenu-indicator {
  transform: rotate(180deg);
}
.admin-sidebar .sidebar-nav .nav-item.submenu-open > .submenu {
  max-height: 1500px; /* Increased to support nested submenus */
}
.admin-sidebar .sidebar-nav .nav-link {
  color: var(--primary-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  height: 48px; /* Fixed height for consistent alignment */
}
.admin-sidebar .sidebar-nav .nav-link:hover {
  color: var(--primary-color);
  background-color: var(--primary-color-contrast) !important;
}
.admin-sidebar .sidebar-nav .nav-link.active {
  color: var(--primary-color) !important;
  background-color: var(--primary-color-contrast) !important;
  font-weight: bold;
}
.admin-sidebar .sidebar-nav .nav-link i {
  font-size: 1.25rem;
  width: 1.5rem;
  min-width: 1.5rem;
  flex-shrink: 0;
  text-align: center;
  display: flex; /* Use flex to center icon */
  align-items: center;
  justify-content: center;
  height: 100%; /* Fill height of parent */
}
.admin-sidebar .sidebar-nav .submenu .nav-item.active > .nav-link {
  color: var(--primary-color) !important;
  background-color: var(--primary-color-contrast) !important;
  font-weight: bold !important;
}
.admin-sidebar .sidebar-nav .submenu .nav-item.active > .nav-link i {
  color: var(--primary-color) !important;
}
.admin-sidebar .nav-text {
  flex: 1;
  transition: opacity 0.2s;
}
.admin-sidebar .submenu-indicator {
  margin-left: auto;
  font-size: 0.875rem;
  transition: transform 0.2s;
  width: 1rem;
}
.admin-sidebar .submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  background-color: rgba(0, 0, 0, 0.03);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
  /* Vertical Line Style */
  margin-left: 2.25rem;
  border-left: 1px solid var(--primary-color);
  /* Nested Submenu Styling */
}
.admin-sidebar .submenu .submenu {
  margin-left: 1.75rem; /* Slightly less indentation for deeper levels */
}
.admin-sidebar .submenu .nav-link {
  padding-left: 1rem;
  font-size: 0.9rem;
  height: 40px; /* Slightly smaller height for submenus */
}
.admin-sidebar .submenu .nav-link i {
  font-size: 1rem;
}

/* Main Content */
.admin-main {
  margin-top: 100px;
  margin-left: 300px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 100px);
  background-color: var(--bs-body-bg);
  padding-bottom: 50px; /* Add padding for fixed footer */
}
.admin-main .content-wrapper {
  flex: 1;
  padding: 2rem;
}

/* Footer */
.admin-footer {
  background: var(--light-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 2rem;
  margin-top: auto;
  /* Footer positioning relative to main content */
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0; /* Full width */
  transition: left 0.3s ease-in-out;
  z-index: 1050; /* Increased z-index to be above sidebar */
}
.admin-footer.sidebar-minimized {
  left: 0;
}
.admin-footer .footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 0.875rem;
  width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-header {
    left: 0;
  }
  .admin-sidebar {
    transform: translateX(-300px);
  }
  .admin-sidebar.minimized {
    transform: translateX(-300px);
  }
  .admin-sidebar:not(.minimized).mobile-open {
    transform: translateX(0);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-main.sidebar-minimized {
    margin-left: 0;
  }
  .admin-footer {
    left: 0;
  }
  .admin-footer.sidebar-minimized {
    left: 0;
  }
}
