/* Web uygulaması kabuğu.
 *
 * Mobil uygulama oynatıcıyı ekranın ÜSTÜNE sabitliyor çünkü telefonda başka yer
 * yok. Masaüstünde doğru karşılık aynı kural değil, aynı GARANTİ: oynatıcı
 * çalarken her zaman görünür, hiçbir panel üstünü kapatmıyor ve 200 mantıksal
 * pikselin altına inmiyor. Bunu geniş ekranda SAĞ SÜTUNDA sabit bir yuva,
 * dar ekranda ise mobildeki gibi üstte yapışık bir şerit sağlıyor.
 */

/* --- Kabuk ızgarası ------------------------------------------------------ */

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) var(--dock-w, 0px);
  grid-template-areas: "nav main dock";
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--shell-max);
  margin: 0 auto;
}

/* Oynatıcı kapalıyken sağ sütun hiç yer kaplamıyor — içerik tüm genişliği alır. */
.shell[data-playing="true"] { --dock-w: 376px; }

/* --- Sol gezinme --------------------------------------------------------- */

.nav {
  grid-area: nav;
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--chrome);
  overflow-y: auto;
}
.nav__brand { padding: 4px 10px 20px; }

.nav__group { margin-top: 18px; }
.nav__label {
  padding: 0 12px 8px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--dim);
}

.nav__link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav__link:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav__link[aria-current="page"] { background: rgba(139, 61, 255, 0.18); color: var(--text); font-weight: 700; }
.nav__link svg { width: 19px; height: 19px; flex: none; }
.nav__link[aria-current="page"] svg { color: var(--magenta); }

.nav__foot { margin-top: auto; padding-top: 20px; }

/* Uygulamayı indir kartı — web'de kapalı olan her şey buraya işaret ediyor. */
.getapp {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  background: linear-gradient(160deg, rgba(139,61,255,0.16), rgba(20,20,29,0.6));
}
.getapp h4 { font-size: 13.5px; margin-bottom: 4px; }
.getapp p { font-size: 12px; color: var(--muted); line-height: 1.45; margin-bottom: 11px; }
.getapp .btn { width: 100%; }

/* --- Orta sütun ---------------------------------------------------------- */

.main { grid-area: main; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: rgba(7, 7, 12, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}
.topbar[data-scrolled="true"] { border-bottom-color: var(--line); }
.topbar__mobilebrand { display: none; }

.search { position: relative; flex: 1; max-width: 520px; }
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--dim); pointer-events: none;
}
.search input {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); font-size: 14px;
  transition: border-color 0.15s var(--ease);
}
.search input::placeholder { color: var(--dim); }
.search input:focus { outline: none; border-color: var(--magenta); }

/* Ülke seçici */
.country { position: relative; margin-left: auto; }
.country__btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--card); font-size: 13.5px; font-weight: 600;
}
.country__btn:hover { border-color: var(--line-strong); }
.country__flag { font-size: 16px; line-height: 1; }
.country__menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 288px; padding: 8px;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: 0 18px 48px rgba(0,0,0,0.55);
}
.country__menu[hidden] { display: none; }
.country__note {
  padding: 6px 10px 10px; font-size: 12px; line-height: 1.45; color: var(--muted);
  border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.country__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; text-align: left;
}
.country__item:hover:not(:disabled) { background: rgba(255,255,255,0.05); }
.country__item[aria-current="true"] { color: var(--magenta); }
.country__item:disabled { cursor: default; color: var(--dim); }
.country__item .lock { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--dim); }

.content { padding: 8px 28px 64px; }

/* --- Bölüm başlıkları ---------------------------------------------------- */

