/* ========== Mobile-only / Desktop-only helpers ========== */
.header-mobile-only {
  display: none !important;
}
.header-desktop-only {
  display: flex !important;
}
.header-menu.header-desktop-only {
  display: flex !important;
}
.account-menu.header-desktop-only {
  display: flex !important;
}

/* ========== Sidebar filter button (visible only when sidebar exists, set via JS body.sidebar-page) ========== */
.sidebar-filter-btn {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 4px 0 0 4px;
  background: #e8e8e8;
  border: 1px solid #d8d8d8;
  border-right: none;
  color: #404040;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
  transition:
    background 0.2s,
    color 0.2s;
}
.sidebar-filter-btn:hover {
  background: #ebb62c;
  color: #4b4c4d;
}

/* ========== Sidebar close button (mobile) ========== */
.sidebar-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
  color: #404040;
}
.sidebar-close:hover {
  color: #212025;
}
.sidebar-close svg {
  display: block;
}

/* ========== Sidebar overlay backdrop ========== */
.sidebar-overlay-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s;
}
body.sidebar-open .sidebar-overlay-backdrop {
  opacity: 1;
}

/* ========== Header nav overlay (burger menu) ========== */
.header-nav-overlay {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: #e8e8e8;
  border-left: 1px solid #d8d8d8;
  z-index: 1002;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}
body.header-nav-open .header-nav-overlay {
  transform: translateX(0);
}
.header-nav-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #404040;
}
.header-nav-close:hover {
  color: #212025;
}
.header-nav-close svg {
  display: block;
}
.header-nav-overlay-inner {
  padding: 50px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.header-nav-overlay-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.header-nav-overlay-account {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.header-nav-overlay-account .account-menu-item {
  padding: 10px 0;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: #ffa007;
}
.header-nav-overlay-account .account-menu-item + .account-menu-item {
  border-left: 1px solid #e3e3e3;
  margin-left: 13px;
  padding-left: 13px;
}
.header-nav-overlay-account .account-menu-item:hover {
  color: #fccd52;
}
.header-nav-overlay-account .account-menu-item.account-menu-edit {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-nav-overlay-account .account-menu-item.account-menu-edit svg {
  flex-shrink: 0;
}
.header-nav-overlay-menu .top-menu-item {
  padding: 10px 0;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: #212025;
  text-decoration: none;
}
.header-nav-overlay-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #d8d8d8;
}
.header-nav-overlay-links .header-menu-item {
  padding: 10px 0;
  font-size: 14px;
  color: #404040;
}
.header-nav-topup {
  margin-top: 10px;
  width: 100%;
}
.header-nav-wishlist-copy,
.header-nav-stat-copy {
  display: none; /* optional: clone from header if needed */
}

/* ========== Header burger button ========== */
.header-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.header-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #e3e3e3;
  transition: 0.3s;
}
body.header-nav-open .header-burger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.header-nav-open .header-burger span:nth-child(2) {
  opacity: 0;
}
body.header-nav-open .header-burger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========== Breakpoint: 1200px ========== */
@media (max-width: 1200px) {
  .container {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }
  .top-content {
    gap: 24px;
  }
  .header-menu {
    gap: 32px;
    padding-left: 16px;
  }
  .main-grid {
    gap: 4px;
  }
  #sidebar {
    min-width: 200px;
    flex: 0 0 200px;
  }
  #sidebar + .main-column {
    min-width: calc(100% - 204px);
    flex: calc(100% - 204px);
  }
}

/* ========== Breakpoint: 1140px ========== */
@media (max-width: 1140px) {
  .top-content {
    gap: 16px;
  }
  .header-menu {
    gap: 24px;
  }
  .header-right {
    gap: 12px;
  }
  .track-name {
    max-width: 320px;
  }
  .header-menu-item + .header-menu-item::before {
    left: -12px;
  }
}

/* ========== Breakpoint: 1080px ========== */
@media (max-width: 1080px) {
  #sidebar {
    min-width: 180px;
    flex: 0 0 180px;
  }
  #sidebar + .main-column {
    min-width: calc(100% - 184px);
    flex: calc(100% - 184px);
  }
  .track-genre {
    min-width: 90px;
    flex: 0 0 90px;
    font-size: 10px;
  }
  .track-key {
    min-width: 44px;
    flex: 0 0 44px;
    font-size: 10px;
  }
  .track-bpm {
    min-width: 36px;
    flex: 0 0 36px;
    font-size: 10px;
  }
  .track-download-block {
    min-width: 90px;
    flex: 0 0 90px;
  }
}

