/* ===== ВЫДВИЖНОЕ МЕНЮ ===== */
/* (базовые стили - работают на всех экранах) */

/* Кнопка бургер — всегда видна */
.menu-toggle {
  display: block;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 999;
  background: rgba(255, 204, 0, 0.3);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 204, 0, 0.5);
  color: black;
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: background 0.2s, border 0.2s, box-shadow 0.2s;
}

.menu-toggle:hover {
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 10px rgba(255, 204, 0, 0.5);
}

/* Сайдбар скрыт за левым краем */
.sidebar {
  position: fixed;
  left: -260px;
  top: 0;
  bottom: 0;
  width: 260px;
  transition: left 0.3s ease;
  z-index: 1001;
  background: var(--bg-sidebar);
  padding: 25px;
  border-right: 1px solid #222;
  box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

/* Открытое состояние */
.sidebar.open {
  left: 0;
}

/* Затемнение фона (по умолчанию скрыто) */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

.overlay.active {
  display: block;
}

/* ===== ПК: ВСЁ СЖИМАЕТСЯ ===== */
@media (min-width: 769px) {
  .main-content {
    transition: margin-left 0.3s ease, width 0.3s ease;
    margin-left: 0;
    width: 100%;
  }

  .player-bar {
    transition: left 0.3s ease, width 0.3s ease;
    left: 0;
    width: 100%;
  }

  .sidebar.open ~ .main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
  }

  .sidebar.open ~ .player-bar {
    left: 260px;
    width: calc(100% - 260px);
  }
}

