/* GhostSocial · ПК-режим · 2026-10-22
   Отдельный слой поверх ghostsocial-v2-ui.css.
   Включается на ширине окна ≥1100px и только если не установлено расширение
   GhostPLUS (html.gp-enabled) — иначе управление оверлеем у расширения.

   Сетка:  [ рельс 224px ][ gap 28px ][ колонка 640/760px ]
            └──────── группа центрируется в окне ────────┘
*/

/* ── 1. Базовая сетка ─────────────────────────────────────────────────────── */

@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready {
    --pc-rail: 224px;
    --pc-gap: 28px;
    --pc-col: 640px;
    --pc-header-h: 56px;
    --pc-total: calc(var(--pc-rail) + var(--pc-gap) + var(--pc-col));
    --pc-offset: calc((100vw - var(--pc-total)) / 2);
    --pc-content-x: calc(var(--pc-offset) + var(--pc-rail) + var(--pc-gap));

    --content-w: var(--pc-col);
    --nav-h: 0px;

    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    background: #0c0c0e;
  }

  @media (min-width: 1280px) {
    html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready {
      --pc-col: 760px;
    }
  }
}

/* ── 2. Нижний док убираем, шапка — sticky внутри колонки ───────────────── */

@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready:not(.miniska-mode) {
    padding-top: 0 !important;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #appNav {
    display: none !important;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready:not(.miniska-mode) #appHeader {
    position: sticky !important;
    inset: auto !important;
    top: 0 !important;
    left: auto !important;
    right: auto !important;
    z-index: 100;
    width: var(--pc-col) !important;
    max-width: var(--pc-col) !important;
    margin: 0 0 0 var(--pc-content-x) !important;
    height: auto !important;
    background: color-mix(in srgb, var(--surface) 72%, transparent) !important;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready:not(.miniska-mode) #appHeader .header-top {
    max-width: 100%;
    margin: 0;
    height: var(--pc-header-h);
    padding: 0 24px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready:not(.miniska-mode) #feedSwitch {
    width: 100%;
    max-width: 100%;
    margin: 0;
    height: 44px;
    padding: 0 24px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready:not(.miniska-mode) #appMain {
    width: var(--pc-col) !important;
    max-width: var(--pc-col) !important;
    margin: 0 0 0 var(--pc-content-x) !important;
    padding: 8px 0 40px !important;
    border-inline: 1px solid var(--border);
    background: var(--bg);
  }
}

/* ── 3. Левый рельс ──────────────────────────────────────────────────────── */