/* ========== Breakpoint: 1024px ========== */
@media (max-width: 1024px) {
  .top-menu {
    gap: 20px;
  }
  .header-menu {
    gap: 20px;
  }
  .track-name {
    max-width: 260px;
  }
  .releases-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .releases-header-title {
    width: 100%;
    order: -1;
    text-align: left;
    font-size: 13px;
  }
  .release-block-left {
    min-width: 220px;
    flex: 0 0 220px;
  }
  /* release-block-right: шрифты ~20% меньше на мобильных */
  .release-block-right .release-title {
    font-size: 16px;
  }
  .release-block-right .release-info,
  .release-block-right .release-info-value {
    font-size: 11px;
  }
  .release-block-right .releated-title {
    font-size: 14px;
  }
  .top-menu-item + .top-menu-item::before {
    left: -10px;
  }
}

/* ========== Breakpoint: 860px — Burger + Sidebar overlay ========== */
@media (max-width: 860px) {
  .header-mobile-only {
    display: flex !important;
  }
  .header-desktop-only,
  .sticly-panel .top-panel .top-menu,
  .sticly-panel .top-panel .account-menu,
  .sticly-panel header .header-content .header-menu,
  .sticly-panel header .header-right .common-wishlist,
  .sticly-panel header .header-right .common-stat,
  .sticly-panel header .header-right .btn.btn-primary {
    display: none !important;
  }
  .header-burger {
    display: flex;
  }

  /* Body class to show overlay */
  body.sidebar-page .sidebar-filter-btn {
    display: flex;
  }
  body.sidebar-page .sidebar-overlay-backdrop {
    display: block;
    pointer-events: none;
  }
  body.sidebar-open .sidebar-overlay-backdrop {
    pointer-events: auto;
  }

  /* Sidebar: hide from flow, show as fixed overlay from right */
  .main-grid {
    flex-direction: column;
  }
  #sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 90vw;
    height: 100%;
    min-width: 0;
    flex: none;
    z-index: 1002;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    margin: 0;
    padding-top: 52px;
    background: #ededed;
  }
  body.sidebar-page .sidebar-close {
    display: flex;
  }
  body.sidebar-open #sidebar {
    transform: translateX(0);
  }
  #sidebar + .main-column {
    min-width: 100%;
    flex: 1 1 100%;
  }

  /* Top panel: logo + громкость + бургер (поиск перенесён в нижнюю полосу) */
  .top-content {
    gap: 10px;
    padding: 8px 0;
  }
  .top-panel #search.header-desktop-search {
    display: none !important;
  }
  .top-panel .common-mute-top {
    margin-left: auto;
  }
  .logo img {
    max-height: 28px;
    width: auto;
  }
  #s {
    font-size: 12px;
  }
  /* Нижняя полоса шапки: только поиск на всю ширину */
  header .header-content {
    padding: 4px;
    flex-wrap: wrap;
    gap: 8px;
    display: flex !important;
  }
  header .header-content .header-menu,
  header .header-right {
    display: none !important;
  }
  header .header-content #search-mobile-wrap {
    display: flex !important;
    width: 100%;
    flex: 1 1 100%;
  }
  .search-fullwidth form {
    display: flex;
    position: relative;
    width: 100%;
  }
  .search-fullwidth form input {
    width: 100%;
    border-radius: 4px;
    border: 1px solid rgba(227, 227, 227, 0.5);
    background: #e8e8e8;
    height: 32px;
    padding: 0 10px 0 40px;
    color: #212025;
    font-size: 13px;
  }
  .search-fullwidth form button[type="submit"] {
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #515151;
  }
  header .header-desktop-mute {
    display: none !important;
  }

  /* Content: releases header compact */
  .releases-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .track-genre.head-param,
  .track-key.head-param,
  .track-bpm.head-param {
    display: none;
  }
  .releases-header-title {
    font-size: 13px;
  }

  /* Track: строка 1 — image + main-info, строка 2 — track-param (genre, key, bpm), строка 3 — download */
  .track-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .track-item::after {
    content: "";
    order: 2;
    flex-basis: 100%;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
  }
  .track-item .track-image {
    order: 1;
    margin: 0;
  }
  .track-item .track-main-info {
    order: 10;
    flex: 1 1 0;
    min-width: 100%;
    padding-right: 0;
    padding-left: 0;
    height: 49px;
  }
  .track-item .track-genre.track-param,
  .track-item .track-key.track-param,
  .track-item .track-bpm.track-param {
    order: 2;
    font-size: 10px;
    min-width: calc((100% - 47px - 90px) / 3);
    flex: 0 0 calc((100% - 47px - 90px) / 3);
    text-align: center;
  }
  #controls {
    margin-top: 48px;
  }
  .is-wave {
    height: 49px !important;
    bottom: 0px;
    top: auto !important;
    left: 24px !important;
    border-radius: 0 0 4px 0;
  }
  .track-item .track-download-block {
    order: 2;
    border-left: none;
  }
  .track-name {
    max-width: none;
  }
  .track-title {
    font-size: 11px;
  }
  .track-desc {
    font-size: 9px;
  }
  .top-menu-item + .top-menu-item::before {
    height: 1px;
    width: 50px;
    left: 0;
    top: -5px;
  }
  .header-nav-overlay-account .account-menu-item.account-menu-edit {
    color: #404040;
  }
  .header-nav-overlay-account {
    justify-content: center;
  }
  .common-wishlist {
    margin: 0 auto;
  }
}

