/* ==============================
   Track Row List Component
   Modern list-style track output
   ============================== */

.mzk-track-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ---- Row ---- */
.mzk-track-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px 44px 48px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 72px;
  padding: 0 12px;
  border-radius: 12px;
  transition: background .2s ease;
}

.mzk-track-row:hover {
  background: var(--color-bg-muted, #f7f9fc);
}


/* ---- Number ---- */
.mzk-track-row__number {
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  color: var(--color-text-tertiary, #9ca3af);
  font-variant-numeric: tabular-nums;
}

/* ---- Play ---- */
.mzk-track-row__play {
  position: relative;
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}

.mzk-track-row__play:hover {
  background: var(--color-primary);
  color: var(--color-on-primary);
  transform: scale(1.05);
}

.mzk-track-row__play:active {
  transform: scale(.93);
}

.mzk-track-row__play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  margin-left: 2px;
}

/* Playing state */
.mzk-track-row.is-playing .mzk-track-row__play {
  background: #ef477b;
  color: #fff;
  border-color: rgba(255, 255, 255, .3);
  box-shadow: 0 4px 12px rgba(239, 71, 123, .28);
}

.mzk-track-row.is-playing .mzk-track-row__play svg {
  display: none;
}

.mzk-track-row.is-playing .mzk-track-row__play::before,
.mzk-track-row.is-playing .mzk-track-row__play::after {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.mzk-track-row.is-playing .mzk-track-row__play::before {
  margin-right: 6px;
}

.mzk-track-row.is-playing .mzk-track-row__play:hover {
  background: #d43d6a;
}

/* Active (highlighted) row */
.mzk-track-row.is-active {
  background: var(--color-active-nav-bg, #edebfc);
}

.mzk-track-row.is-active .mzk-track-row__title {
  color: var(--color-primary, #5b21ed);
}

.mzk-track-row.is-active .mzk-track-row__number {
  color: var(--color-primary, #5b21ed);
}

/* ---- Cover ---- */
.mzk-track-row__cover {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(145deg, #f1edff, #e8e1ff);
  color: var(--color-primary, #5b21ed);
  text-decoration: none;
}

.mzk-track-row__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mzk-track-row__cover svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  opacity: .7;
}

/* ---- Info ---- */
.mzk-track-row__info {
  min-width: 0;
  margin: 0 8px;
}

.mzk-track-row__title {
  display: block;
  overflow: hidden;
  color: var(--color-text-primary, #1e2638);
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.mzk-track-row__title:hover {
  color: var(--color-primary, #5b21ed);
}

.mzk-track-row__artist {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--color-text-secondary, #8b90a0);
  font-size: 14px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.mzk-track-row__artist:hover {
  color: var(--color-primary, #5b21ed);
}

/* ---- Duration ---- */
.mzk-track-row__duration {
  min-width: 40px;
  text-align: right;
  color: var(--color-text-tertiary, #9ca3af);
  font-size: 14px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

/* ---- Actions ---- */
.mzk-track-row__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
}

.mzk-track-row__action {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-tertiary, #9ca3af);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.mzk-track-row__action:hover {
  background: var(--color-bg-muted, #f0f1f5);
  color: var(--color-primary, #5b21ed);
}

.mzk-track-row__action:active {
  transform: scale(.92);
}

.mzk-track-row__action.is-active {
  color: var(--color-primary, #5b21ed);
  background: var(--color-active-nav-bg, #edebfc);
}

.mzk-track-row__action[data-favorite-control].is-active {
  color: #ef4444;
  background: #fef2f2;
}

.mzk-track-row__action[data-favorite-control].is-active:hover,
.mzk-track-row__action[data-favorite-control].is-active:focus-visible {
  color: #dc2626;
  background: #fee2e2;
}

.mzk-track-row__action[data-favorite-control]:not(.is-active) svg path {
  fill: none;
}

.mzk-track-row__action[data-favorite-control].is-active svg path {
  fill: currentColor;
}

.mzk-track-row__action.is-remove {
  color: #e11d48;
  background: rgba(225, 29, 72, .08);
}

.mzk-track-row__action.is-remove:hover {
  background: rgba(225, 29, 72, .15);
}

.mzk-track-row__action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mzk-track-row__action svg.mzk-heart-fill {
  fill: currentColor;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .mzk-track-row {
    padding: 0 10px;
  }

  .mzk-track-row__title {
    font-size: 15px;
  }
}

@media (max-width: 600px) {
  .mzk-track-row {
    grid-template-columns: 44px 48px minmax(0, 1fr) auto;
    gap: 6px;
    height: 68px;
    padding: 2px 4px;
  }

  .mzk-track-row__number,
  .mzk-track-row__duration {
    display: none;
  }

  .mzk-track-row__play {
    width: 44px;
    height: 44px;
  }

  .mzk-track-row__cover {
    width: 44px;
    height: 44px;
  }

  .mzk-track-row__info {
    margin: 0 4px;
  }

  .mzk-track-row__title {
    font-size: 15px;
    line-height: 20px;
  }

  .mzk-track-row__artist {
    font-size: 13px;
    line-height: 18px;
  }

  .mzk-track-row__actions {
    gap: 0;
    margin-left: 0;
  }

  .mzk-track-row__action {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 359px) {
  .mzk-track-row {
    grid-template-columns: 40px 42px minmax(0, 1fr) auto;
    gap: 4px;
    height: 64px;
    padding: 2px 0;
  }

  .mzk-track-row__play {
    width: 40px;
    height: 40px;
  }

  .mzk-track-row__cover {
    width: 42px;
    height: 42px;
  }

  .mzk-track-row__info {
    margin: 0 2px;
  }

  .mzk-track-row__action {
    width: 36px;
    height: 36px;
  }

  .mzk-track-row__action svg {
    width: 18px;
    height: 18px;
  }
}

/* ---- Skeleton Loading ---- */
.mzk-track-row.is-skeleton {
  pointer-events: none;
}

.mzk-track-row.is-skeleton .mzk-track-row__play,
.mzk-track-row.is-skeleton .mzk-track-row__cover,
.mzk-track-row.is-skeleton .mzk-track-row__title,
.mzk-track-row.is-skeleton .mzk-track-row__artist,
.mzk-track-row.is-skeleton .mzk-track-row__duration,
.mzk-track-row.is-skeleton .mzk-track-row__action {
  background: var(--color-bg-muted, #f0f1f5);
  border-radius: 6px;
  animation: mzk-skeleton-pulse 1.5s ease-in-out infinite;
}

.mzk-track-row.is-skeleton .mzk-track-row__title {
  height: 18px;
  width: 60%;
  display: block;
}

.mzk-track-row.is-skeleton .mzk-track-row__artist {
  height: 14px;
  width: 40%;
  display: block;
  margin-top: 8px;
}

.mzk-track-row.is-skeleton .mzk-track-row__play {
  border-radius: 50%;
}

.mzk-track-row.is-skeleton .mzk-track-row__cover {
  border-radius: 10px;
}

.mzk-track-row.is-skeleton .mzk-track-row__duration {
  width: 40px;
  height: 14px;
  display: block;
}

.mzk-track-row.is-skeleton .mzk-track-row__action {
  width: 44px;
  height: 44px;
  display: block;
  border-radius: 50%;
}

@keyframes mzk-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .mzk-track-row,
  .mzk-track-row__play,
  .mzk-track-row__action {
    transition: none;
  }

  .mzk-track-row.is-skeleton .mzk-track-row__play,
  .mzk-track-row.is-skeleton .mzk-track-row__cover,
  .mzk-track-row.is-skeleton .mzk-track-row__title,
  .mzk-track-row.is-skeleton .mzk-track-row__artist,
  .mzk-track-row.is-skeleton .mzk-track-row__duration,
  .mzk-track-row.is-skeleton .mzk-track-row__action {
    animation: none;
  }
}

/* ---- Touch refinement ---- */
@media (hover: none) {
  .mzk-track-row__action {
    min-width: 44px;
    min-height: 44px;
  }
}
