/* ===== SIDEBAR TOGGLE BUTTON ===== */
.sidebar-toggle-btn {
  background: #40724b00;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  z-index: 1001;
}

.sidebar-toggle-btn i {
  font-size: 1rem;
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 350px;
  height: 100vh;
  background: linear-gradient(135deg, #074820, #0b1730);
  color: white;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1051;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-overlay.show .sidebar {
  transform: translateX(0);
}

.sidebar-content {
  padding: 2rem 1.5rem;
  height: 100%;
  overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

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

/* ===== SIDEBAR HEADER ===== */
.sidebar-header {
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.sidebar-header i {
  font-size: 1.3rem;
  color: #7cb342;
}

/* ===== SIDEBAR NAVIGATION ===== */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: rgba(255, 255, 255, 0);
}

/* ===== DROPDOWN STYLES ===== */
.dropdown {
  position: relative;
}

.sidebar-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar-link.dropbtn {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-link span {
  flex: 1;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.dropdown.active .dropdown-arrow,
.dropdown.hover .dropdown-arrow {
  transform: rotate(180deg);
}

.sidebar-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.sidebar-link:hover::before {
  left: 100%;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-left-color: #7cb342;
  transform: translateX(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sidebar-link:active {
  transform: translateX(8px) scale(0.98);
}


/* ===== DROPDOWN CONTENT ===== */
.dropdown-content {
  position: relative;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin-top: 0.5rem;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease;
  transform: translateY(-10px);
}

.dropdown-item {
  display: block;
  padding: 0.75rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
  position: relative;
}

.dropdown.active .dropdown-content,
.dropdown.hover .dropdown-content {
  max-height: 250px; /* Set a fixed max height for scrolling */
  opacity: 1;
  transform: translateY(0);
  overflow-y: auto; /* Enable vertical scrolling */
}

/* Custom scrollbar for dropdown content */
.dropdown-content::-webkit-scrollbar {
  width: 4px;
}

.dropdown-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.dropdown-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.6);
}

/* For Firefox */
.dropdown-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.4) rgba(255, 255, 255, 0.1);
}


/* ===== SIDEBAR CLOSE BUTTON ===== */
.sidebar-close-btn {
  position: absolute;
  top: 20px;
  right: -50px;
  width: 40px;
  height: 40px;
  background: black;
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
  z-index: 1052;
  font-size: 1.1rem;
}

.sidebar-close-btn:hover {
  background: #c82333;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.6);
}

.sidebar-close-btn:active {
  transform: scale(0.95);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 300px;
  }
  
  .sidebar-close-btn {
    right: -45px;
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .sidebar-toggle-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
  
  .sidebar-toggle-btn span {
    display: none;
  }
  
  .dropdown-item {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    color: white;
  }
  
  .dropdown-item:hover {
    padding-left: 1.4rem;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 280px;
  }
  
  .sidebar-content {
    padding: 1.5rem 1rem;
  }
  
  .sidebar-header {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
  }
  
  .sidebar-link {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }
  
  .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  
  .dropdown-item:hover {
    padding-left: 1.2rem;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes dropdownSlide {
  from {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== BODY SCROLL LOCK ===== */
body.sidebar-open {
  overflow: hidden;
}

/* ===== FOCUS STYLES FOR ACCESSIBILITY ===== */
.sidebar-toggle-btn:focus,
.sidebar-close-btn:focus,
.sidebar-link:focus,
.dropdown-item:focus {
  outline: 2px solid #7cb342;
  outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
  .sidebar {
    background: #000;
    border-right: 2px solid #fff;
  }
  
  .sidebar-link {
    background: #333;
    border: 1px solid #666;
  }
  
  .sidebar-link:hover {
    background: #555;
    border-color: #7cb342;
  }
  
  .dropdown-content {
    background: #222;
    border: 1px solid #666;
  }
  
  .dropdown-item {
    background: transparent;
  }
  
  .dropdown-item:hover {
    background: #444;
    border-color: #7cb342;
  }
}