.section { margin-bottom: 36px; }
.section__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section__icon {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: var(--r-sm);
}
.section__icon svg { width: 18px; height: 18px; }
.section__title { font-size: 19px; }
.section__sub { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.section__all {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  padding: 7px 10px; border-radius: var(--r-sm);
}
.section__all:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.page__head { margin-bottom: 22px; }
.page__title { font-size: 26px; }
.page__sub { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* --- Yatay vitrin -------------------------------------------------------- */

.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 178px;
  gap: 14px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 0 28px 8px; margin: 0 -28px;

  /* Yapışma alanı kabın padding'ini KENDİLİĞİNDEN bilmiyor: scroll-padding
     olmadan tarayıcı ilk kartı kabın kenarına hizalamak için tam padding kadar
     (28px) kaydırıyor ve kartlar sol gezinmeye dayanıyordu — başlıklar 28px
     içeride dururken vitrin kenara yapışık kalıyordu.
     Negatif margin ile taşan bir kapta bu şart. */
  scroll-padding-inline: 28px;
}
.rail > * { scroll-snap-align: start; }

/* --- Şarkı kartı (vitrin) ------------------------------------------------ */

.card { text-align: left; width: 100%; }
.card__art {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md);
  overflow: hidden; background: var(--card); border: 1px solid var(--line);
}
.card__art img { width: 100%; height: 100%; object-fit: cover; }
.card__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(7,7,12,0.55); opacity: 0;
  transition: opacity 0.18s var(--ease);
}
.card:hover .card__play, .card:focus-visible .card__play { opacity: 1; }
.card__play svg { width: 38px; height: 38px; color: #fff; filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5)); }
.card__rank {
  position: absolute; left: 8px; top: 8px;
  min-width: 24px; height: 24px; padding: 0 7px;
  display: grid; place-items: center; border-radius: 8px;
  background: rgba(7,7,12,0.82); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 800; color: var(--text);
}
.card__badge { position: absolute; right: 8px; top: 8px; }
.card__title {
  margin-top: 9px; font-size: 13.5px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card__artist {
  margin-top: 3px; font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- Şarkı satırı (dikey liste) ------------------------------------------ */

.rows { display: flex; flex-direction: column; }

.row {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-md); text-align: left;
  transition: background 0.14s var(--ease);
}
.row:hover { background: rgba(255,255,255,0.045); }
.row[data-active="true"] { background: rgba(139,61,255,0.16); }

.row__rank {
  width: 30px; flex: none; text-align: center;
  font-size: 13.5px; font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums;
}
.row__medal {
  display: grid; place-items: center; width: 24px; height: 24px; margin: 0 auto;
  border-radius: 7px; color: #14141d; font-size: 12px; font-weight: 900;
}
.row__art {
  width: 62px; aspect-ratio: 16 / 9; flex: none; border-radius: 8px;
  overflow: hidden; background: var(--card); position: relative;
}
.row__art img { width: 100%; height: 100%; object-fit: cover; }
.row__eq { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7,7,12,0.6); }

.row__text { min-width: 0; flex: 1; }
.row__title {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row[data-active="true"] .row__title { color: var(--magenta); }
.row__meta {
  margin-top: 2px; font-size: 12.5px; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
  overflow: hidden; white-space: nowrap;
}
.row__actions { display: flex; align-items: center; gap: 2px; flex: none; }
.row__btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  color: var(--muted); opacity: 0;
  transition: opacity 0.14s var(--ease), background 0.14s var(--ease);
}
.row:hover .row__btn, .row:focus-within .row__btn { opacity: 1; }
.row__btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.row__btn svg { width: 17px; height: 17px; }

/* Rozetler */
.badge-move { background: rgba(53,208,127,0.16); color: var(--success); }
.badge-new { background: rgba(255,138,43,0.18); color: var(--ember); }
.badge-fresh { background: rgba(34,211,238,0.15); color: var(--cyan); }
.badge-peak { background: rgba(255,255,255,0.07); color: var(--muted); }

/* --- Sağ oynatıcı yuvası -------------------------------------------------- */

.dock {
  grid-area: dock;
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--chrome);
  overflow: hidden;
}
.shell[data-playing="false"] .dock { display: none; }

/* Gömülü oynatıcı kuralları burada yaşıyor:
   - #player hiçbir zaman gizlenmiyor / saydamlaştırılmıyor
   - min-height 200px: çizim alanı 200 mantıksal pikselin altına inmiyor
   - üstüne hiçbir panel binmiyor (kuyruk ALTINDA akıyor) */