/* ===== МОБИЛКИ: ПОЛНАЯ ПЕРЕРАБОТКА ===== */
@media (max-width: 768px) {
  
  /* ----- БАЗОВЫЕ ОТСТУПЫ ----- */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 70px 16px calc(var(--player-height) + 16px) !important;
  }

  body {
    overflow-x: hidden;
  }

  /* ----- КНОПКА БУРГЕР ----- */
  .menu-toggle {
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 204, 0, 0.95);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1002;
  }

  /* ----- САЙДБАР ----- */
  .sidebar {
    width: 280px;
    left: -280px;
    padding: 20px 16px;
    background: #0a0a0a;
    z-index: 1003;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .logo {
    font-size: 20px;
    margin-bottom: 30px;
    padding-left: 8px;
  }

  .nav-item {
    padding: 16px 16px;
    font-size: 15px;
    margin-bottom: 4px;
    border-radius: 12px;
  }

  .sidebar-user {
    padding: 16px 8px;
    margin-top: auto;
  }

  .user-name {
    font-size: 14px;
  }

  .overlay {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(3px);
    z-index: 1002;
  }

  /* ----- ПОИСКОВЫЙ ОВЕРЛЕЙ ----- */
  .search-header {
    padding: 12px 16px !important;
    height: 55px;
  }

  .search-header h2 {
    font-size: 16px;
  }

  .mobile-search-wrapper {
    padding: 8px 16px !important;
    top: 55px;
    height: 60px;
  }

  .mobile-search-input {
    font-size: 15px;
    padding: 10px 14px;
  }

  #searchResults {
    padding: 16px 16px 80px 16px !important;
  }

  /* ----- ГЛАВНАЯ СТРАНИЦА ----- */
  .hero-mix {
    height: 140px;
    margin-bottom: 24px;
    border-radius: 20px;
  }

  .hero-mix h1 {
    font-size: 28px !important;
    letter-spacing: 2px;
  }

  .section-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 32px;
  }

  .mini-title {
    font-size: 14px;
    margin: 0 0 12px 0;
    padding-left: 4px;
    letter-spacing: 1px;
  }

  /* ----- КАРТОЧКИ АРТИСТОВ (горизонтальный скролл) ----- */
  .artist-scroll {
    gap: 12px;
    padding: 4px 0 16px;
    margin: 0 -4px;
    padding-left: 4px;
  }

  .artist-card {
    min-width: 100px;
    width: 100px;
    padding: 10px 6px;
    border-radius: 16px;
    background: var(--bg-card);
  }

  .artist-card .artist-img {
    width: 70px !important;
    height: 70px !important;
    margin: 0 auto 8px;
  }

  .artist-card b {
    font-size: 12px;
    max-width: 90px;
    line-height: 1.3;
  }

  /* ----- ТАБЛИЦЫ НА ГЛАВНОЙ ----- */
  #historyList, #starredList, #dislikedList {
    width: 100%;
    font-size: 13px;
  }

  #historyList td, #starredList td, #dislikedList td {
    padding: 12px 6px;
  }

  .td-img {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
  }

  .track-meta-content {
    gap: 8px;
  }

  .plays-inline {
    font-size: 11px;
  }

  .track-duration {
    font-size: 11px;
    min-width: 35px;
  }

  .track-title-cell {
    max-width: 160px;
  }

  .track-name-wrapper b {
    font-size: 13px;
  }

  .track-artist-mini {
    font-size: 10px;
  }

  /* ----- СТРАНИЦА АРТИСТА ----- */
  .artist-header {
    position: relative;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 16px 20px !important;
    margin: -20px -16px 20px -16px !important;
    background: linear-gradient(180deg, rgba(255, 204, 0, 0.15) 0%, transparent 100%) !important;
    border-radius: 0 0 30px 30px;
    min-height: 220px;
  }

  /* Аватар артиста на фоне */
  .artist-big-img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    opacity: 0.2;
    z-index: 0;
    background-size: cover !important;
    background-position: center !important;
  }

  /* Контент поверх фона */
  .artist-header-info {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 0 16px;
  }

  .artist-main-row {
    flex-direction: column;
    align-items: center !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
  }

  .artist-main-row h1 {
    font-size: 36px !important;
    text-align: center;
    word-break: break-word;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    margin: 0 !important;
  }

  .header-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px !important;
    width: 100%;
  }

  .play-all-btn, .shuffle-btn, #artistLikeBtn {
    padding: 12px 20px !important;
    font-size: 14px !important;
    min-width: 120px;
    border-radius: 30px !important;
    font-weight: 700 !important;
  }

  .play-all-btn {
    background: var(--accent);
    color: #000;
  }

  .shuffle-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
  }

  #artistLikeBtn {
    background: rgba(255,255,255,0.1);
    border: 1px solid white;
    color: white;
  }

  .artist-stats {
    justify-content: center;
    gap: 24px !important;
    flex-wrap: wrap;
    margin-top: 16px;
  }

  .stat-item {
    min-width: 70px;
  }

  .stat-item b {
    font-size: 18px !important;
  }

  .stat-item small {
    font-size: 10px !important;
    letter-spacing: 1px;
  }

  /* Альбомы артиста */
  .artist-body-content {
    padding: 0 0 24px 0 !important;
  }

  .section-title {
    font-size: 22px;
    margin: 24px 0 16px 0 !important;
    padding-left: 4px;
  }

  .horizontal-scroll-container {
    gap: 12px;
    padding: 4px 0 16px;
    margin: 0 -4px;
    padding-left: 4px;
  }

  .album-card {
    min-width: 140px !important;
    width: 140px !important;
    padding: 10px !important;
    border-radius: 16px;
  }

  .album-cover {
    width: 140px !important;
    height: 140px !important;
    margin-bottom: 10px !important;
    border-radius: 12px;
  }

  .album-info b {
    font-size: 13px !important;
    min-height: 36px;
    line-height: 1.3;
  }

  .album-info small {
    font-size: 11px !important;
  }

  /* Таблица треков артиста */
  .artist-tracks-table {
    width: 100%;
    font-size: 13px;
  }

  .artist-tracks-table td {
    padding: 12px 6px;
  }

  .track-index {
    font-size: 13px;
    width: 30px;
  }

  .track-title-cell {
    max-width: 180px;
  }

  .track-name-wrapper b {
    font-size: 13px;
  }

  /* АКТИВНЫЙ ТРЕК - ЖЕЛТЫЙ (был красный) */
  tr.track-active {
    background: rgba(255, 204, 0, 0.1) !important;
    border-left: 3px solid var(--accent) !important;
  }

  tr.track-active b,
  tr.track-active .track-index {
    color: var(--accent) !important;
  }

  /* ----- СТРАНИЦА АЛЬБОМА ----- */
  .album-page-header {
    position: relative;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 30px 16px 20px !important;
    margin: -20px -16px 20px -16px !important;
    background: linear-gradient(180deg, #222 0%, #0a0a0a 100%);
    border-radius: 0 0 30px 30px;
  }

  .album-big-img {
    width: 180px !important;
    height: 180px !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  }

  .album-info-main {
    width: 100%;
    text-align: center;
  }

  .album-info-main button {
    font-size: 13px;
    margin-bottom: 12px;
  }

  .album-info-main h1 {
    font-size: 28px !important;
    word-break: break-word;
    line-height: 1.2;
    margin: 8px 0 !important;
  }

  .album-info-main p {
    font-size: 13px !important;
    margin: 12px 0 !important;
    opacity: 0.8;
  }

  /* ----- СТРАНИЦЫ ИСТОРИИ/ИЗБРАННОГО ----- */
  #history, #starred, #disliked {
    padding: 0;
  }

  #history h1, #starred h1, #disliked h1 {
    font-size: 26px;
    margin: 16px 0 20px 0;
    padding-left: 4px;
  }

  /* ----- ПЛЕЕР ----- */
  .player-bar {
    padding: 0 12px !important;
    height: 90px !important;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(10px);
  }

  .time-info-wrapper {
    height: 24px;
    margin-top: 6px;
    gap: 10px;
  }

  #currentTime, #timeLeft {
    font-size: 11px;
    min-width: 35px;
    font-weight: 500;
  }

  .controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    width: 100%;
  }

  .track-info {
    gap: 8px;
    min-width: 130px;
    max-width: 140px;
  }

  .vinyl-disc {
    width: 44px !important;
    height: 44px !important;
  }

  .vinyl-disc::before {
    width: 14px !important;
    height: 14px !important;
  }

  .track-text {
    max-width: 85px;
  }

  .track-text b {
    font-size: 12px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .track-text small {
    font-size: 10px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .btn-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
  }

  .icon-btn {
    font-size: 18px !important;
    padding: 6px;
  }

  .play-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
    background: var(--accent);
    color: #000;
  }

  .vol-zone {
    width: 80px;
    gap: 6px;
  }

  #volWrapper {
    width: 50px !important;
  }

  #volVal {
    font-size: 11px;
    min-width: 25px;
    font-weight: 500;
  }

  /* ----- УЛУЧШЕНИЯ ДЛЯ МАЛЕНЬКИХ ЭКРАНОВ (ДО 380px) ----- */
  @media (max-width: 380px) {
    .main-content {
      padding-left: 12px !important;
      padding-right: 12px !important;
    }

    .artist-card {
      min-width: 90px;
      width: 90px;
    }

    .artist-card .artist-img {
      width: 60px !important;
      height: 60px !important;
    }

    .album-card {
      min-width: 120px;
      width: 120px;
    }

    .album-cover {
      width: 120px !important;
      height: 120px !important;
    }

    .td-img {
      width: 32px !important;
      height: 32px !important;
      min-width: 32px;
    }

    .track-title-cell {
      max-width: 130px;
    }

    .btn-group {
      gap: 10px;
    }

    .icon-btn {
      font-size: 16px !important;
    }

    .play-btn {
      width: 36px !important;
      height: 36px !important;
    }

    .track-info {
      min-width: 110px;
      max-width: 120px;
    }

    .vinyl-disc {
      width: 40px !important;
      height: 40px !important;
    }
  }

  /* ----- ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ ----- */
  @media (orientation: landscape) and (max-width: 768px) {
    .main-content {
      padding-top: 50px;
    }

    .artist-header {
      min-height: 180px;
      padding: 20px 16px !important;
    }

    .artist-main-row h1 {
      font-size: 30px !important;
    }

    .header-buttons {
      gap: 8px;
    }

    .play-all-btn, .shuffle-btn, #artistLikeBtn {
      padding: 8px 16px !important;
      font-size: 12px !important;
      min-width: 100px;
    }

    .artist-stats {
      gap: 16px;
    }

    .player-bar {
      height: 80px !important;
    }

    .btn-group {
      gap: 16px;
    }
  }

  /* ----- СКРЫВАЕМ НЕНУЖНОЕ НА МОБИЛКАХ ----- */
  .desktop-only {
    display: none;
  }

  
}

