:root {
  --page-max: 1200px;
  --page-pad: 80px;

  /* доли колонок на больших экранах */
  --col-platform: 0.10fr;
  --col-description: 0.62fr;
  --col-seller: 0.16fr;
  --col-price: 0.12fr;
}

/* === ОСНОВА === */
.main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px var(--page-pad);
}
.content {
  width: 100%;
  max-width: var(--page-max);
}

/* === ВКЛАДКИ === */
.service-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.pill-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 165, 0, 0.3);
  color: #ffcc66;
  background: rgba(26, 26, 26, 0.85);
  text-decoration: none;
  font-weight: 500;
  transition: 0.25s;
}
.pill-btn:hover {
  color: #ffa500;
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.25);
  transform: scale(1.05);
}
.pill-active {
  background: #ffa500;
  color: #000;
}

/* === КНОПКА "ПОКАЗАТЬ ЕЩЁ" === */
.load-more-wrapper {
  margin-top: 18px;
  text-align: center;
}
.load-more-btn {
  margin-top: 4px;
}
.hidden {
  display: none;
}

/* === ФИЛЬТРЫ === */
.filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.filters-left {
  display: flex;
  align-items: center;
  gap: 15px;
}
.filter-select {
  background: none;
  border: none;
  color: #ffa500;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  transition: 0.25s;
}
.filter-select:hover {
  color: #ffcc66;
  text-shadow: 0 0 8px #ffa500;
}

/* === ДРОПДАУН ПЛАТФОРМЫ === */
.dropdown-content.platform-dropdown {
  display: none;
  position: absolute;
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 8px;
  min-width: 140px;
  top: 110%;
  left: 0;
  overflow: hidden;
  z-index: 15;
}
.dropdown-content.platform-dropdown.show {
  display: block;
  animation: fadeIn 0.15s ease-in-out;
}
.platform-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 14px;
  color: #ffa500;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}
.platform-dropdown button:hover {
  background: rgba(255, 165, 0, 0.1);
  color: #ffcc66;
  text-shadow: 0 0 8px #ffa500;
}

.online-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
  font-size: 0.9rem;
}
.toggle-switch {
  position: relative;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid rgba(255, 165, 0, 0.35);
  border-radius: 999px;
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 2px;
  border-radius: 50%;
  background: #777;
  transition: transform 0.2s ease, background 0.2s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(255, 165, 0, 0.25);
  border-color: rgba(255, 165, 0, 0.6);
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.25);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #ffa500;
}

/* === ТАБЛИЦА (grid-строки, вид как таблица) === */
.offers-table {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
}

/* каждая строка — grid с 4 колонками */
.offers-header,
.offer-row {
  display: grid;
  grid-template-columns:
    var(--col-platform)
    var(--col-description)
    var(--col-seller)
    var(--col-price);
}

/* ячейки */
.offers-header div,
.cell {
  border-right: 1px solid rgba(255, 165, 0, 0.2);
  border-bottom: 1px solid rgba(255, 165, 0, 0.2);
  padding: 10px 14px;
  font-size: 14px;
  display: flex;
  align-items: center;

  /* ВАЖНО: позволяем ячейкам сжиматься и не ломать сетку */
  min-width: 0;
}

/* последняя ячейка без правой границы */
.offers-header div:last-child,
.offer-row .cell:last-child {
  border-right: none;
}

/* шапка */
.offers-header div {
  background: rgba(255, 165, 0, 0.15);
  color: #ffcc66;
  font-weight: 600;
  justify-content: center;
}

/* выравнивания по колонкам */
.offers-header div:nth-child(1),
.offer-row .cell:nth-child(1) {
  justify-content: center;
}
.offers-header div:nth-child(2) {
  justify-content: flex-start;
}
.offer-row .cell:nth-child(2) {
  justify-content: center;
}
.offers-header div:nth-child(3),
.offer-row .cell:nth-child(3) {
  justify-content: center;
}
.offers-header div:nth-child(4),
.offer-row .cell:nth-child(4) {
  justify-content: flex-end;
  color: #ffcc66;
  font-weight: 600;
}

/* семантические классы для ячеек (удобно прятать/показывать на мобиле) */
.cell-description {
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ховер по строке */
.offer-row:hover .cell {
  background: rgba(255, 165, 0, 0.08);
}

/* Описание (общий текст) */
.offer-description-text {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  max-width: 100%;
}

/* === ПРОДАВЕЦ === */
.seller-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.avatar-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.seller-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.seller-avatar:hover {
  transform: scale(1.06);
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.4);
}
.status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #111;
}
.status-dot.online {
  background: #2ecc71;
}
.status-dot.offline {
  background: #555;
}
.seller-name {
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: color 0.2s;
  white-space: nowrap;
}
.seller-name.online-name {
  color: #f5f5f5;
}
.seller-name.offline-name {
  color: #888;
}
.seller-name:hover {
  color: #ffa500;
  text-shadow: 0 0 6px rgba(255, 165, 0, 0.6);
}

/* === ПУСТО === */
.empty-box {
  background: rgba(26, 26, 26, 0.85);
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #bbb;
}

/* === СОРТИРОВКА === */
.sortable {
  cursor: pointer;
  transition: color 0.3s, text-shadow 0.3s;
}
.sortable:hover {
  color: #ffcc66;
  text-shadow: 0 0 8px #ffa500;
}
#price-arrow {
  margin-left: 6px;
  font-weight: 700;
  display: inline-block;
  transition: transform 0.25s ease, color 0.25s ease;
}

