/* Base styles */
body {
  font-family: Arial, sans-serif;
  /*
    Мы используем радиальный градиент, который начинается из центра.
    Основной цвет фона (#1e1e2f) остается, но мы добавляем более темный
    оттенок (#10101a) по краям, чтобы создать глубину.
  */
  background: radial-gradient(circle at center, #1e1e2f 0%, #10101a 100%);
  
  min-height: 100vh;
  
  color: #eee;
  margin: 0;
  padding: 0;
}
h1 {
  text-align: center;
  margin-top: 10px;  /* Уменьшаем отступ сверху */
  margin-bottom: 10px; /* Уменьшаем отступ снизу, до карточек */
}
.smallglyb {
  text-align: center;
  margin-top: 10px;  /* Уменьшаем отступ сверху */
  margin-bottom: 10px; /* Уменьшаем отступ снизу, до карточек */
}

/* Верхняя панель с кнопками Вход/Регистрация */
.auth-buttons {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 200;
}
.auth-buttons button {
  background-color: #444466;
  border: none;
  color: #eee;
  padding: 10px 16px;
  margin-left: 6px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  font-size: 15px;
}
.auth-buttons button:hover {
  background-color: #666699;
}

/* Модальные окна */
.modal {
  display: none; /* Оставляем! Модалки по умолчанию скрыты. */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  
  /* --- ГЛАВНОЕ ИЗМЕНЕНИЕ --- */
  /* Используем Flexbox для центрирования, но выравниваем по верху, а не растягиваем */
  justify-content: center;  /* Центрирует по горизонтали */
  align-items: flex-start; /* ВЫРАВНИВАЕТ ПО ВЕРХУ, НЕ РАСТЯГИВАЯ */

  z-index: 500;
  overflow-y: auto;
  padding: 40px 10px;
  box-sizing: border-box;
}
.modal-content {
  background-color: #2d2d44;
  padding: 20px 25px;
  border-radius: 10px;
  max-width: 320px;
  width: 100%;
  box-sizing: border-box;
  color: #eee;
  margin: 0; /* margin: 0 auto не нужен, так как flex-центр. уже есть */
  margin-bottom: 40px; 
  position: relative;
}
.modal-content h3 {
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.2rem;
}
.modal-content label {
  display: block;
  margin-bottom: 6px;
  margin-top: 12px;
  font-weight: bold;
}
.modal-content input[type="text"],
.modal-content input[type="password"],
.modal-content input[type="number"] {
  width: 90%;
  padding: 10px 12px;
  border-radius: 5px;
  border: none;
  background: #333;
  color: #eee;
  font-size: 14px;
  margin-bottom: 10px;
}
.modal-content button {
  margin-top: 16px;
  width: 100%;
  padding: 12px 0;
  border: none;
  background-color: #5566aa;
  color: white;
  font-size: 16px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.modal-content button:hover {
  background-color: #7788cc;
}
.modal-content .close-btn {
  margin-top: 10px;
  background: #a94444;
}
.modal-content .close-btn:hover {
  background: #cc6666;
}

/* Основной контейнер аукциона */
.container {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
  margin: 70px auto;
  max-width: 1200px;
  padding: 0 20px;
  box-sizing: border-box;
}

/* Панель фильтров */
.filter-panel {
  width: 240px;
  background-color: #2b2b40;
  padding: 15px;
  border-radius: 8px;
  box-sizing: border-box;
  color: #eee;
  font-size: 14px;
  height: fit-content;
  /* --- НОВЫЕ СВОЙСТВА ДЛЯ ФИКСАЦИИ --- */
  position: fixed; /* Фиксируем панель */
  top: 90px; /* Отступ сверху, чтобы не залезать под шапку */
  left: 20px;  /* Отступ слева от края экрана */
}
.filter-panel h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 16px;
}
.filter-panel label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-weight: bold;
}
.filter-panel input,
.filter-panel select {
  width: 90%;
  padding: 6px 8px;
  border-radius: 5px;
  border: none;
  background-color: #1e1e2f;
  color: #eee;
}
.filter-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