/* ===== БЛОК ПОЛЬЗОВАТЕЛЯ ===== */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.user-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  word-break: break-word;
}

.sidebar-user {
  margin-top: auto;
  padding: 20px 0 10px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user .user-avatar {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.sidebar-user .user-name {
  font-size: 14px;
  font-weight: 500;
}

/* ===== АВАТАРКА С ИКОНКОЙ ===== */
.avatar-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
  cursor: pointer;
}

.avatar-wrapper .user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  text-transform: uppercase;
  background-size: cover;
  background-position: center;
  transition: filter 0.2s;
}

.avatar-upload-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #000;
  border: 2px solid var(--bg-sidebar);
  opacity: 0.9;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.avatar-wrapper:hover .user-avatar {
  filter: brightness(0.8);
}

.avatar-wrapper:hover .avatar-upload-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* ===== ПОИСКОВЫЙ ОВЕРЛЕЙ ===== */
.search-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: var(--bg-main);
  z-index: 9999 !important;
  overflow-y: auto;
  padding: 0;
  margin: 0 !important;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-sizing: border-box;
}

.search-overlay.active {
  opacity: 1;
  display: block !important;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: var(--bg-main);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  width: 100%;
  box-sizing: border-box;
  height: 61px;
  margin: 0;
}

.search-header h2 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
  color: var(--accent);
}

