/* Playlist player — TYLKO okno modalne */

.lstraktor-yt-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.72);
}

.lstraktor-yt-modal {
  padding: 0 !important;
  z-index: 20010 !important;
  background: transparent;
}

.lstraktor-yt-modal.is-open,
.lstraktor-yt-modal.show {
  display: block !important;
  opacity: 1 !important;
}

body.lstraktor-yt-open {
  overflow: hidden;
}

.lstraktor-yt-modal .modal-dialog.lstraktor-yt-dialog {
  max-width: min(1120px, 96vw);
  width: 96vw;
  margin: 1.25rem auto;
  transform: none !important;
}

.lstraktor-yt-content {
  background: #111;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* Duży, zawsze widoczny X */
.lstraktor-yt-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f6eb9a;
  color: #111;
  font-size: 22px;
  font-weight: 800;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.lstraktor-yt-close:hover,
.lstraktor-yt-close:focus {
  background: #f6eb9a;
  outline: none;
}

.lstraktor-yt-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 420px;
  max-height: min(78vh, 640px);
}

/* Desktop: playlista z lewej (order), player z prawej */
.lstraktor-yt-playlist {
  order: -1;
  flex: 0 0 320px;
  width: 320px;
  max-width: 38%;
  overflow-y: auto;
  background: #f4f4f4;
  border-right: 1px solid #ddd;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.lstraktor-yt-item {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e4e4e4;
  background: #f7f7f7;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  min-height: 72px;
  -webkit-tap-highlight-color: transparent;
}

.lstraktor-yt-item:hover {
  background: #efefef;
}

.lstraktor-yt-item.is-active {
  background: #f6eb9a;
  box-shadow: inset 3px 0 0 #c9a800;
}

.lstraktor-yt-item__thumb {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 64px;
  background: #222;
  overflow: hidden;
  border-radius: 2px;
}

.lstraktor-yt-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lstraktor-yt-item__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.lstraktor-yt-item__title {
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.35;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-top: 2px;
}

.lstraktor-yt-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  min-width: 0;
  padding: 28px 48px 20px 16px;
}

.lstraktor-yt-frame-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.lstraktor-yt-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.lstraktor-yt-trigger {
  cursor: pointer;
  display: block;
}

/* —— Mobile: fullscreen nad headerem, player + pasek miniaturek —— */
@media (max-width: 900px) {
  .lstraktor-yt-modal {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  .lstraktor-yt-modal .modal-dialog.lstraktor-yt-dialog {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
  }

  .lstraktor-yt-content {
    border-radius: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    overflow: hidden;
  }

  .lstraktor-yt-close {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 20020;
    width: 52px;
    height: 52px;
    line-height: 48px;
    background: #f6eb9a;
    color: #111;
    font-size: 26px;
    font-weight: 800;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
    border: 2px solid #fff;
  }

  .lstraktor-yt-layout {
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: 100%;
  }

  .lstraktor-yt-stage {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: calc(64px + env(safe-area-inset-top, 0px)) 0 8px;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .lstraktor-yt-frame-wrap {
    width: 100%;
  }

  /* Pasek miniaturek zawsze przyklejony do dołu */
  .lstraktor-yt-playlist {
    order: 0;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: none;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: #141414;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .lstraktor-yt-item {
    flex: 0 0 auto;
    display: block;
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    min-height: 0;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
    scroll-snap-align: start;
    box-shadow: none;
  }

  .lstraktor-yt-item:hover,
  .lstraktor-yt-item.is-active {
    background: transparent;
    box-shadow: none;
  }

  .lstraktor-yt-item__thumb {
    position: relative;
    display: block;
    flex: none;
    width: 120px;
    height: 68px;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    outline: 2px solid transparent;
    outline-offset: 1px;
  }

  .lstraktor-yt-item.is-active .lstraktor-yt-item__thumb {
    outline-color: #e8c200;
  }

  .lstraktor-yt-item__thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .lstraktor-yt-item__play {
    border-width: 6px 0 6px 10px;
  }

  .lstraktor-yt-item__title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .lstraktor-yt-layout {
    flex-direction: row;
  }

  .lstraktor-yt-stage {
    flex: 1 1 65%;
    padding: 8px 8px 8px 0;
  }

  .lstraktor-yt-playlist {
    flex: 0 0 35%;
    width: 35%;
    max-width: 35%;
    height: 100%;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    scroll-snap-type: none;
    padding: 8px;
  }

  .lstraktor-yt-item,
  .lstraktor-yt-item__thumb {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .lstraktor-yt-item__thumb {
    height: 0;
    padding-top: 56.25%;
  }
}