/* Кнопка Add Item — размещаем над сеткой */
.add-lot-button-container {
  margin-top: 25px; /* Увеличим отступ сверху от последнего фильтра */
  text-align: left; /* Убираем выравнивание по центру */
  margin-bottom: 0; /* Убираем лишний нижний отступ */
}

.add-lot-button-container button {
  background-color: #5566aa;
  border: none;
  color: #eee;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
  width: 100%; /* Растянем кнопку на всю ширину панели */
}
.add-lot-button-container button:hover {
  background-color: #7788cc;
}

/* Сетка товаров — 2 ряда по 4 элемента */
.lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  justify-content: center;
  margin-bottom: 30px;
}

/* Карточка товара */
.lot {
  position: relative;
  background-color: #2a2a4a;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: #ddd;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lot:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.lot img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 6px;
  background: #1c1c3d;
}
.lot-name {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
  min-height: 48px;
}
.lot-price {
  font-size: 16px;
  color: #88cc88;
  margin-bottom: 6px;
}
.lot-quantity {
  font-size: 14px;
  color: #cccc88;
  margin-bottom: 6px;
}
.lot-seller {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 12px;
}
.lot-remove-btn {
  background-color: #aa4444;
  border: none;
  padding: 10px 12px;
  color: white;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}
.lot-remove-btn:hover {
  background-color: #cc6666;
}

/* Навигация по страницам */
.pagination {
  position: fixed; /* Фиксируем блок */
  bottom: 0;      /* Прижимаем к низу */
  left: 0;        /* Растягиваем на всю ширину */
  right: 0;       /* Растягиваем на всю ширину */
  text-align: center;
  user-select: none;
  background-color: #1e1e2f; /* Добавим фон, чтобы контент не просвечивал */
  padding: 15px 0;           /* Добавим отступы для красоты */
  z-index: 100;              /* Убедимся, что пагинация поверх частиц */
  border-top: 1px solid #333355; /* Тонкая линия сверху для отделения */
}
.pagination button {
  background-color: #444466;
  border: none;
  color: #eee;
  font-weight: bold;
  padding: 10px 14px;
  margin: 0 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 15px;
}
.pagination button:hover {
  background-color: #666699;
}
.pagination button:disabled {
  background-color: #222244;
  color: #555;
  cursor: default;
}
/* Основной контейнер с двумя колонками */
/* Основной контейнер с двумя колонками */
.main-container {
  margin: 43px auto 100px;
  /* 
    Ограничиваем максимальную ширину, чтобы центральная колонка
    не была слишком растянутой на широких мониторах.
    (240px левая панель + 240px правая панель + 2 * 30px отступы) 
    = 540px. 1200px - 540px = 660px на контент.
    Можно сделать чуть больше, например 1300px или 1400px.
  */
  max-width: 1400px;
  padding: 0 20px;
  box-sizing: border-box;
}

/* Панель фильтров */
.filter-panel {
  background-color: #2b2b40;
  padding: 15px;
  border-radius: 8px;
  color: #eee;
  font-size: 14px;
}
.filter-panel h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 16px;
}
.filter-panel label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-weight: bold;
}
.filter-panel input,
.filter-panel select {
  width: 90%;
  padding: 6px 8px;
  border-radius: 5px;
  border: none;
  background-color: #1e1e2f;
  color: #eee;
}

/* Правая часть — товары и пагинация */
.right-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Кнопка Add Item */
.add-lot-button-container {
  text-align: center;
  margin: 20px 0;
}
.add-lot-button-container button {
  background-color: #5566aa;
  border: none;
  color: #eee;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}
.add-lot-button-container button:hover {
  background-color: #7788cc;
}

/* Сетка товаров — 2 ряда по 4 элемента */
.lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  justify-content: center;
  margin-bottom: 30px;
  width: 100%;
}

