/* Закрепленная навигация */
*{
    box-sizing: border-box;
     font-family: 'Montserrat', sans-serif;
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #555 #1a1a1a;
}

/* WebKit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: #1a1a1a;
}
*::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: #777;
}
html, body {
  margin: 0;
  padding: 0;
  background-color: #171717; /* фон совпадает с цветом header */
  height: 100%;
}

nav ul {
    list-style: none;
    padding: 0;
    text-align: center;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}


nav ul li a {
    text-decoration: none;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    transition: color 0.3s ease-in-out;
    position: relative;
}

nav ul li a:hover {
    color: gray;
}

/* Анимация подчеркивания */
nav ul li a::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: white;
    transform: scaleX(0);
    transition: transform 0.3s ease-in-out;
}

nav ul li a:hover::before {
    transform: scaleX(1);
}

/* Кнопки входа и регистрации */
.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-buttons button {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: url('/assets/images/pointer.cur'), pointer;
    transition: all 0.3s ease-in-out;
}

.auth-buttons button:hover {
    background: white;
    color: black;
}

/* Скрытие элементов навбара при активном поиске */
/* прячем только список, логотип и иконки остаются */
.main-nav.nav-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}


/* Основные стили навбара */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 0;
    z-index: 1000;
    transition: transform 0.4s ease-in-out, opacity 0.3s ease-in-out;
    width: 100%;
}
#search-results {
  max-height: 300px;      /* Ограничение высоты для скролла */
  overflow-y: auto;
  scrollbar-width: thin;  /* для Firefox */
  scrollbar-color: #555 #1c1c1c;
}

/* WebKit (Chrome, Edge, Opera) */
#search-results::-webkit-scrollbar {
  width: 8px;
}
#search-results::-webkit-scrollbar-track {
  background: #1c1c1c;
  border-radius: 4px;
}
#search-results::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}
#search-results::-webkit-scrollbar-thumb:hover {
  background: #777;
}

#navbar li {
    position: relative;
    margin: 0 15px;
    display: inline-block;
}

#navbar a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    padding: 10px;
}



.dropdown {
    display: grid;
    position: absolute;
    top: 42px; /* Оставляем как есть */
    left: -200%; /* Центрируем относительно экрана */
    background-color: rgba(0, 0, 0, 0.7);
    width: 900px;
    height: auto;
    padding: 10px;
    border-radius: 5px;
    z-index: 100;
    grid-template-columns: repeat(4, 1fr); /* 4 колонки */
    gap: 7px;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.3s, opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* 🔹 Показываем при наведении */
.has-dropdown:hover .dropdown {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
}

/* 🔹 Каждый элемент в колонке */
.dropdown li {
    list-style: none;
    text-align: center;
}

/* 🔹 Ссылки в выпадающем списке */
.dropdown a {
    display: flex;
    padding: 8px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease-in-out;
}


/* Навбар уходит влево */
#navbar.hidden {
    transform: translateX(-50px);
    opacity: 0;
    pointer-events: none;
}

.no-results {
    display: flex;
    justify-content: center;
}

/* 🔹 Иконка поиска */
.search-icon img {
    cursor: url('/assets/images/pointer.cur'), pointer;
    width: 28px;
    height: 28px;
    transition: 0.3s ease-in-out;
}

.search-icon img:hover {
    content: url(../images/search.png);
}

/* 🔹 Контейнер поиска */
#search-container {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
    z-index: 1001;
}

/* 🔹 Анимация появления результатов */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🔹 Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.modal.show {
    display: flex;
}

.modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* 🔹 Кнопка закрытия */
.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    cursor: url('/assets/images/pointer.cur'), pointer;
    transition: 0.3s;
}

.close:hover {
    color: gray;
}