/* ========== Breakpoint: 770px ========== */
@media (max-width: 770px) {
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  .modal {
    width: 96%;
    padding: 10px;
  }
  .modal-content {
    padding: 20px;
  }
  .header-nav-overlay {
    width: 260px;
  }
}

/* ========== Breakpoint: 640px ========== */
@media (max-width: 640px) {
  .top-panel .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  #search {
    max-width: 140px;
  }
  .sidebar-filter-btn {
    width: 40px;
    height: 40px;
  }
  #sidebar {
    width: 260px;
  }
  .track-genre.track-param,
  .track-key.track-param,
  .track-bpm.track-param {
    min-width: 36px;
    font-size: 9px;
  }
  .btn-download {
    font-size: 9px;
  }
  .pagination {
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-100-item {
    min-width: 120px;
    flex: 0 0 120px;
  }
  .release-block {
    flex-direction: column;
    align-items: center;
  }
  .release-block-right {
    width: 100%;
  }
}

/* ========== Breakpoint: 480px ========== */
@media (max-width: 480px) {
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }
  .logo img {
    max-height: 24px;
  }
  #search.header-desktop-search {
    max-width: 120px;
  }
  .header-nav-overlay {
    width: 100%;
    max-width: 100%;
  }
  #sidebar {
    width: 100%;
    max-width: 100%;
  }
  .track-genre.track-param,
  .track-key.track-param,
  .track-bpm.track-param {
    flex: 1 1 33%;
    text-align: center;
    padding: 2px 0;
  }
  .releases-header-sort .common-select,
  .releases-header-format .common-select {
    max-width: none;
  }
  .widget-title {
    font-size: 16px;
  }
  .btn-menu {
    font-size: 12px;
  }
  .track-item .track-key.track-param,
  .track-item .track-bpm.track-param {
    min-width: 40px;
    flex: 0 0 40px;
  }
  .track-item .track-genre.track-param {
    min-width: calc(100% - 80px - 90px - 40px);
    flex: 0 0 calc(100% - 80px - 90px - 40px);
    text-align: left;
    padding-left: 5px;
  }
  .track-image {
    min-width: 40px;
    flex: 0 0 40px;
    height: 40px;
  }
  .track-image img {
    width: 100%;
    height: auto;
  }
      #controls {
        margin-top: 41px;
    }
}

/* ========== Breakpoint: 360px ========== */
@media (max-width: 360px) {
  .container {
    padding-left: 6px;
    padding-right: 6px;
  }
  #search {
    max-width: 100px;
  }
  .sidebar-filter-btn {
    width: 36px;
    height: 36px;
    right: 0;
  }
  .track-title {
    font-size: 10px;
  }
  .track-desc {
    font-size: 8px;
  }
  .keys button {
    min-width: 25%;
    flex: 0 0 25%;
  }
  .top-100-item {
    min-width: 100px;
    flex: 0 0 100px;
  }
}
