/* ==============================
   My Playlists Page
   Modern music app-style layout
   ============================== */

:root {
  --playlists-primary: #ffa200;
  --playlists-text: #f4f7fa;
  --playlists-muted: #8fa0b4;
  --playlists-border: rgba(255,255,255,.075);
  --playlists-radius: 16px;
  --playlists-bg: #0d1926;
}

/* ---- Container ---- */
.mzk-playlists-page {
  min-width: 0;
  padding: 0 24px 40px;
  color: var(--playlists-text);
}

.mzk-playlists-content {
  margin-top: 20px;
}

/* ---- Header ---- */
.mzk-playlists-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
}

.mzk-playlists-header__text h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 26px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--playlists-text);
}

.mzk-playlists-header__text p {
  margin: 6px 0 0;
  max-width: 520px;
  color: var(--playlists-muted);
  font-size: 16px;
  line-height: 24px;
}

/* ---- Create Button ---- */
.mzk-playlists-create-btn {
  height: 44px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  background: var(--playlists-primary);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, transform .2s ease;
}

.mzk-playlists-create-btn:hover {
  background: #3045F5;
  transform: translateY(-1px);
}

.mzk-playlists-create-btn:active {
  transform: translateY(0);
}

/* ---- Tabs ---- */
.mzk-playlists-tabs {
  display: flex;
  gap: 0;
  width: 100%;
  margin-top: 24px;
  border-bottom: 1px solid var(--playlists-border);
}

.mzk-playlists-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  margin-bottom: -1px;
  color: var(--playlists-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.mzk-playlists-tab:hover {
  color: var(--playlists-text);
}

.mzk-playlists-tab.is-active {
  color: var(--playlists-primary);
  font-weight: 600;
  border-bottom-color: var(--playlists-primary);
}

.mzk-playlists-tab svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: currentColor;
}

/* ---- Create Form ---- */
.mzk-playlists-create-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--playlists-border);
  border-radius: var(--playlists-radius);
  background: var(--playlists-bg);
}

.mzk-playlists-create-form input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #E4E8F2;
  border-radius: 12px;
  color: var(--playlists-text);
  font: inherit;
  font-size: 14px;
  outline: 0;
  transition: border-color .2s ease;
}

.mzk-playlists-create-form input::placeholder {
  color: #A0A8BA;
}

.mzk-playlists-create-form input:focus {
  border-color: var(--playlists-primary);
  box-shadow: 0 0 0 3px rgba(66, 85, 255, .1);
}

.mzk-playlists-create-form button {
  height: 44px;
  width: 100px;
  flex: 0 0 100px;
  border: 0;
  border-radius: 12px;
  background: var(--playlists-primary);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}

.mzk-playlists-create-form button:hover {
  background: #3045F5;
}

.mzk-playlists-create-form [data-library-form-status] {
  flex: 0 0 100%;
  min-height: 18px;
  margin: 0;
  color: #E11D48;
  font-size: 13px;
  line-height: 18px;
}

.mzk-playlists-create-form [data-library-form-status]:empty {
  display: none;
}

/* ---- List Header Toolbar ---- */
.mzk-playlists-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  margin-top: 28px;
  margin-bottom: 14px;
}

.mzk-playlists-list-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mzk-playlists-list-header__title h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 28px;
  color: var(--playlists-text);
  white-space: nowrap;
}

.mzk-playlists-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 24px;
  padding: 0 8px;
  border-radius: 20px;
  background: var(--color-primary-soft);
  color: var(--playlists-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.mzk-playlists-list-header__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mzk-playlists-sort {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #E7EAF3;
  border-radius: 12px;
  background: #fff;
  color: #667085;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s ease;
}

.mzk-playlists-sort:hover {
  background: #F8F9FF;
}

.mzk-playlists-sort svg {
  width: 16px;
  height: 16px;
  margin-left: 8px;
  flex: 0 0 16px;
  transition: transform .2s ease;
}

.mzk-playlists-sort.is-open svg {
  transform: rotate(180deg);
}

/* ---- Sort Dropdown ---- */
.mzk-playlists-sort-dropdown {
  position: fixed;
  z-index: 1000;
  width: 220px;
  padding: 6px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s ease;
}

.mzk-playlists-sort-dropdown.is-open {
  opacity: 1;
  visibility: visible;
}

.mzk-playlists-sort-item {
  display: flex;
  width: 100%;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--playlists-text);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease;
}