.dock__player {
  flex: none; background: #000;
  min-height: 200px;
  aspect-ratio: 16 / 9;
  position: relative;
}
.dock__player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.dock__now { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.dock__title { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.dock__artist { font-size: 13px; color: var(--muted); margin-top: 3px; }
.dock__controls { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.dock__ctl {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  color: var(--muted);
}
.dock__ctl:hover:not(:disabled) { background: rgba(255,255,255,0.07); color: var(--text); }
.dock__ctl:disabled { opacity: 0.35; cursor: default; }
.dock__ctl svg { width: 18px; height: 18px; }
.dock__ctl--detail { margin-left: auto; width: auto; padding: 0 12px; gap: 6px; font-size: 13px; font-weight: 600; }

.dock__queue { flex: 1; overflow-y: auto; padding: 12px 10px 20px; min-height: 0; }
.dock__queuehead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 10px; font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim);
}
.dock__queuehead button { font-size: 11.5px; font-weight: 700; color: var(--dim); text-transform: none; letter-spacing: 0; }
.dock__queuehead button:hover { color: var(--magenta); }

.qrow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 6px; border-radius: var(--r-sm); text-align: left;
}
.qrow:hover { background: rgba(255,255,255,0.05); }
.qrow[data-active="true"] .qrow__title { color: var(--magenta); }
.qrow__art { width: 44px; aspect-ratio: 16/9; flex: none; border-radius: 6px; overflow: hidden; background: var(--card); }
.qrow__art img { width: 100%; height: 100%; object-fit: cover; }
.qrow__text { min-width: 0; flex: 1; }
.qrow__title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow__artist { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Otomatik geçiş anahtarı */
.toggle { display: flex; align-items: center; gap: 9px; padding: 10px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 38px; height: 22px; flex: none; border-radius: 99px;
  background: #22222d; border: 1px solid var(--line); position: relative;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.toggle__track::after {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px; border-radius: 99px; background: var(--dim);
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}
.toggle input:checked + .toggle__track { background: var(--magenta); border-color: var(--magenta); }
.toggle input:checked + .toggle__track::after { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--magenta); outline-offset: 2px; }

/* --- Şarkı detayı -------------------------------------------------------- */

.detail__head { display: flex; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.detail__art {
  width: 288px; flex: none; aspect-ratio: 16/9; border-radius: var(--r-lg);
  overflow: hidden; border: 1px solid var(--line); background: var(--card);
}
.detail__art img { width: 100%; height: 100%; object-fit: cover; }
.detail__info { flex: 1; min-width: 260px; display: flex; flex-direction: column; }
.detail__title { font-size: 27px; line-height: 1.12; }
.detail__artist { font-size: 16px; color: var(--muted); margin-top: 8px; font-weight: 600; }
.detail__facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.detail__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(20,20,29,0.55); }
.stat__k { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.stat__v { font-size: 21px; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; }

.panel {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: rgba(20,20,29,0.55); padding: 18px 20px; margin-bottom: 20px;
}
.panel__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel__title { font-size: 15.5px; }
.panel__note { font-size: 12.5px; color: var(--muted); }

.chart { width: 100%; height: auto; overflow: visible; display: block; }
.chart text { font-size: 10px; fill: var(--dim); font-family: var(--font); }

/* --- Kilitli özellik yönlendirmesi --------------------------------------- */

.locked {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-top: 4px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-md);
  background: rgba(139,61,255,0.06);
}

/* Ana sayfadaki ülke kilidi notu ile hemen altındaki ilk trend bölümü arasında
   nefes payı.
   Boşluk `.locked`'ın kendisine değil YUVASINA veriliyor: not başka yerlerde
   (şarkı detayı, bölüm listesi) bir bloğun SONUNDA duruyor ve orada alt boşluk
   fazladan bir aralık açardı. `:not(:empty)` sayesinde kilitsiz ülkede yuva
   hiç yer kaplamıyor. */
[data-slot="country-notice"]:not(:empty) { display: block; margin-bottom: 28px; }
.locked > svg { width: 20px; height: 20px; flex: none; color: var(--violet); }
.locked__text { flex: 1; min-width: 0; }
.locked__text strong { display: block; font-size: 13.5px; }
.locked__text span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* --- Durum görünümleri --------------------------------------------------- */