/* 🔹 Навбар уходит влево */
#navbar.hidden {
    transform: translateX(-50px);
    opacity: 0;
    pointer-events: none;
}
.no-results{
    display: flex;
    justify-content: center;
}
/* 🔹 Иконка поиска */
.search-icon img {
    cursor: url('/assets/images/pointer.cur'), pointer;
    width: 28px;
    height: 28px;
    transition: 0.3s ease-in-out;
}
/* 🔹 Иконка поиска */
.search-icon img:hover {
    content: url(../images/search.png);
}

/* 🔹 Когда поиск активен */
#search-container.active {
    opacity: 1;
    visibility: visible;
}

/* 🔹 Форма поиска */
.search-form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0);
    padding: 8px 12px;
    transition: all 0.3s ease-in-out;
    width: 800px;
    
}

/* 🔹 Поле ввода */
.search-form input {
    flex-grow: 1;
    border: solid 1px;
    background: transparent;
    color: white;
    font-size: 16px;
    outline: none;
    padding: 10px 14px;
    border-radius: 10px;
}

/* 🔹 Кнопка поиска */
.search-form button {
    background: none;
    border: none;
    cursor: url('/assets/images/pointer.cur'), pointer;
    padding: 5px;
    margin-left: 8px;
}

.search-form button img {
    width: 27px;
    height: 27px;
    transition: transform 0.3s ease;
}

.search-form button:hover img {
    content: url(../images/search.png);
}


.search-container {
    position: relative;
    width: 300px;
}

#search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

#search-results {
    position: absolute;
    top: 86%;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-top: none;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

.search-result {
    display: flex;
    align-items: center;
    padding: 10px;
    text-decoration: none;
    color: rgb(255, 255, 255);
    transition: background 0.3s;
}

.search-result img {
    width: 50px;
    height: 70px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 3px;
}

.search-result:hover {
    background: rgba(54, 54, 54, 0.7);
}


/* 🔹 Кнопка закрытия */
.close-search img {
    position: absolute;
    top: 13px;
    right: 15px; /* Ближе к полю поиска */
    width: 25px;
    height: 25px;
    cursor: url('/assets/images/pointer.cur'), pointer;
}

/* 🔹 Эффект при наведении */
.close-search img:hover {
    content: url(../images/close.png);
    position: absolute;
    cursor: url('/assets/images/pointer.cur'), pointer;
}

/* 🔹 Анимация появления результатов */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.modal.show {
    display: flex;
}

.modal.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* Кнопка закрытия */
.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    cursor: url('/assets/images/pointer.cur'), pointer;
    transition: 0.3s;
}

.close:hover {
    color: gray;
}

/* Поля ввода */
.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid white;
    border-radius: 6px;
    font-size: 16px;
    background: transparent;
    color: white;
    text-align: center;
}

.modal-content input:focus {
    border-color: gray;
    outline: none;
}


/* 🔹 Стили только для кнопок "Вход" и "Регистрация" */
#login-button,
#register-button {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: url('/assets/images/pointer.cur'), pointer;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

/* 🔹 Анимация при наведении */
#login-button::before,
#register-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease-in-out;
    z-index: -1;
}

#login-button:hover::before,
#register-button:hover::before {
    transform: scaleX(1);
}

#login-button:hover,
#register-button:hover {
    color: black;
    border-color: black;
}
  
.loader {
  border: 4px solid #f3f3f3;
  border-radius: 50%;
  border-top: 4px solid #171717;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.badge {
    background-color: red;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.8em;
    position: absolute;
    top: 0;
    right: 0;
}

.hidden {
    display: none;
}
/* Контейнер чекбокса */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: url('/assets/images/pointer.cur'), pointer;
    font-size: 14px;
    color: #fff;
    user-select: none;
    position: relative;
}

/* Скрываем стандартный input */
.custom-checkbox input[type="checkbox"] {
    display: none;
}

/* Стилизация квадрата */
.custom-checkbox .checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 4px;
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    transition: background-color 0.2s, border-color 0.2s;
}

