/* Sidebar styles for large screens (>992px) */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  padding: 30px 20px;
  overflow-y: auto;
  position: fixed;
  /* Fluid top position matching navbar height */
  top: clamp(56px, 8vw, 78px);
  bottom: 0;
  left: 0;
  min-height: 500px;
  height: calc(100vh - clamp(56px, 8vw, 78px));
  transition: transform 0.3s ease-in-out;
  visibility: visible;
  display: flex;
  flex-direction: column;
}

/* Sidebar heading styles */
.sidebar h5 {
  color: #091c3a;
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 25px;
  position: relative;
  padding-bottom: 12px;
  text-align: center;
}

.sidebar h5::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

/* Collection styles within sidebar */
.sidebar .collection {
  border: none;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar .collection a {
  border: none;
  margin: 5px 0;
  padding: 12px 15px;
  color: #091c3a;
  transition: background-color 0.3s ease;
  border-radius: 8px;
}

.sidebar .collection a:hover:not(.active) {
  background-color: rgba(102, 126, 234, 0.1);
}

.sidebar .collection a.active {
  background-color: #009688;
}

/* Hide close button by default */
.close-menu {
  display: none;
}

/* Overlay styles */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  z-index: 999;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

.mobile-overlay.active {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
  pointer-events: auto;
}

/* Mobile styles (≤992px) */
@media screen and (max-width: 992px) {
  .sidebar {
    top: 0; /* Începe de la marginea de sus */
    left: auto !important;
    right: 0;
    width: 280px;
    height: 100vh; /* Ocupă toată înălțimea viewport-ului */
    padding: 80px 20px 30px 20px; /* Padding mai mare sus pentru a evita navbar-ul */
    transform: translateX(100%);
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    visibility: hidden;
  }

  .sidebar.active {
    transform: translateX(0);
    visibility: visible;
  }

  .close-menu {
    display: block;
    position: absolute;
    top: 20px; /* Poziționat mai jos pentru a evita navbar-ul */
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
  }

  .close-menu:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }

  .close-menu i {
    font-size: 20px;
    color: #091c3a;
  }

  .main-content {
    margin-left: 0 !important;
  }
}

/* Mobile layout adjustments */
@media screen and (max-width: 768px) {
  .sidebar {
    width: 260px; /* Puțin mai îngust pe mobile pentru a avea mai mult spațiu */
  }

  .sidebar h5 {
    font-size: 1.2rem;
  }

  .sidebar .collection a {
    padding: 10px 12px;
    font-size: 0.95rem;
  }
}

/* Small screens */
@media screen and (max-width: 480px) {
  .sidebar {
    width: 240px; /* Și mai îngust pe ecrane foarte mici */
  }
}

/* Menu trigger styles */
li.menu-trigger {
  display: none !important;
  visibility: hidden;
}

@media screen and (max-width: 992px) {
  li.menu-trigger {
    display: flex !important;
    visibility: visible;
  }
}