/* Карточка товара */
.lot {
  background-color: #2a2a4a;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: #ddd;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lot:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.lot img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 6px;
  background: #1c1c3d;
}
.lot-name {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
  min-height: 48px;
}
.lot-price {
  font-size: 16px;
  color: #88cc88;
  margin-bottom: 6px;
}
.lot-seller {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 12px;
}
.lot-remove-btn {
  background-color: #aa4444;
  border: none;
  padding: 10px 12px;
  color: white;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}
.lot-remove-btn:hover {
  background-color: #cc6666;
}

/* Навигация по страницам */
.pagination {
  text-align: center;
  margin-top: 30px;
  user-select: none;
}
.pagination button {
  background-color: #444466;
  border: none;
  color: #eee;
  font-weight: bold;
  padding: 10px 14px;
  margin: 0 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 15px;
}
.pagination button:hover {
  background-color: #666699;
}
.pagination button:disabled {
  background-color: #222244;
  color: #555;
  cursor: default;
}

/* LOT DETAILS */

.lot-detail-content {
  max-width: 400px; /* Сделаем окно чуть шире */
  text-align: center;
}

.detail-lot-image {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 8px;
  background: #1c1c3d;
}

.detail-info-price {
  font-size: 20px;
  font-weight: bold;
  color: #88cc88;
  margin-bottom: 12px;
}

.detail-info-quantity,
.detail-info-seller,
.detail-info-discord {
  font-size: 16px;
  color: #ccc;
  margin-bottom: 8px;
}

.detail-info-description {
  font-size: 15px;
  color: #eee;
  margin-top: 15px;
  margin-bottom: 20px;
  text-align: left;
  white-space: pre-wrap; /* Сохраняет переносы строк в описании */
  background-color: #1e1e2f;
  padding: 10px;
  border-radius: 5px;
}

/* modaldiscord */

.lot-discord {
  font-size: 14px;
  color: #a0c4ff; /* Приятный голубой цвет */
  margin-bottom: 12px;
  word-break: break-all; /* Чтобы длинные ники не ломали верстку */
}

.user-panel {
  position: fixed; /* Фиксируем на экране */
  top: 70px;       /* Отступ сверху, как у панели фильтров */
  right: 20px;     /* Отступ справа от края экрана */
  width: 200px;    /* Такая же ширина, как у панели фильтров */
  padding: 15px;
  background-color: #2b2b40;
  border-radius: 8px;
  box-sizing: border-box;
  color: #eee;
}

.user-welcome {
  text-align: center;
  margin-bottom: 15px;
  font-size: 16px;
  word-wrap: break-word; /* Для длинных ников */
}

