/*
 * Add-to-video-playlist dialog.
 * Lives in a global sheet rather than scoped CSS because MudDialog renders its content through
 * MudDialogProvider, outside this component's scope attribute.
 */

.video-playlist-dialog {
    --vp-surface: rgba(var(--twins-bg-elevated-rgb), 0.98);
    --vp-text: rgba(var(--ink-rgb), 0.98);
    --vp-text-secondary: rgba(var(--ink-rgb), 0.72);
    --vp-text-muted: rgba(var(--ink-rgb), 0.46);
    --vp-border: rgba(185, 138, 255, 0.25);
    --vp-primary: var(--twins-primary, #9d5cff);
    --vp-primary-contrast: #fff;
}

body[data-theme="neuro"] .video-playlist-dialog {
    --vp-surface: var(--neuro-bg-elevated, rgba(var(--neuro-bg-elevated-rgb), 0.98));
    --vp-text: var(--neuro-text-primary, #fff);
    --vp-text-secondary: var(--neuro-text-secondary, #a8b9d9);
    --vp-text-muted: var(--neuro-text-muted, #6b7a98);
    --vp-border: rgba(92, 225, 255, 0.23);
    --vp-primary: var(--neuro-primary, #00d9ff);
    --vp-primary-contrast: #000;
}

body[data-theme="evil"] .video-playlist-dialog {
    --vp-surface: var(--evil-bg-elevated, rgba(var(--evil-bg-elevated-rgb), 0.98));
    --vp-text: var(--evil-text-primary, #fff);
    --vp-text-secondary: var(--evil-text-secondary, #e0a3c7);
    --vp-text-muted: var(--evil-text-muted, #8a5a73);
    --vp-border: rgba(255, 51, 133, 0.24);
    --vp-primary: var(--evil-primary, #ff0066);
}

body[data-theme="twins"] .video-playlist-dialog {
    --vp-surface: var(--twins-bg-elevated, rgba(var(--twins-bg-elevated-rgb), 0.98));
    --vp-text: var(--twins-text-primary, #fff);
    --vp-text-secondary: var(--twins-text-secondary, #c5b3e0);
    --vp-text-muted: var(--twins-text-muted, #7a6b98);
    --vp-border: rgba(185, 138, 255, 0.25);
    --vp-primary: var(--twins-primary, #9d5cff);
}

.video-playlist-dialog.mud-dialog {
    width: 424px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    border-radius: 8px;
    background: var(--vp-surface);
    color: var(--vp-text);
    box-shadow: 0 11px 44px rgba(0, 0, 0, 0.55);
}

.video-playlist-dialog .mud-dialog-title {
    padding: 18px 20px 12px;
}

.vp-dialog-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.vp-dialog-title strong {
    color: var(--vp-text);
    font-size: 1.06rem;
    font-weight: 500;
}

.vp-close {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--vp-text-secondary);
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.vp-close:hover {
    background: rgba(var(--ink-rgb), 0.09);
    color: var(--vp-text);
}

.video-playlist-dialog .vp-dialog-content {
    padding: 0 !important;
    overflow: hidden;
}

.vp-dialog-lede {
    margin: 0;
    padding: 0 20px 6px;
    color: var(--vp-text-secondary);
    font-size: 0.81rem;
    line-height: 1.5;
}

.vp-dialog-lede strong {
    color: var(--vp-text);
}

.vp-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 8px;
    overscroll-behavior: contain;
}

.vp-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--vp-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease;
}

.vp-row:hover {
    background: rgba(var(--ink-rgb), 0.06);
}

.vp-row:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--vp-primary) 62%, transparent);
}

.vp-row .vp-box {
    flex: 0 0 auto;
    color: var(--vp-text-muted);
    font-size: 1.38rem;
}

.vp-row .vp-box.is-checked {
    color: var(--vp-primary);
}

.vp-row-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.vp-row-name {
    overflow: hidden;
    color: var(--vp-text);
    font-size: 0.875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vp-row-meta {
    margin-top: 2px;
    color: var(--vp-text-muted);
    font-size: 0.72rem;
}

.vp-row .vp-row-visibility {
    flex: 0 0 auto;
    color: var(--vp-text-muted);
    font-size: 1.13rem;
}

.vp-new-playlist {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border: 0;
    border-top: 1px solid rgba(var(--ink-rgb), 0.07);
    background: transparent;
    color: color-mix(in srgb, var(--vp-primary) 82%, white);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease;
}

.vp-new-playlist:hover {
    background: rgba(var(--ink-rgb), 0.05);
}

.vp-new-playlist .mud-icon-root {
    font-size: 1.38rem;
}

.vp-create-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 20px 6px;
}

.vp-empty {
    display: flex;
    min-height: 200px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 10px 16px;
    padding: 28px 20px;
    border: 1px dashed var(--vp-border);
    border-radius: 18px;
    text-align: center;
}

.vp-empty-icon {
    display: grid;
    width: 68px;
    height: 68px;
    margin-bottom: 18px;
    place-items: center;
    border: 1px solid var(--vp-border);
    border-radius: 50%;
    background: rgba(var(--ink-rgb), 0.05);
    color: var(--vp-primary);
}

.vp-empty-icon .mud-icon-root {
    font-size: 2rem;
}

.vp-empty h2 {
    margin: 0;
    color: var(--vp-text);
    font-size: 1.09rem;
    font-weight: 600;
}

.vp-empty p {
    max-width: 420px;
    margin: 8px 0 0;
    color: var(--vp-text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.vp-loading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 20px;
}

.vp-row-skeleton {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
}

.vp-row-skeleton span {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 4px;
    background: rgba(var(--ink-rgb), 0.07);
}

.vp-row-skeleton i {
    width: 62%;
    height: 12px;
    border-radius: 999px;
    background: rgba(var(--ink-rgb), 0.07);
}

.video-playlist-dialog .vp-dialog-actions {
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px !important;
}

.vp-btn {
    padding: 8px 16px;
    border: 0;
    border-radius: 4px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 150ms ease, opacity 150ms ease;
}

.vp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vp-btn-text {
    background: transparent;
    color: var(--vp-text-secondary);
}

.vp-btn-text:hover:not(:disabled) {
    background: rgba(var(--ink-rgb), 0.06);
}

.vp-btn-primary {
    padding: 8px 18px;
    background: var(--vp-primary);
    color: var(--vp-primary-contrast);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--vp-primary) 30%, transparent);
}

.vp-btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--vp-primary) 88%, white);
}

@media (prefers-reduced-motion: reduce) {
    .vp-row,
    .vp-close,
    .vp-new-playlist,
    .vp-btn {
        transition: none;
    }
}