.mzk-playlists-sort-item:hover {
  background: #F1F4FF;
  color: var(--playlists-primary);
}

.mzk-playlists-sort-item.is-active {
  background: #F4F6FF;
  color: var(--playlists-primary);
  font-weight: 600;
}

.mzk-playlists-sort-item + .mzk-playlists-sort-item {
  margin-top: 2px;
}

.mzk-playlists-view-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #E7EAF3;
  border-radius: 12px;
  background: #fff;
  color: #8791A7;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.mzk-playlists-view-btn:hover {
  background: #F8F9FF;
}

.mzk-playlists-view-btn.is-active {
  background: #F4F6FF;
  border-color: #D9DEFF;
  color: var(--playlists-primary);
}

.mzk-playlists-view-btn svg {
  width: 18px;
  height: 18px;
}

/* ---- Playlist Grid ---- */
.mzk-playlists-grid {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.mzk-playlists-grid.is-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.mzk-playlists-grid.is-grid .mzk-playlists-card {
  flex-direction: column;
  align-items: stretch;
  height: auto;
  padding: 20px;
  gap: 16px;
  text-align: center;
}

.mzk-playlists-grid.is-grid .mzk-playlists-card__link {
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.mzk-playlists-grid.is-grid .mzk-playlists-card__icon {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 20px;
}

.mzk-playlists-grid.is-grid .mzk-playlists-card__icon svg {
  width: 32px;
  height: 32px;
}

.mzk-playlists-grid.is-grid .mzk-playlists-card__body {
  text-align: center;
}

.mzk-playlists-grid.is-grid .mzk-playlists-card__date {
  display: none;
}

/* ---- Playlist Card ---- */
.mzk-playlists-card {
  display: flex;
  align-items: center;
  height: 76px;
  padding: 0 18px;
  border: 1px solid var(--playlists-border);
  border-radius: var(--playlists-radius);
  background: var(--playlists-bg);
  transition: transform .2s ease, box-shadow .2s ease;
}

.mzk-playlists-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, .05);
}

.mzk-playlists-card__link {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.mzk-playlists-card__icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--folder-bg, var(--color-primary-soft));
  color: var(--folder-color, var(--playlists-primary));
}

.mzk-playlists-card__icon svg {
  width: 22px;
  height: 22px;
}

.mzk-playlists-card__body {
  min-width: 0;
  flex: 1;
}

.mzk-playlists-card__name {
  display: block;
  overflow: hidden;
  color: var(--playlists-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mzk-playlists-card__count {
  display: block;
  margin-top: 2px;
  color: var(--playlists-muted);
  font-size: 14px;
  line-height: 20px;
}

/* ---- Date ---- */
.mzk-playlists-card__date {
  flex: 0 0 auto;
  margin: 0 12px;
  color: #8A94A8;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

/* ---- Menu ---- */
.mzk-playlists-card__menu {
  flex: 0 0 auto;
  position: relative;
}

.mzk-playlists-card__menu-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #A0A8BA;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.mzk-playlists-card__menu-btn:hover {
  background: #F1F4FF;
  color: var(--playlists-primary);
}

.mzk-playlists-card__menu-btn svg {
  width: 22px;
  height: 22px;
}

/* ---- Dropdown ---- */
.mzk-playlists-dropdown {
  position: fixed;
  z-index: 1000;
  width: 220px;
  padding: 6px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s ease;
}

.mzk-playlists-dropdown.is-open {
  opacity: 1;
  visibility: visible;
}

.mzk-playlists-dropdown button {
  display: flex;
  width: 100%;
  align-items: center;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--playlists-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease;
}

.mzk-playlists-dropdown button:hover {
  background: #F1F4FF;
  color: var(--playlists-primary);
}

.mzk-playlists-dropdown button:last-child {
  color: #E11D48;
}

.mzk-playlists-dropdown button:last-child:hover {
  background: #FFF0F0;
  color: #E11D48;
}

/* ---- Empty State ---- */
.mzk-playlists-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  text-align: center;
  grid-column: 1 / -1;
}

.mzk-playlists-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.mzk-playlists-empty h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--playlists-text);
}