/* ====== Мобильные элементы в описании (по умолчанию скрыты) ====== */
.mobile-platform {
  display: none;
  font-size: 12px;
  color: #b0b0b0;   /* серый */
  margin-bottom: 4px;
}
.mobile-seller {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* === АДАПТИВ: планшеты === */
@media (max-width: 1024px) {
  :root {
    --page-pad: 40px;

    --col-platform: 0.13fr;
    --col-description: 0.52fr;
    --col-seller: 0.21fr;
    --col-price: 0.14fr;
  }

  .main {
    padding: 30px var(--page-pad);
  }

  .service-tabs {
    gap: 6px;
  }

  .pill-btn {
    padding: 7px 12px;
    font-size: 14px;
  }

  .filters-bar {
    gap: 14px;
  }

  .offers-header div,
  .cell {
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* === АДАПТИВ: телефоны (2 колонки: описание + цена) === */
@media (max-width: 700px) {
  :root {
    --page-pad: 16px;
  }

  .main {
    padding: 20px var(--page-pad);
  }

  .content {
    max-width: 100%;
  }

  .service-tabs {
    gap: 8px;
    justify-content: center;
  }

  .pill-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .filters-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .filters-left {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .filters-right {
    width: 100%;
  }

  .filters-right .pill-btn {
    width: 100%;
    text-align: center;
  }

  .filter-select {
    font-size: 14px;
    padding: 6px 8px;
  }

  .filters-left {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .dropdown {
    flex-shrink: 0;
  }

  .online-toggle {
    font-size: auto;
  }

  /* --- ШАПКА: 2 колонки (описание, цена) --- */
  .offers-header {
    grid-template-columns: 2fr 1fr;
  }

  .offers-header div:nth-child(1),
  .offers-header div:nth-child(3) {
    display: none;
  }

  .offers-header div:nth-child(2) {
    grid-column: 1;
  }
  .offers-header div:nth-child(4) {
    grid-column: 2;
  }

  .offer-row {
    grid-template-columns: 2fr 1fr;
  }

  .cell-platform,
  .cell-seller-desktop {
    display: none;
  }

  .cell-description {
    grid-column: 1;
  }

  .price-cell {
    grid-column: 2;
  }

  .mobile-platform,
  .mobile-seller {
    display: flex;
  }
  .mobile-platform {
    display: block;
  }

  .offers-header div,
  .cell {
    padding: 8px 8px;
    font-size: 13px;
  }

  .avatar-wrapper,
  .seller-avatar {
    width: 32px;
    height: 32px;
  }

  .seller-name {
    font-size: 14px;
  }

  .offer-description-text {
    line-height: 1.3;
  }
}

/* === iPad Mini / узкие планшеты (ширина 768–850px) === */
@media (max-width: 950px) and (min-width: 701px) {

  /* Чуть меняем пропорции колонок */
  :root {
    --col-platform: 0.13fr;
    --col-description: 0.51fr;
    --col-seller: 0.21fr;
    --col-price: 0.15fr;
  }

  /* Уменьшаем аватар продавца */
  .avatar-wrapper,
  .seller-avatar {
    width: 32px;
    height: 32px;
  }

  /* Имя продавца делаем компактнее */
  .seller-name {
    font-size: 14px;
  }

  /* Чуть увеличим горизонтальные отступы в ячейках */
  .cell,
  .offers-header div {
    padding: 8px 10px;
  }
}

/* === АНИМАЦИЯ ДРОПДАУНА === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === LIGHT THEME === */
body.light-theme .pill-btn {
  color: #000;
  background: #ffffff;
  border: 1px solid #bbbbbb;
  transition: all 0.2s ease;
}
body.light-theme .pill-btn:hover {
  color: #e19b00;
  border: 1px solid #bebebe;
}

body.light-theme .filter-select {
  color: #000;
}
body.light-theme .filter-select:hover {
  color: #e19b00;
  text-shadow: none;
}

body.light-theme .platform-dropdown button {
  color: #000;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
body.light-theme .platform-dropdown button:hover {
  color: #e19b00;
  border-color: #bebebe;
}

body.light-theme .online-toggle {
  color: #909090;
}
body.light-theme .toggle-slider {
  background: #f0f0f0;
  border-color: #bebebe;
}
body.light-theme .toggle-switch input:checked + .toggle-slider {
  background: #d6ecff;
  border-color: #8fc4ff;
  box-shadow: none;
}
body.light-theme .toggle-slider::before {
  background: #999;
}
body.light-theme .toggle-switch input:checked + .toggle-slider::before {
  background: #4aa3ff;
}

body.light-theme .empty-box {
  background-color: #ffffff;
  border: 1px solid #bebebe;
  color: #909090;
}

body.light-theme .offers-table {
  border: 1px solid #bebebe;
}

body.light-theme .offers-header div {
  color: #000;
  background: none;
}

body.light-theme .offer-row .cell:nth-child(4) {
  color: #000;
}

body.light-theme .offers-header div,
body.light-theme .cell {
  border-right: 1px solid #bebebe;
  border-bottom: 1px solid #bebebe;
}

body.light-theme .sortable:hover {
  text-shadow: none;
}

body.light-theme .offers-header {
  background-color: #cacaca;
}

body.light-theme .offer-row:hover {
  background-color: #d0cfcf;
}

body.light-theme .offer-row:hover .cell {
  background: none;
}

body.light-theme .seller-name.online-name {
  color: #000;
  text-shadow: none;
}
body.light-theme .seller-name.online-name:hover {
  color: #ffa500;
  text-shadow: 0 0 6px rgba(255, 165, 0, 0.6);
}

body.light-theme .seller-avatar:hover {
  box-shadow: none;
}