.close-search {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: 0.3s;
  flex-shrink: 0;
}

.close-search:hover {
  background: var(--red);
  transform: rotate(90deg);
}

.mobile-search-wrapper {
  position: sticky;
  top: 61px;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--bg-main);
  padding: 10px 25px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin: 0;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  height: 71px;
}

.mobile-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 15px;
  border-radius: 10px;
  color: white;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}

.mobile-search-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.15);
}

#searchResults {
  padding: 20px 25px 80px 25px !important;
  max-width: 1200px;
  margin: 0 auto !important;
  width: 100% !important;
  box-sizing: border-box !important;
  min-height: calc(100vh - 132px);
}

.search-subtitle {
  color: var(--accent);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 25px 0 12px;
  width: 100%;
}

.search-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 25px 0 12px;
  width: 100%;
}

#searchResults .artist-card {
  min-width: 100px;
  width: 100px;
  padding: 6px;
  flex-shrink: 0;
}

#searchResults .artist-img {
  width: 70px;
  height: 70px;
  margin-bottom: 6px;
}

#searchResults .artist-card b {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  margin: 0 auto;
}

#searchResults .album-card {
  min-width: 110px;
  width: 110px;
  padding: 6px;
  flex-shrink: 0;
}

#searchResults .album-cover {
  width: 110px;
  height: 110px;
  margin-bottom: 6px;
}

#searchResults .album-card b {
  font-size: 11px;
  min-height: 26px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-bottom: 2px;
}

#searchResults .album-card small {
  font-size: 9px;
  color: var(--text-dim);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horizontal-scroll-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 5px 0 15px 0;
  margin: 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.horizontal-scroll-container::-webkit-scrollbar {
  height: 4px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.search-no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  width: 100%;
}

.search-no-results h3 {
  font-size: 18px;
  margin: 15px 0 8px;
  color: #fff;
}

.search-no-results p {
  font-size: 13px;
  opacity: 0.7;
}

/* АКТИВНЫЙ ТРЕК В ПОИСКЕ - ЖЕЛТЫЙ */
#searchResults .track-active {
  background: rgba(255, 204, 0, 0.15) !important;
  border-left: 3px solid var(--accent) !important;
}

#searchResults .track-active b,
#searchResults .track-active .track-index {
  color: var(--accent) !important;
}

body.search-fullscreen .menu-toggle {
  display: none !important;
}