/* Галочка при активации */
.custom-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* При наведении — светлая граница */
.custom-checkbox:hover .checkmark {
    border-color: #ccc;
}
.modal-footer {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.modal-footer a {
  color: #66afe9;
  text-decoration: none;
}
.modal-footer a:hover {
  text-decoration: underline;
}

/* Универсальный ресет для инпутов внутри password-wrapper */
.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper input {
  width: 100%;
  padding-right: 2.5rem;     /* оставляем место под иконку */
  box-sizing: border-box;    /* чтобы padding не ломал ширину */
}

/* Сама иконка */
.password-wrapper .toggle-password {
  position: absolute;
  top: 50%;
  right: 0.75rem;            /* от края поля */
  transform: translateY(-50%);
  cursor: url('/assets/images/pointer.cur'), pointer;
  font-size: 1.1rem;
  /* Явно укажем семью FA, чтобы не было «квадратика» */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;          /* solid */
  color: #666;
  z-index: 2;
}
.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.forgot-link {
  color: #66afe9;
  font-size: 0.9rem;
  text-decoration: none;
}
.forgot-link:hover {
  text-decoration: underline;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: red;
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
}
.hidden { display: none; }

/* 0) Скрываем мобильные элементы по умолчанию */
header.mobile-header,
#side-menu,
#menu-overlay {
  display: none;
}
#comm-mobile:empty {
  display: none;
}

/* Аналогично для десктопного */
#comm-desktop:empty {
  display: none;
}
/* запрет скролла фона при открытом меню */
body.no-scroll {
  overflow: hidden;
  height: 100%;
}

