/* Mobile layout fixes for NOFI */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

html {
  scroll-padding-top: 78px;
}

#app {
  padding-top: 70px;
}

.header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1200;
  border-radius: 0 !important;
}

.music-player-dock.is-hidden {
  display: none !important;
}

.theme-toggle [hidden] {
  display: none !important;
}

@media (max-width: 767px) {
  html {
    scroll-padding-top: 66px;
  }

  #app {
    padding-top: 58px;
  }

  .header {
    z-index: 1200;
  }

  .header__inner {
    position: relative !important;
    grid-template-columns: auto 1fr !important;
    min-height: 54px !important;
    padding: 0.38rem 0 0.38rem 48px !important;
    gap: 0.7rem !important;
  }

  .header__right {
    position: static !important;
    justify-self: end !important;
    min-width: 0 !important;
  }

  .header__brand {
    min-width: 0 !important;
  }

  .header__brand-mark {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }

  .header__logo-img {
    width: 24px !important;
    height: 24px !important;
  }

  .header__brand-eyebrow {
    font-size: 0.48rem !important;
  }

  .header__brand-main {
    font-size: 0.82rem !important;
  }

  .mobile-menu-toggle {
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 3 !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  .mobile-menu-toggle:hover,
  .mobile-menu-toggle.open {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(var(--accent-rgb), 0.14) !important;
  }

  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 58px 0 0;
    z-index: 1190;
    background: rgba(0, 0, 0, 0.44);
    backdrop-filter: blur(2px);
  }

  .header__mobile-panel {
    position: fixed !important;
    top: 58px !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(74vw, 272px) !important;
    max-width: 272px !important;
    height: calc(100dvh - 58px) !important;
    min-height: calc(100vh - 58px) !important;
    display: grid !important;
    align-content: start !important;
    gap: 0.65rem !important;
    padding: 0.55rem !important;
    z-index: 1199 !important;
    overflow-y: auto !important;
    border-right: 1px solid rgba(var(--accent-rgb), 0.18) !important;
    border-bottom: 0 !important;
    border-radius: 0 14px 14px 0 !important;
    background: rgba(8, 11, 17, 0.98) !important;
    box-shadow: 20px 0 44px rgba(0, 0, 0, 0.42) !important;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-104%) !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
  }

  .header__mobile-panel.active {
    display: grid !important;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) !important;
  }

  .header .nav.nav--mobile {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
    border-radius: 12px !important;
  }

  .header .nav--mobile .nav__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.34rem !important;
    padding: 0.45rem !important;
    border: 1px solid rgba(var(--accent-rgb), 0.11) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.025) !important;
  }

  .header .nav--mobile .nav__item {
    border: 0 !important;
    width: 100% !important;
  }

  .header .nav--mobile .nav__link {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 42px !important;
    justify-content: stretch !important;
    gap: 0.45rem !important;
    padding: 0.5rem 0.7rem 0.5rem 0.45rem !important;
    border-radius: 9px !important;
    font-size: 0.82rem !important;
    text-align: left;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(var(--accent-rgb), 0.08);
    box-sizing: border-box !important;
  }

  .header .nav--mobile .nav__link.active {
    background: rgba(var(--accent-rgb), 0.17);
    border-color: rgba(var(--accent-rgb), 0.28);
    color: var(--text-primary);
  }

  .header .nav--mobile .nav__link::before {
    width: 28px;
    text-align: center;
    justify-self: center;
    color: var(--text-secondary);
  }

  .header .nav--mobile .nav__link.active::before {
    color: var(--accent);
  }

  .header__mobile-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr 40px;
    gap: 0.35rem !important;
    margin-top: 0.25rem !important;
  }

  .header__mobile-languages {
    display: contents !important;
  }

  .header__mobile-lang,
  .header__mobile-theme {
    min-height: 40px !important;
    padding: 0.5rem 0.6rem !important;
    border-radius: 9px !important;
    font-size: 0.82rem !important;
  }

  .header__mobile-theme {
    width: 42px !important;
    min-width: 42px !important;
    padding: 0 !important;
    overflow: hidden;
  }

  .bots-detail {
    position: static !important;
    scroll-margin-top: 72px;
  }

  .vpn-account__key {
    grid-template-columns: 1fr !important;
  }

  .vpn-account__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
  }

  .vpn-account__stat {
    min-height: 64px !important;
    padding: 0.55rem !important;
  }

  .vpn-account__stat span {
    font-size: 0.66rem !important;
  }

  .vpn-account__stat strong {
    font-size: 0.82rem !important;
    line-height: 1.15;
  }

  .vpn-account__qr {
    width: 128px !important;
    height: 128px !important;
    grid-row: auto !important;
  }

  .vpn-account__switch-row {
    grid-template-columns: 1fr !important;
  }

  .vpn-account__switch .profile-card__btn {
    width: 100% !important;
  }

  .auth-modal {
    align-items: stretch !important;
    overflow-y: auto !important;
  }

  .auth-modal__box--quick {
    width: 100vw !important;
    height: auto !important;
    min-height: 100dvh;
    max-height: none !important;
    border-radius: 0 !important;
    grid-template-rows: minmax(190px, 32vh) auto;
    overflow: visible !important;
  }

  .auth-visual {
    display: block !important;
    min-height: 190px !important;
    height: 32vh !important;
    padding-top: 14px !important;
  }

  .auth-visual__brand {
    margin: 0 18px !important;
    font-size: 0.8rem;
  }

  .auth-visual__brand img {
    width: 28px !important;
    height: 28px !important;
  }

  .auth-visual__girl {
    object-position: center 22% !important;
    opacity: 0.9 !important;
    mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%) !important;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%) !important;
  }

  .auth-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 1.15rem 1rem 1.75rem !important;
  }

  .auth-modal__close {
    top: 14px !important;
    right: 14px !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(0, 0, 0, 0.58) !important;
  }

  .auth-modal__title {
    font-size: 1.6rem !important;
  }

  .auth-modal__subtitle {
    font-size: 0.92rem !important;
  }

  .auth-social__btn {
    min-height: 50px !important;
    padding: 0.65rem 0.75rem !important;
  }

  .auth-social__brand {
    font-size: 0.88rem !important;
  }

  .auth-social__badge {
    font-size: 0.72rem !important;
  }

  .auth-form__input {
    min-height: 48px !important;
    font-size: 16px !important;
  }

  .auth-footer {
    margin-top: 0.6rem !important;
    padding-top: 1rem !important;
  }

  .music-section {
    padding: 1.25rem 0 6rem !important;
  }

  .music-section .container {
    padding: 0 0.75rem !important;
  }

  .music-section__title {
    font-size: 1.55rem !important;
  }

  .music-section__lead {
    font-size: 0.86rem;
    max-width: 22rem;
  }

  .music-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.75rem !important;
  }

  .music-card,
  .music-main {
    min-width: 0;
    border-radius: 10px !important;
    padding: 0.75rem !important;
  }

  .music-top-item {
    grid-template-columns: 28px minmax(0, 1fr) auto !important;
    gap: 0.45rem !important;
  }

  .music-top-item__name {
    min-width: 0;
  }

  .music-playlists {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .music-playlists__btn {
    min-width: 0;
    padding: 0.52rem 0.55rem !important;
    font-size: 0.82rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .music-main__head {
    align-items: flex-start !important;
    flex-direction: column;
    gap: 0.65rem !important;
  }

  .music-main__title {
    font-size: 1.15rem !important;
  }

  .music-main__tools,
  .music-sort {
    width: 100%;
  }

  .music-sort {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .music-sort__btn {
    padding: 0.48rem 0.35rem !important;
    font-size: 0.76rem !important;
  }

  .music-row {
    grid-template-columns: 34px 42px minmax(0, 1fr) auto !important;
    gap: 0.5rem !important;
    padding: 0.55rem 0.35rem !important;
  }

  .music-row__play {
    width: 30px !important;
    height: 30px !important;
  }

  .music-row__cover {
    width: 38px !important;
    height: 38px !important;
  }

  .music-row__title,
  .music-row__artist {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .music-row__title {
    font-size: 0.88rem;
  }

  .music-row__artist {
    font-size: 0.76rem !important;
  }

  .music-row__meta,
  .music-row__duration,
  .music-row__admin-actions {
    display: none !important;
  }

  .music-row__like {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.78rem !important;
  }

  .music-player-dock {
    width: calc(100vw - 1rem) !important;
    min-width: 0 !important;
    bottom: 0.7rem !important;
    grid-template-columns: minmax(0, 1fr) 126px !important;
    gap: 0.45rem !important;
    padding: 0.58rem 0.7rem 0.65rem !important;
    border-radius: 14px !important;
    transform: translateX(-50%) translateY(120%) !important;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease, width 0.22s ease;
  }

  .music-player-dock.is-visible {
    transform: translateX(-50%) translateY(0) !important;
    opacity: 1;
    pointer-events: auto;
  }

  .music-player-dock.is-hidden {
    display: none !important;
  }

  .music-player-dock.is-collapsed {
    width: min(280px, calc(100vw - 1rem)) !important;
  }

  .music-player-dock.is-collapsed .music-dock__center,
  .music-player-dock.is-collapsed .music-dock__right,
  .music-player-dock.is-collapsed .music-dock-modes {
    display: none !important;
  }

  .music-player-dock__left {
    grid-column: 1 / -1;
    padding-right: 4rem;
  }

  .music-dock__center {
    grid-column: 1 / 2;
  }

  .music-dock__right {
    grid-column: 2 / 3;
  }

  .music-dock-btn,
  .music-dock-mode {
    width: 28px !important;
    height: 28px !important;
    flex: 0 0 28px;
  }

  .music-dock__cover {
    width: 30px !important;
    height: 30px !important;
  }

  .music-dock__title {
    font-size: 0.8rem !important;
  }

  .music-dock__artist {
    font-size: 0.68rem !important;
  }

  .music-dock__center {
    gap: 0.45rem !important;
  }

  .music-dock__right {
    justify-content: flex-start !important;
  }

  .music-player__volume-slider {
    width: 88px !important;
  }
}

@media (min-width: 768px) {
  .header__control-btn--language {
    min-width: 54px;
  }
}

/* Compact header fit after adding users, admin and online controls */
.header > .container {
  max-width: 1540px;
  padding-left: clamp(0.75rem, 1.6vw, 1.5rem);
  padding-right: clamp(0.75rem, 1.6vw, 1.5rem);
}

.header__inner {
  grid-template-columns: minmax(130px, 178px) minmax(0, 1fr) auto !important;
  gap: clamp(0.5rem, 1vw, 0.9rem) !important;
  min-height: 72px !important;
}

.header__brand {
  gap: 0.55rem !important;
  overflow: visible;
}

.header__brand-mark {
  width: 42px !important;
  height: 42px !important;
  border-radius: 13px !important;
  flex: 0 0 42px;
}

.header__logo-img {
  width: 27px !important;
  height: 27px !important;
}

.header__brand-eyebrow {
  font-size: 0.56rem !important;
  letter-spacing: 0.16em !important;
}

.header__brand-main {
  font-size: 1.18rem !important;
  letter-spacing: 0.03em !important;
}

.nav--header .nav__list {
  gap: 0.08rem !important;
  padding: 0.25rem !important;
}

.nav--header .nav__link {
  min-height: 38px;
  padding: 0.48rem 0.64rem !important;
  font-size: 0.82rem !important;
  white-space: nowrap;
}

.header__right,
.header__controls,
.header__auth {
  gap: 0.35rem !important;
  min-width: 0;
}

.header__control-btn,
.auth-login-btn,
.auth-user__trigger {
  min-height: 38px !important;
  border-radius: 12px !important;
}

.header__control-btn {
  min-width: 38px !important;
  padding: 0 0.62rem !important;
}

.theme-toggle {
  width: 38px !important;
}

.header-online {
  min-height: 38px;
  padding: 0.48rem 0.7rem !important;
  font-size: 0.76rem !important;
}

.header-balance {
  min-height: 38px;
  padding: 0.48rem 0.7rem !important;
  font-size: 0.76rem !important;
}

.auth-user__trigger {
  max-width: 136px;
  padding: 0.25rem 0.52rem 0.25rem 0.3rem !important;
  gap: 0.45rem !important;
}

.auth-user__name {
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1320px) and (min-width: 1181px) {
  .header__brand-copy {
    display: none !important;
  }

  .header__inner {
    grid-template-columns: 48px minmax(0, 1fr) auto !important;
  }
}

@media (max-width: 1180px) and (min-width: 768px) {
  .header__inner {
    grid-template-columns: 1fr auto !important;
    min-height: 66px !important;
  }

  .nav--header,
  .header__controls,
  .header__auth {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
  }

  .header__mobile-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 0.9rem;
    border: 1px solid rgba(var(--accent-rgb), 0.32);
    border-radius: 13px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
  }

  .header__mobile-login.hidden {
    display: none !important;
  }

  .header__mobile-panel.active {
    display: block;
  }
}

@media (max-width: 767px) {
  .header__inner {
    grid-template-columns: auto 1fr auto !important;
    min-height: 54px !important;
    padding: 0.38rem 0 0.38rem 48px !important;
    gap: 0.7rem !important;
  }

  .header__brand-mark {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    flex-basis: 36px;
  }

  .header__logo-img {
    width: 24px !important;
    height: 24px !important;
  }

  .header__brand-eyebrow {
    font-size: 0.48rem !important;
  }

  .header__brand-main {
    font-size: 0.82rem !important;
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
  }
}

.music-dock-collapse,
.music-dock-close {
  position: absolute;
  top: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.music-dock-collapse {
  right: 2.45rem;
}

.music-dock-close {
  right: 0.45rem;
}

@media (max-width: 767px) {
  .music-dock-collapse,
  .music-dock-close {
    display: inline-flex;
  }
}
