/**
 * Bottom sheet — Share (Shadcn Sheet bottom). z-index above drawer (10050) and TMDB modal (11000).
 */
.playlists-media-bottom-sheet-lock {
  overflow: hidden !important;
}

.pmb-hidden {
  display: none !important;
}

#playlists-media-bottom-sheet-root.pmb-root {
  --pmb-ring: var(--ring, var(--primary, 24 24 27));
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.2s;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Inter',
    'Segoe UI',
    sans-serif;
}

#playlists-media-bottom-sheet-root.pmb-root.pmb-root--open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.pmb-overlay {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.2s ease;
}

.dark #playlists-media-bottom-sheet-root.pmb-root .pmb-overlay {
  background: rgb(24 24 27 / 0.95);
}

.pmb-positioner {
  position: relative;
  width: 100%;
  max-width: 26.75rem;
  max-height: min(92vh, 100dvh);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0.75rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  z-index: 1;
}

@media (min-width: 640px) {
  #playlists-media-bottom-sheet-root.pmb-root {
    align-items: center;
    padding: 1rem;
  }
  .pmb-positioner {
    align-items: center;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  }
}

.pmb-content {
  width: 100%;
  background: rgb(var(--card, 255 255 255));
  color: rgb(var(--card-foreground, var(--foreground, 10 10 10)));
  border: 1px solid rgb(var(--border, 228 228 231));
  border-radius: 1.5rem 1.5rem 0 0;
  box-shadow:
    0 25px 50px -12px rgb(0 0 0 / 0.25),
    0 -4px 24px rgb(0 0 0 / 0.08);
  transform: translateY(100%);
  opacity: 0.98;
  transition:
    transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.25s ease;
  max-height: min(88vh, 100dvh - env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.dark .pmb-content {
  box-shadow:
    0 25px 50px -12px rgb(0 0 0 / 0.55),
    0 -8px 32px rgb(0 0 0 / 0.35);
}

@media (min-width: 640px) {
  .pmb-content {
    border-radius: var(--radius, 0.5rem);
    transform: translateY(16px) scale(0.96);
  }
}

#playlists-media-bottom-sheet-root.pmb-root.pmb-root--open .pmb-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pmb-handle-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
  background: rgb(var(--card, 255 255 255));
}

@media (min-width: 640px) {
  .pmb-handle-wrap {
    display: none;
  }
}

.pmb-handle {
  width: 2.25rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: rgb(var(--muted-foreground, 100 116 139) / 0.35);
}

/* Header — fixed poster column + flexible title (share sheet). */
.pmb-header {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 1rem 0.75rem;
  padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .pmb-header {
    padding-top: 0.75rem;
  }
}

.pmb-header-main {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.75rem;
}

/* Fixed-width poster column — equal flex + min-width:0 can collapse the image in nested flex (esp. Safari). */
.pmb-poster-wrap {
  flex: 0 0 5.75rem;
  width: 5.75rem;
  max-width: 38%;
  min-width: 4.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  align-self: flex-start;
}

.pmb-poster {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: center;
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  border: 1px solid rgb(var(--border, 228 228 231));
  background: rgb(var(--muted, 244 244 245));
  display: block;
  box-shadow:
    0 1px 2px 0 rgb(0 0 0 / 0.06),
    0 2px 8px -2px rgb(0 0 0 / 0.08);
}

.pmb-poster-wrap--square {
  flex: 0 0 5.75rem;
  width: 5.75rem;
}

.pmb-poster--square,
.pmb-poster--placeholder.pmb-poster--square {
  aspect-ratio: 1 / 1;
}

.pmb-poster-wrap--wide {
  flex: 0 0 6.5rem;
  width: 6.5rem;
}

.pmb-poster--wide,
.pmb-poster--placeholder.pmb-poster--wide {
  aspect-ratio: 16 / 9;
}

.pmb-poster--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  box-sizing: border-box;
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  border: 1px dashed rgb(var(--border, 228 228 231));
  background: rgb(var(--muted, 244 244 245));
  color: rgb(var(--muted-foreground, 100 116 139));
}