.user-panel-button {
  width: 100%;
  padding: 12px 0;
  margin-top: 10px;
  border: none;
  background-color: #5566aa;
  color: white;
  font-size: 16px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.user-panel-button:hover {
  background-color: #7788cc;
}

/* Для кнопки выхода сделаем другой цвет */
.user-panel-button[onclick="logout()"] {
    background-color: #aa4444;
}
.user-panel-button[onclick="logout()"]:hover {
    background-color: #cc6666;
}

/* =================================== */
/* === СТИЛИ ДЛЯ АДАПТИВНОСТИ === */
/* =================================== */

/* Сначала скрываем мобильные элементы на десктопе */
.mobile-header {
  display: none;
}
.mobile-overlay {
  display: none;
}

/* 
  Применяем стили, когда ширина экрана 992px или меньше.
  Это стандартная ширина для планшетов и телефонов.
*/
.panel-close-btn {
  display: none; /* По умолчанию кнопка скрыта */
}
@media (max-width: 992px) {

  /* --- Показываем мобильный заголовок, скрываем десктопный --- */
  .mobile-header {
  display: flex; /* Остается flex для вертикального выравнивания */
  align-items: center;
  justify-content: center; /* Центрируем h1 по умолчанию */
  background-color: #2b2b40;
  padding: 10px 15px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 600;
  box-sizing: border-box; /* Важно для правильных расчетов */
}

.mobile-header button {
  position: absolute; /* Вырываем кнопки из потока */
  top: 50%; /* Центрируем по вертикали */
  transform: translateY(-50%); /* Точная вертикальная центровка */
  background: #444466;
  border: none;
  color: #eee;
  padding: 8px 12px;
  border-radius: 5px;
}

/* Позиционируем левую кнопку */
.mobile-header button:first-of-type {
  left: 15px;
}

/* Позиционируем правую кнопку */
.mobile-header button:last-of-type {
  right: 15px;
}

.mobile-header h1 {
  font-size: 1.1rem;
  margin: 0;
  /* Добавляем отступы, чтобы текст не заезжал под кнопки */
  padding: 0 65px; 
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


  .desktop-header {
    display: none; /* Скрываем старый заголовок */
  }

  /* --- Переделываем боковые панели --- */
  .filter-panel, .user-panel {
    /* Панели теперь выезжают слева или справа */
    height: 100%;
    top: 0;
    z-index: 700;
    overflow-y: auto; /* Позволяет скроллить панель, если она длинная */
    transition: transform 0.3s ease-in-out;
    box-sizing: border-box;
    padding: 50px 15px 15px 15px; 
  }

  /* Левая панель (фильтры) */
  .filter-panel {
    left: 0;
    transform: translateX(-100%); /* Прячем за левый край */
  }
  .filter-panel.is-open {
    transform: translateX(0); /* Показываем */
  }

  /* Правая панель (пользователь) */
  .user-panel {
    right: 0;
    transform: translateX(100%); /* Прячем за правый край */
  }
  .user-panel.is-open {
    transform: translateX(0); /* Показываем */
  }

  /* --- Сбрасываем отступы у основного контента --- */
  .main-container {
    margin-top: 70px; /* Отступ от мобильной шапки */
  }
  
  .right-panel {
    margin-left: 0; /* Убираем отступ слева */
    width: 100%;
  }

  /* --- Оверлей для затемнения --- */
  .mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 650; /* Между панелью и контентом */
  }
  
  .mobile-overlay.active {
      display: block; /* Показываем, когда активен */
  }

  .panel-close-btn {
    display: block; /* Делаем кнопку видимой только на мобильных */
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #eee;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
  }
}

.share-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  cursor: pointer;
  color: #aaa;
  transition: color 0.2s, transform 0.2s;
}

.share-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

.share-btn:active {
  transform: scale(0.95);
}

/* Контейнер для кнопки F.A.Q. */
.faq-button-container {
  position: fixed;
  top: 20px;      /* Отступ сверху */
  right: 20px;    /* Отступ справа */
  z-index: 550;   /* Поверх частиц, но под мобильной шапкой */
}

.faq-button-container button {
  background-color: #5d4a9c; /* Немного другой цвет для выделения */
  border: 1px solid #8e7cc3;
  color: #eee;
  padding: 10px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  font-size: 15px;
}

.faq-button-container button:hover {
  background-color: #7a65c9;
}

/* Скрываем кнопку на мобильных устройствах, чтобы не загромождать интерфейс */
@media (max-width: 992px) {
  .faq-button-container {
    display: none;
  }
}

.lot-actions {
  display: grid; /* Используем Grid Layout */
  grid-template-columns: 1fr 1fr; /* Создаем 2 колонки равной ширины */
  gap: 10px;
  margin-top: 10px;
}