@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #dtSideLeft {
    display: flex !important;
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--pc-offset);
    z-index: 110;
    width: var(--pc-rail);
    flex-direction: column;
    gap: 4px;
    padding: 18px 12px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--border);
    background: var(--bg);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #dtSideLeft > div:first-child {
    padding: 4px 12px 18px !important;
    font-size: 21px !important;
    font-weight: 800 !important;
    letter-spacing: -.4px !important;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    margin: 1px 0;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--sub);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--gs-fast, 160ms), color var(--gs-fast, 160ms);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn:hover {
    background: var(--surface);
    color: var(--text);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn.active {
    background: rgba(179, 154, 244, .12);
    color: var(--primary);
    font-weight: 600;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn i,
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn .nav-icon-wrap > i {
    width: 20px;
    flex: none;
    font-size: 17px;
    text-align: center;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn .nav-icon-wrap {
    position: relative;
    display: inline-flex;
    justify-content: center;
    width: 20px;
    flex: none;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-nav-btn .notif-badge {
    position: absolute;
    top: -3px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 16px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 10px;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #1a1427;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: filter var(--gs-fast, 160ms), transform var(--gs-fast, 160ms);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-create-btn:hover {
    filter: brightness(1.06);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-create-btn:active {
    transform: translateY(1px);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .dt-side-foot {
    margin-top: auto;
    padding: 14px 4px 0;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
  }
}

/* ── 4. Миниски: вертикальное видео остаётся, но в колонке ──────────────── */

@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready.miniska-mode #screenMinisky {
    left: var(--pc-content-x) !important;
    right: auto !important;
    width: var(--pc-col) !important;
    max-width: var(--pc-col) !important;
  }
}

/* ── 5. Диалоги и тосты на ПК ───────────────────────────────────────────── */

@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .modal-overlay,
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .gs-modal-ov {
    align-items: center;
    padding: 24px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .modal-sheet,
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .gs-modal {
    width: min(100%, 640px);
    max-height: calc(100dvh - 64px);
    padding: 20px 24px 24px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .62);
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .modal-handle,
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .m-handle {
    display: none !important;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .toast {
    left: auto;
    right: 24px;
    bottom: 24px;
    transform: none;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--surface2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  }
}

/* ── 6. Фокус и мелочи плотности ────────────────────────────────────────── */

@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready :is(button, a, input, textarea):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .post-content {
    max-width: 640px;
    overflow-wrap: anywhere;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready .gs-profile-body {
    max-width: 640px;
    margin: 0 auto;
  }
}

/* ── 7. Компонент «Миниски» в поиске (работает и на мобильном) ──────────── */

.search-miniska-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.search-miniska {
  display: block;
  padding: 0;
  border: 1px solid var(--sg-hair, rgba(255, 255, 255, .065));
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform var(--gs-fast, 160ms), border-color var(--gs-fast, 160ms);
}

.search-miniska:hover { border-color: var(--border-strong); }
.search-miniska:active { transform: translateY(1px); }

.search-miniska-media {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  background: #000;
}

.search-miniska-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-miniska-none {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 18px;
}

.search-miniska-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 11px;
  opacity: .9;
}

.search-miniska-ttl {
  position: absolute;
  right: 6px;
  top: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10px;
  line-height: 1.4;
}

.search-miniska-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
}

.search-miniska-av {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface2);
  color: var(--primary);
  font-size: 10px;
  font-weight: 600;
}

.search-miniska-av img { width: 100%; height: 100%; object-fit: cover; }

.search-miniska-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 8. ПК-поиск: колонки и расширенная колонка контента ───────────────── */

@media (min-width: 1280px) and (max-width: 1439px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready.gs-search-screen {
    --pc-col: 980px;
  }
}

@media (min-width: 1440px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready.gs-search-screen {
    --pc-col: 1180px;
  }
}

@media (min-width: 1280px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-results {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group {
    margin: 0 0 22px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="tags"] {
    grid-column: 1 / -1;
    order: 0;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="posts"] {
    grid-column: 1;
    order: 1;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="comments"] {
    grid-column: 1;
    order: 2;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="miniska"] {
    grid-column: 2;
    order: 3;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="people"] {
    grid-column: 2;
    order: 4;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="channels"] {
    grid-column: 2;
    order: 5;
  }

  /* выбран конкретный таб — одна широкая колонка */
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-results.gs-search-single {
    grid-template-columns: minmax(0, 1fr);
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-results.gs-search-single .search-group {
    grid-column: 1 !important;
  }
}

@media (min-width: 1440px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-results {
    grid-template-columns: minmax(0, 1fr) 280px 300px;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="miniska"] {
    grid-column: 2;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="people"] {
    grid-column: 3;
  }
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-group[data-search-kind="channels"] {
    grid-column: 3;
  }
}

/* табы-фильтры на ПК — сегментированный контрол */
@media (min-width: 1000px) {
  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-filters {
    display: flex;
    gap: 4px;
    margin: 0 0 18px;
    padding: 4px;
    border: 1px solid var(--sg-hair, rgba(255, 255, 255, .065));
    border-radius: 14px;
    background: var(--surface);
    overflow-x: auto;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-filter {
    height: 32px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
  }

  html:is(.gs-pc, :not(.gp-enabled)) body.ghostsocial-v2.gs-v2-ready #screenSearch .search-filter.active {
    background: rgba(179, 154, 244, .14);
    border-color: rgba(179, 154, 244, .20);
    color: var(--primary);
  }
}