.mzk-playlists-empty p {
  margin: 8px 0 0;
  color: var(--playlists-muted);
  font-size: 15px;
}

/* ---- Responsive: Tablet ---- */
@media (max-width: 1024px) {
  .mzk-playlists-page {
    padding: 0 20px 32px;
  }
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 767px) {
  .mzk-playlists-header {
    flex-direction: column;
  }

  .mzk-playlists-header__text h1 {
    font-size: 24px;
    line-height: 32px;
  }

  .mzk-playlists-header__text p {
    font-size: 14px;
  }

  .mzk-playlists-create-btn {
    width: 100%;
    height: 48px;
    justify-content: center;
  }

  .mzk-playlists-tabs {
    gap: 0;
    margin-top: 12px;
    border-bottom: 1px solid var(--playlists-border);
    overflow: visible;
  }

  .mzk-playlists-tab {
    flex: 1;
    justify-content: center;
    min-height: 44px;
    padding: 10px 6px;
    font-size: 14px;
    gap: 4px;
    margin-bottom: -1px;
    white-space: nowrap;
  }

  .mzk-playlists-tab svg {
    display: none;
  }

  .mzk-playlists-tab.is-active {
    border-bottom-color: var(--playlists-primary);
  }

  .mzk-playlists-create-form {
    flex-wrap: wrap;
  }

  .mzk-playlists-create-form input {
    width: 100%;
    flex: none;
  }

  .mzk-playlists-create-form button {
    width: 100%;
    flex: none;
  }

  .mzk-playlists-card {
    height: 72px;
    padding: 0 14px;
  }

  .mzk-playlists-card__date {
    display: none;
  }

  .mzk-playlists-list-header {
    margin-top: 20px;
    margin-bottom: 12px;
  }

  .mzk-playlists-list-header__title h2 {
    font-size: 19px;
  }

  .mzk-playlists-sort {
    max-width: 100%;
  }

  .mzk-playlists-sort svg {
    flex: 0 0 16px;
  }

  .mzk-playlists-grid.is-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mzk-playlists-grid.is-grid .mzk-playlists-card__icon {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
  }

  .mzk-playlists-grid.is-grid .mzk-playlists-card__icon svg {
    width: 26px;
    height: 26px;
  }
}

/* ---- Responsive: Small Mobile ---- */
@media (max-width: 359px) {
  .mzk-playlists-page {
    padding: 0 12px 24px;
  }

  .mzk-playlists-card {
    padding: 0 10px;
  }

  .mzk-playlists-card__icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .mzk-playlists-grid.is-grid .mzk-playlists-card {
    padding: 14px;
  }

  .mzk-playlists-grid.is-grid .mzk-playlists-card__icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
  }

  .mzk-playlists-sort {
    font-size: 12px;
    padding: 0 8px;
    height: 32px;
  }

  .mzk-playlists-view-btn {
    width: 36px;
    height: 36px;
  }

  .mzk-playlists-list-header__controls {
    gap: 6px;
  }
}

/* ---- Active tab underline ---- */
.mzk-playlists-tab.is-active::after {
  transition: .3s ease;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .mzk-playlists-create-btn,
  .mzk-playlists-card,
  .mzk-playlists-tab,
  .mzk-playlists-card__menu-btn,
  .mzk-playlists-dropdown,
  .mzk-playlists-dropdown button,
  .mzk-playlists-sort,
  .mzk-playlists-sort-dropdown,
  .mzk-playlists-view-btn {
    transition: none;
  }

  .mzk-playlists-tab.is-active::after {
    transition: none;
  }

  .mzk-playlists-sort svg {
    transition: none;
  }

  .mzk-playlists-sort.is-open svg {
    transform: none;
  }
}

/* ---- Pagination ---- */
.mzk-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--playlists-border);
}

.mzk-navigation .mzk-page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--playlists-text);
  background: var(--playlists-bg);
  border: 1px solid var(--playlists-border);
  text-decoration: none;
  transition: all 0.15s ease;
}

.mzk-navigation .mzk-page-item:hover {
  border-color: var(--playlists-primary);
  color: var(--playlists-primary);
}

.mzk-navigation .mzk-page-item.is-active {
  background: var(--playlists-primary);
  border-color: var(--playlists-primary);
  color: #fff;
}