.lot-edit-btn {
  background-color: #4466aa;
  border: none;
  padding: 10px 12px;
  color: white;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.lot-edit-btn:hover {
  background-color: #6688cc;
}

/* Немного изменим кнопку удаления, чтобы она тоже была гибкой */
.lot-remove-btn {
  flex-grow: 1;
}

/* Стиль для кнопки "Share" в состоянии успеха */
.share-btn.success {
  color: #88cc88; /* Яркий зеленый цвет */
  font-weight: bold;
  font-size: 14px; /* Уменьшим размер, чтобы текст поместился */
  width: 90px; /* Зададим ширину, чтобы кнопка не "прыгала" */
  text-align: center;
}

/* Также нужно убедиться, что у самой иконки есть размер, чтобы кнопка не сжималась */
.share-btn svg {
  width: 24px;
  height: 24px;
  display: block; /* Убирает лишние отступы под иконкой */
}

.loader {
  border: 8px solid #333355; /* Цвет "кольца" */
  border-top: 8px solid #7788cc; /* Цвет движущейся части */
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  
  /* Центрирование спиннера внутри сетки */
  position: absolute;
  top: 150px; /* Примерный отступ сверху */
  left: calc(50% - 30px); /* Половина ширины сетки минус половина ширины спиннера */
}

/* Анимация вращения */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.listing-type-selector {
  display: flex;
  margin-bottom: 20px;
  border-radius: 5px;
  overflow: hidden;
  /* border: 1px solid #444466; <-- УБИРАЕМ РАМКУ ОТСЮДА */
}

.listing-type-selector input { display: none; }

.listing-type-selector label {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: #2d2d44;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  /* --- НАЧАЛО ИЗМЕНЕНИЙ --- */
  /* Добавляем рамку к самим меткам, кроме правого края */
  border: 1px solid #444466;
  border-right: none;
  /* --- КОНЕЦ ИЗМЕНЕНИЙ --- */
}

/* Добавляем правый бордер только для последней метки */
.listing-type-selector label:last-of-type {
    border-right: 1px solid #444466;
}

.listing-type-selector input:checked + label {
  background: #5566aa;
  color: white;
  font-weight: bold;
  border-color: #5566aa; /* Делаем рамку активной кнопки того же цвета */
}

.lot-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    border-radius: 5px;
    text-transform: uppercase;
}
.lot-tag.wts { background-color: #4CAF50; } /* Зеленый для продажи */
.lot-tag.wtb { background-color: #2196F3; } /* Синий для покупки */

.main-filter-switch {
  display: flex;
  margin-bottom: 20px;
  border-radius: 5px;
  overflow: hidden;
}
.main-filter-switch input { display: none; }
.main-filter-switch label {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: #1e1e2f;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
}
.main-filter-switch input:checked + label {
  background: #7788cc;
  color: white;
}

/* =================================== */
/* === СТИЛИ ДЛЯ КАСТОМНОГО СКРОЛЛБАРА (ТОЛЬКО ДЛЯ ПК) === */
/* =================================== */

/* Применяем стили только на экранах шире, чем наш мобильный брейкпоинт */
@media (min-width: 993px) {

  /* --- Простой фолбэк для Firefox --- */
  .modal-body {
    scrollbar-width: thin; /* Делает скроллбар тонким */
    scrollbar-color: #5566aa #1e1e2f; /* Цвет ползунка и цвет трека */
  }

  /* --- Продвинутые стили для WebKit-браузеров (Chrome, Safari, Edge) --- */

  /* 1. Сам скроллбар (задает ширину) */
  .modal-body::-webkit-scrollbar {
    width: 10px;
  }

  /* 2. Трек (фон, по которому движется ползунок) */
  .modal-body::-webkit-scrollbar-track {
    background: #1e1e2f; /* Темный фон, как у основного body */
    border-radius: 10px;
  }

  /* 3. Ползунок (самая важная часть) */
  .modal-body::-webkit-scrollbar-thumb {
    background-color: #5566aa; /* Цвет как у кнопок */
    border-radius: 20px; /* Делает его полностью круглым */
    
    /* Добавляем рамку в цвет трека, чтобы создать отступ */
    border: 2px solid #1e1e2f; 
  }

  /* 4. Ползунок при наведении курсора */
  .modal-body::-webkit-scrollbar-thumb:hover {
    background-color: #7788cc; /* Цвет как у кнопок при наведении */
  }
}