.pmb-poster--placeholder svg {
  width: clamp(1.75rem, 28%, 2.5rem);
  height: clamp(1.75rem, 28%, 2.5rem);
  opacity: 0.65;
}

.pmb-header-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pmb-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: rgb(var(--foreground, 10 10 10));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pmb-description {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  font-weight: 500;
  color: rgb(var(--muted-foreground, 100 116 139));
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pmb-btn-icon {
  flex-shrink: 0;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  background: transparent;
  color: rgb(var(--muted-foreground, 100 116 139));
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.pmb-btn-icon:hover {
  background: rgb(var(--accent, 244 244 245));
  color: rgb(var(--accent-foreground, 24 24 27));
}

.pmb-btn-icon:focus-visible {
  outline: 2px solid rgb(var(--pmb-ring));
  outline-offset: 2px;
}

.pmb-separator {
  height: 1px;
  margin: 0 1rem;
  background: rgb(var(--border, 228 228 231));
  flex-shrink: 0;
}

.pmb-tv-slot {
  flex-shrink: 0;
  padding: 0 1rem 0.5rem;
  max-height: 40vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pmb-tv-slot[hidden] {
  display: none !important;
}

.pmb-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pmb-footer {
  flex-shrink: 0;
  padding: 0.5rem 1rem max(0.65rem, env(safe-area-inset-bottom, 0px));
  font-size: 0.6875rem;
  line-height: 1.35;
  color: rgb(var(--muted-foreground, 100 116 139));
  border-top: 1px solid rgb(var(--border, 228 228 231) / 0.85);
  background: rgb(var(--card, 255 255 255));
}

.pmb-footer:empty {
  display: none;
}

/* Watch skeleton */
@keyframes pmb-skel-pulse {
  50% {
    opacity: 0.45;
  }
}

.pmb-skel {
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  background: rgb(var(--muted, 244 244 245));
  animation: pmb-skel-pulse 1.2s ease-in-out infinite;
}

.dark .pmb-skel {
  background: rgb(39 39 42);
}

.pmb-skel-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.pmb-skel-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  flex-shrink: 0;
}

.pmb-skel-lines {
  flex: 1;
  min-width: 0;
}

.pmb-skel-line {
  height: 0.65rem;
  margin-bottom: 0.35rem;
}

.pmb-skel-line--short {
  width: 55%;
}

.pmb-skel-line:last-child {
  margin-bottom: 0;
}

/* Command-style list picker (List It) */
.pmb-list-command {
  margin-bottom: 0.75rem;
}

.pmb-list-command-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(var(--muted-foreground, 100 116 139));
  margin-bottom: 0.35rem;
}

.pmb-list-command-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  border: 1px solid rgb(var(--border, 228 228 231));
  background: rgb(var(--background, 250 250 250));
  color: rgb(var(--foreground, 10 10 10));
}

.pmb-list-command-input:focus {
  outline: 2px solid rgb(var(--pmb-ring));
  outline-offset: 0;
}

.pmb-list-command-options {
  margin-top: 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  border: 1px solid rgb(var(--border, 228 228 231));
  background: rgb(var(--background, 250 250 250));
}

.pmb-list-command-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-bottom: 1px solid rgb(var(--border, 228 228 231) / 0.6);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s ease;
}

.pmb-list-command-option:last-child {
  border-bottom: none;
}

.pmb-list-command-option:hover,
.pmb-list-command-option:focus-visible {
  background: rgb(var(--accent, 244 244 245));
}

.pmb-list-command-option[aria-selected='true'] {
  background: rgb(var(--accent, 244 244 245));
  box-shadow: inset 3px 0 0 rgb(var(--primary, 59 130 246));
}

.pmb-list-command-new {
  margin-top: 0.5rem;
  padding: 0.65rem;
  border-radius: calc(var(--radius, 0.5rem) - 2px);
  border: 2px dashed rgb(var(--border, 228 228 231));
  background: transparent;
}

.pmb-list-command-new button {
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 0.35rem;
  border: none;
  background: transparent;
  color: rgb(var(--foreground, 10 10 10));
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