/* ======== Мобильная версия до 900px ======== */
@media screen and (max-width: 1200px) {
  /* Прячем десктопный навбар */
  #navbar {
    display: none !important;
  }
  body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0;
    /* сначала для iOS 11-12 */
    height: constant(safe-area-inset-top);
    /* затем для iOS 11.2+ */
    height: env(safe-area-inset-top, 0px);
    background-color: #171717;
    z-index: 999;
    pointer-events: none;
  }

  /* 3.2. Мобильный header */
  header.mobile-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;

    display: flex !important;
    align-items: center;
    justify-content: space-between;

    /* padding-top = высота safe-area + 0px */
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: 10px;
    padding-bottom: 0;
    padding-left: 10px;

    /* высота = 100px контента + вырез */
    height: calc(100px + constant(safe-area-inset-top));
    height: calc(100px + env(safe-area-inset-top, 0px));

    background: #171717;
    width: 100%;
    max-width: 100%;
  }



  /* Иконки в шапке */
  .mobile-header .btn-icon {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: url('/assets/images/pointer.cur'), pointer;
  }

  .mobile-header .btn-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
  }

  .mobile-header .logoo img {
    height: 50px;
    object-fit: contain;
  }
  .center-logoo {
    margin: 0 auto;
 }

  /* Уведомления в моб.шапке */
  #comm-mobile {
    display: flex;
    align-items: center;
    margin: 0 8px;
  }

  #notificationBadge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: red;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    display: none;
  }

  #notificationBadge.visible {
    display: block;
  }

  /* Оверлей */
  #menu-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }

  #menu-overlay:not(.active) {
    display: none;
  }

  /* Сайд-меню */
  #side-menu {
    display: block;
    position: fixed;
    top: 0; left: -100%;
    width: 100%;
    max-width: 500px;
    height: 100%;
    background: #141414;
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 1001;
  }

  #side-menu.open {
    left: 0;
  }
  #menu-close {
    border: none;
    background-color: transparent;
    cursor: url('/assets/images/pointer.cur'), pointer;
  }
  #menu-close img {
    width: 35px;
    height: 35px;
    object-fit: contain;
  }
  .profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
  }
  
  .profile-btn img.profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
  }
  
  .profile-btn .username {
    font-size: 20px;
    font-weight: 700;
  }


  .side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
  }
  .side-menu-header .auth-buttons{
    display: flex;
    flex-wrap: wrap;           /* <-- разрешаем перенос на новую строку */
    gap: 8px;  
  }
    .side-menu-header .auth-buttons button {
    white-space: nowrap;       /* не ломать текст внутри кнопки */
  }

  /* Крестик “Закрыть” прижимаем вправо */
  #menu-close {
    margin-left: auto;
  }
  /* Категории (аккордеон) */
  .menu-category {
    border-bottom: 1px solid #2a2a2a;
  }

  .menu-category .category-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    font-size: 16px;
    color: #fff;
    cursor: url('/assets/images/pointer.cur'), pointer;
  }

  .menu-category .category-toggle::after {
    content: '▸';
    float: right;
    transition: transform 0.2s ease;
  }

  .menu-category .category-toggle.active::after {
    transform: rotate(90deg);
  }

  .menu-category .category-list {
    display: none;
    background: #1e1e1e;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 10px;
    flex-direction: column;
  }
  
  .menu-category .category-list li {
    padding: 8px 16px;
    display: block;
    text-align: left;
  }
  
  .menu-category .category-list a {
    display: block;
    color: #ccc;
    font-size: 15px;
    text-decoration: none;
    padding: 4px 0;
  }
  
  .menu-category .category-list a:hover {
    color: white;
  }
  
  #mobile-search-container {
    position: fixed;
    top: -100px; /* скрыт по умолчанию */
    left: 0;
    right: 0;
    width: 100%;
    background: #141414;
    padding: 16px;
    z-index: 1002;
    opacity: 0;
    pointer-events: none;
    transition: top 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  }

  #mobile-search-container.active {
    top: 100px; /* выезжает вниз */
    opacity: 1;
    pointer-events: all;
  }


  #mobile-search-container .search-form {
    display: flex;
    align-items: center;
    width: 100%; /* важно */
  }

  #mobile-search-container input[type="text"] {
    flex-grow: 1;
    width: 100%;       /* гарантирует, что займет всё доступное пространство */
    padding: 12px 16px;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1e1e1e;
    color: #fff;
    font-size: 16px;
    outline: none;
    min-width: 0;  
  }

  #mobile-search-container input[type="text"]::placeholder {
    color: #999;
  }

  #mobile-search-container #search-results {
    margin-top: 12px;
    background: #1e1e1e;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #666 #1e1e1e;
  }

  #mobile-search-container #search-results::-webkit-scrollbar {
    width: 6px;
  }

  #mobile-search-container #search-results::-webkit-scrollbar-track {
    background: #1e1e1e;
  }

  #mobile-search-container #search-results::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
  }

  #mobile-search-container .search-result {
    display: flex;
    align-items: center;
    padding: 10px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.2s ease-in-out;
  }

  #mobile-search-container .search-result:hover {
    background: #2c2c2c;
  }

  #mobile-search-container .search-result img {
    width: 50px;
    height: 70px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 4px;
  }
  #mobile-search-container .search-header {
  position: relative;
  }
  
  #mobile-search-container .close-search img {
    position: absolute;
    top: 18px;
    right: 27px;
    width: 26px;
    height: 26px;
    cursor: url('/assets/images/pointer.cur'), pointer;
    z-index: 1003;
  }
    /* Обёртка и сам линк */
  #side-menu .menu-item {
    border-bottom: 1px solid #2a2a2a;
  }
  #side-menu .menu-item > a.category-toggle {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 18px;
    color: #fff;
    text-decoration: none;
    background: none;
    text-align: left;
    cursor: url('/assets/images/pointer.cur'), pointer;
    transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
  }
  /* Стрелочка, совпадающая с остальными аккордеонами */
  #side-menu .menu-item > a.category-toggle::after {
    content: '▸';
    float: right;
    transition: transform 0.2s ease;
  }
  /* При открытом меню, если захотите поворачивать стрелку */
  #side-menu .menu-item > a.category-toggle.active::after {
    transform: rotate(90deg);
  }
  /* Hover-эффект, как у остальных пунктов */
  #side-menu .menu-item > a.category-toggle:hover {
    background: #2c2c2c;
    color: #fff;
  }

}