.state { padding: 56px 20px; text-align: center; }
.state > svg { width: 34px; height: 34px; margin: 0 auto 14px; color: var(--dim); }
.state h3 { font-size: 16px; margin-bottom: 6px; }
.state p { font-size: 13.5px; color: var(--muted); max-width: 380px; margin: 0 auto; line-height: 1.55; }
.state .btn { margin-top: 18px; }

.skel {
  background: linear-gradient(90deg, #14141d 25%, #1e1e2a 50%, #14141d 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-card { aspect-ratio: 16/9; border-radius: var(--r-md); }
.skel-line { height: 11px; margin-top: 9px; }
.skel-line--short { width: 62%; }

/* Çalan şarkının denge çubukları */
.eq { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; background: var(--magenta); border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(1) { height: 40%; animation-delay: -0.2s; }
.eq i:nth-child(2) { height: 100%; animation-delay: -0.5s; }
.eq i:nth-child(3) { height: 65%; animation-delay: -0.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }
.eq[data-paused="true"] i { animation-play-state: paused; }

.fade-in { animation: fadeIn 0.34s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* --- Duyuru şeridi ------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  z-index: 90; padding: 12px 18px; border-radius: var(--r-md);
  background: #23232e; border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast[data-show="true"] { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Uyarlanabilir düzen ------------------------------------------------- */

/* Orta genişlik: gezinme ikon rayına iner, yuva biraz daralır. */
@media (max-width: 1279px) {
  .shell { grid-template-columns: 72px minmax(0, 1fr) var(--dock-w, 0px); }
  .shell[data-playing="true"] { --dock-w: 332px; }
  .nav { padding: 20px 10px; align-items: center; }
  .nav__brand { padding: 4px 0 20px; }
  .nav__brand span, .nav__label, .nav__link span, .nav__foot { display: none; }
  .nav__link { justify-content: center; padding: 11px; }
}

/* Dar ekran: mobil uygulamanın düzeni — oynatıcı ÜSTTE yapışık, gezinme yatay.
   Gömülü oynatıcı garantileri değişmiyor, yalnızca yeri değişiyor. */
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "dock" "nav" "main"; }
  .shell[data-playing="true"] { --dock-w: auto; }

  .dock {
    position: sticky; top: 0; z-index: 30;
    height: auto; border-left: 0; border-bottom: 1px solid var(--line);
  }
  .dock__player { max-width: 356px; width: 100%; margin: 0 auto; }
  .dock__queue { display: none; }
  .dock__now { border-bottom: 0; }

  .nav {
    position: static; height: auto; flex-direction: row; gap: 4px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto; align-items: center;
  }
  .nav__brand, .nav__label, .nav__foot { display: none; }
  .nav__group { margin-top: 0; display: contents; }
  .nav__link { padding: 8px 12px; white-space: nowrap; justify-content: flex-start; }
  .nav__link span { display: inline; font-size: 13px; }

  .topbar { padding: 12px 16px; }
  .topbar__mobilebrand { display: block; }
  .content { padding: 4px 16px 56px; }
  /* Dar ekranda kenar boşluğu 16px'e iniyor; yapışma alanı da onu izlemeli. */
  .rail {
    margin: 0 -16px; padding-left: 16px; padding-right: 16px;
    grid-auto-columns: 152px; scroll-padding-inline: 16px;
  }
  /* Telefonda kapak neredeyse tam genişlik olsun, tablette ekranı ele geçirmesin:
     800px'lik bir yüzeyde 16:9 tam genişlik kapak 450px yükseklik demek ve
     sayfanın geri kalanını katlamanın altına itiyordu. */
  .detail__art { width: 100%; max-width: 380px; }
  .detail__title { font-size: 22px; }
}

@media (max-width: 560px) {
  .country__btn > span:not(.country__flag) { display: none; }
  .country__menu { width: min(288px, calc(100vw - 32px)); }
  .rail { grid-auto-columns: 138px; }
  .row__art { width: 54px; }

  /* Kilit notunda düğme satır içinde kalınca metne ~150px kalıyor ve açıklama
     beş satıra iniyor. Telefonda düğme alta, tam genişliğe geçiyor. */
  .locked { flex-wrap: wrap; }
  .locked .btn { width: 100%; }
  /* Dokunmatikte hover yok — eylem düğmeleri hover'a bağlı kalamaz. */
  .row__btn { opacity: 1; }
}
