.sidebar-homepage {
    padding: .5em;
}

.sidebar-panel {
    border-top: 1px dotted #999;
    padding: .5em;
    text-align: center;
}

.sidebar-brand {
    display: block;
    font-size: 1.15em;
    font-weight: 600;
    padding: .5em;
}

.dropdown-header {
    font-weight: 600;
}

.dropdown-mega-list {
    padding-left: .5em;
    padding-right: .5em;
}

.content {
    direction: ltr;
    flex: 1;
    max-width: 100vw;
    padding: 0 .75em;
    width: 100vw
}

@media (min-width: 768px) {
    .content {
        max-width: auto;
        width: auto
    }
}

/*цветовые кнопки*/

.dropdown-mega-list .dropdown-item {
    padding: 0 .5em;
}

.buttons-area_colorscheme {
    display: flex;
    flex-direction: column;
    gap: 0.1em; /* Пространство между кнопками */
    padding: 0;
    width: 1em; /* Ширина контейнера */
}

.buttons-area_colorscheme .btn {
    text-align: center; /* Центрирование текста */
}

.sidebar-toggle {
    margin-left: 1em;
}

.btn-sm {
    margin-right: .2em;
    margin-bottom: .2em;
}

.alert-area {
    .alert {
        padding: 1em;
    }
}

a.asc::after {
    content: "\f884"; /* Unicode символ для иконки fa-arrow-down-short-wide */
    font-family: "Font Awesome 6 Free";
    font-weight: 900; /* Жирный стиль */
    margin-left: 5px; /* Расстояние между текстом и иконкой */
}

a.desc::after {
    content: "\f160"; /* Unicode символ для иконки fa-arrow-down-wide-short */
    font-family: "Font Awesome 6 Free";
    font-weight: 900; /* Жирный стиль */
    margin-left: 5px; /* Расстояние между текстом и иконкой */
}

.sidebar-content {
    height: 200vh;
}

td > img {
    width: 100%;
}

.card.keyword-box {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-height: 100vh; /* Ограничиваем максимальную высоту */
    overflow-y: auto; /* Добавляем прокрутку, если содержимое превышает max-height */
}

.custom-popover {
    --bs-popover-max-width: 200px;
    --bs-popover-border-color: #474646;
    --bs-popover-header-bg: #999;
    --bs-popover-header-color: var(--bs-white);
    --bs-popover-body-padding-x: 1rem;
    --bs-popover-body-padding-y: .5rem;
}

.fixed-btn-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000; /* Чтобы кнопка была поверх других элементов */
    padding: .2em;
    background-color: transparent; /* Фон контейнера, если нужен */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Тень для контейнера */
}

/* новое меню*/
/* Мегаменю стили для Bootstrap 5.3*/
.dropdown-mega {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  width: 100vw;
  max-width: 1200px;
  min-width: 900px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: 0.375rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  background: #fff;
  z-index: 1050;
  margin-top: 0.125rem;
  
  /* Позиционирование относительно viewport для больших экранов*/
  @media (min-width: 1400px) {
    left: 50%;
    transform: translateX(-50%);
    max-width: 1300px;
  }
  
  @media (max-width: 1199px) {
    min-width: 800px;
    max-width: 95vw;
    left: 2.5vw;
  }
  
  @media (max-width: 991px) {
    min-width: 600px;
    max-width: 90vw;
    left: 5vw;
  }
  
  /* Переопределяем стандартную анимацию Bootstrap*/
  &.show {
    animation: megaMenuSlideIn 0.3s ease-out;
  }
}

.allmodels-menu {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
  
  @media (max-width: 1199px) {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 1rem;
  }
  
  @media (max-width: 991px) {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
  }

  /* Кастомный скроллбар*/
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
    
    &:hover {
      background: #a8a8a8;
    }
  }
}

.model-list {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  
  &:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }
}

.model-list-mega-list {
  @extend .model-list;
}

.model-list-header {
  background: linear-gradient(135deg, #eeefef 0%, #d2d3d5 100%);
  color: #575656;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0.375rem 0.375rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  
  i, img {
    font-size: 1rem;
    width: 16px;
    height: 16px;
  }
}

.model-list-content {
padding: .2em .5em
}

.model-list-item {
  display: block;
  padding: 0.2em;
  color: #495057;
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.3;
  border-radius: 0.25rem;
  transition: all 0.15s ease;
  margin-bottom: 0.1em;
  
  &:hover {
    background-color: #e9ecef;
    color: #0d6efd;
    text-decoration: none;
    transform: translateX(3px);
  }
  
  &:focus {
    outline: none;
    background-color: #e7f1ff;
    color: #0d6efd;
  }
  
  /* Системные ссылки (Главная, Структура, Создать и т.д.)*/
  &.system-link {
    background-color: #e9ecef;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.2em;
    
    &:hover {
      background-color: #dee2e6;
      color: #495057;
    }
  }
  
  strong {
    color: #212529;
    font-weight: 600;
  }
  
  small {
    color: #6c757d;
    font-size: 0.7rem;
    opacity: 0.8;
  }
}

/* Специальные стили для dropdown-item (используется в коде)*/
.dropdown-item.small {
  @extend .model-list-item;
}

/* Анимация появления мегаменю*/
.dropdown-menu.dropdown-mega {
  /* Убираем переопределение display, оставляем Bootstrap управлять видимостью*/
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease-out;
  pointer-events: none;
}

.dropdown-menu.dropdown-mega.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Альтернативная анимация через CSS классы*/
@keyframes megaMenuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Стили для навигации*/
.navbar-nav {
  .nav-item.dropdown {
    position: static; /* Важно для мегаменю, чтобы оно могло выходить за границы li*/
    
    .nav-link.dropdown-toggle {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.5rem 1rem;
      
      i {
        font-size: 1.1rem;
      }
    }
  }
}

/* Дополнительные стили для navbar*/
.navbar {
  position: relative;
  z-index: 1040; /* Меньше чем у dropdown-mega*/
}

/* Адаптивность для мобильных устройств*/
@media (max-width: 767px) {
  .dropdown-mega {
    position: fixed !important;
    top: 60px !important; /* Высота navbar*/
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: unset !important;
    max-width: unset !important;
    margin: 0 !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
    transform: translateX(0) !important;
    max-height: calc(100vh - 60px);
  }
  
  .allmodels-menu {
    grid-template-columns: 1fr;
    padding: 1rem;
    max-height: calc(100vh - 120px);
  }
}

/* Overlay для мобильных устройств*/
@media (max-width: 767px) {
  .dropdown.show::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
  }
}

/* Дополнительные утилиты*/
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-count {
  background: rgba(255, 253, 253, 0.82);
  color: #050505;
  padding: 0.125rem 0.375rem;
  border-radius: 0.75rem;
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: auto;
}

/* Предотвращение скачков контента*/
body {
  &.dropdown-open {
    /* Опционально: предотвращаем скролл при открытом меню на мобильных*/
    @media (max-width: 767px) {
      overflow: hidden;
    }
  }
}

/* Фиксация контейнера*/
.container-fluid,
.container {
  position: relative;
}

/* Дополнительная тень для лучшего визуального отделения*/
.dropdown-mega::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1), transparent);
  border-radius: 0.375rem 0.375rem 0 0;
}
