﻿/* YouTube Video Importer - Modern YouTube connector styles (v2.10.6) */
/* Aesthetic: white surface, dark icons, soft rounded pills, subtle hover shadows. */

.yvi-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #060606;
    background: #0e0e0e;
    padding: 1rem;
    border-radius: 1rem;
}

/* Status pill (top of connected card) — dark theme */
.yvi-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(34,197,94,0.14) !important;
    color: #86efac !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    border: 1px solid rgba(34,197,94,0.25) !important;
    align-self: flex-start;
}
.yvi-status-pill svg { color: currentColor; }

/* Connected header layout */
.yvi-connected-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Base button (white, rounded, soft shadow on hover) */
.yvi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    color: #111111;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.yvi-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); border-color: rgba(255,255,255,0.12); background: #2a2a2a !important; color: #fff !important; }
.yvi-btn:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); }
.yvi-btn:focus-visible { outline: 2px solid #555; outline-offset: 2px; }
.yvi-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Primary button — dark grey/white, low contrast hover (not pure black on black) */
.yvi-wrap .yvi-btn-primary,
.yvi-page .yvi-btn-primary {
    background: #e8e8e8 !important;
    color: #111111 !important;
    border-color: #e8e8e8 !important;
}
.yvi-wrap .yvi-btn-primary:hover,
.yvi-page .yvi-btn-primary:hover { background: #d4d4d4 !important; border-color: #d4d4d4 !important; color: #111111 !important; box-shadow: 0 4px 14px rgba(255,255,255,0.08) !important; transform: translateY(-1px); }
.yvi-wrap .yvi-btn-primary:active,
.yvi-page .yvi-btn-primary:active { background: #c8c8c8 !important; border-color: #c8c8c8 !important; }
/* Secondary — WHITE with BLACK text (as requested) */
.yvi-wrap .yvi-btn-secondary,
.yvi-page .yvi-btn-secondary {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: #ffffff !important;
}
.yvi-wrap .yvi-btn-secondary:hover,
.yvi-page .yvi-btn-secondary:hover { background: #f0f0f0 !important; color: #111111 !important; border-color: #f0f0f0 !important; box-shadow: none !important; }
.yvi-wrap .yvi-btn-secondary svg,
.yvi-page .yvi-btn-secondary svg { stroke: #111111 !important; color: #111111 !important; }

/* Ghost button — dark transparent grey */
.yvi-btn-ghost {
    background: rgba(255,255,255,0.06);
    color: #eaeaea !important;
    border-color: rgba(255,255,255,0.12) !important;
    padding: 7px 14px;
    font-size: 12.5px;
}
.yvi-btn-ghost:hover { background: rgba(255,255,255,0.12) !important; color: #fff !important; border-color: rgba(255,255,255,0.18) !important; box-shadow: none !important; }
.yvi-btn-icon-plus { font-size: 16px; line-height: 1; font-weight: 700; margin-right: 2px; }

/* Danger (Disconnect) — white surface, red border + hover */
.yvi-btn-danger {
    background: #ffffff;
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.35);
    padding: 7px 14px;
    font-size: 12.5px;
}
.yvi-btn-danger:hover { background: rgba(220, 38, 38, 0.08); border-color: #dc2626; color: #991b1b; box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12); }

/* Channel pills row */
.yvi-channels-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.yvi-channels-pills > .yvi-channel-pill-form,
.yvi-channels-pills > .yvi-pill-remove-form {
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    transform: translateY(4px);
    animation: yvi-pill-in 0.24s ease forwards;
}
@keyframes yvi-pill-in {
    to { opacity: 1; transform: translateY(0); }
}

/* Pill button */
.yvi-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    background: #ffffff;
    color: #111111;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    max-width: 220px;
}
.yvi-pill:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); border-color: rgba(0, 0, 0, 0.2); }
.yvi-wrap .yvi-pill.active,
.yvi-page .yvi-pill.active {
    border-color: #111111 !important;
    background: #f3f3f5 !important;
    box-shadow: 0 0 0 1px #111111 inset !important;
}
.yvi-pill-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}
.yvi-wrap .yvi-pill-avatar-fallback,
.yvi-page .yvi-pill-avatar-fallback {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #111111 0%, #333333 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
    text-transform: uppercase !important;
}
.yvi-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}
.yvi-wrap .yvi-pill-check,
.yvi-page .yvi-pill-check {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: #111111 !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
}

/* Remove X button on inactive pills */
.yvi-pill-remove-form {
    margin-left: -4px;
}
.yvi-pill-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #555;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.yvi-pill-remove:hover { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* Actions row (Open Select + Disconnect) */
.yvi-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}
.yvi-disconnect-form { margin: 0; padding: 0; display: inline-flex; }

/* Stale-token state */
.yvi-state-stale {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.yvi-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
    border: 1px solid #fde68a;
}
.yvi-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

/* Select-video page uses the same styles; the .yvi-page wrapper in select_video.php can be styled separately if needed. */
.yvi-page { background: transparent; color: #111; }

/* Notice (error state when API creds missing) */
.yvi-notice { padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.yvi-notice-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.yvi-notice a { color: #991b1b; text-decoration: underline; }

/* Force white/black on every YVI button (overrides theme/plugin CSS) */
.yvi-wrap .yvi-btn,
.yvi-page .yvi-btn {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
.yvi-wrap .yvi-btn-danger,
.yvi-page .yvi-btn-danger {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: rgba(0, 0, 0, 0.18) !important;
}
.yvi-wrap .yvi-btn-danger:hover,
.yvi-page .yvi-btn-danger:hover {
    background: #f3f3f5 !important;
    border-color: #111111 !important;
}

/* Legacy aliases (kept for backwards compatibility with any existing markup) */
.yvi-connect-btn,
.yvi-select-btn,
.yvi-add-channel,
.yvi-disconnect-btn {
    /* inherits .yvi-btn + variant */
}

/* FIX: pills inside dark dashboard — force white bg + dark text (was white-on-white) */
.yvi-wrap .yvi-pill,
.yvi-page .yvi-pill {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
.yvi-wrap .yvi-pill:hover,
.yvi-page .yvi-pill:hover {
    background: #f9fafb !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: #111111 !important;
}
.mshub-dashboard .yvi-pill,
.mshub-dashboard .yvi-pill-name {
    color: #111111 !important;
}
/* Ensure pills stay light even when Hub dark theme tries to force white text */
.mshub-dashboard .yvi-wrap,
.mshub-dashboard .yvi-wrap * {
    color: inherit;
}
.mshub-dashboard .yvi-wrap .yvi-pill {
    background: #ffffff !important;
    color: #111111 !important;
}

/* ============================================================
   SELECT-VIDEO PAGE — modern clean layout
   ============================================================ */
.yvi-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 96px;
    /* Bottom padding must clear: tray height (~64px) + tray gap (16px) + bottom player (~96px) + safe area.
       Desktop: 260px. Mobile/tablet (≤768px): 280px (covers the mobile menu ~64px). */
    padding-bottom: calc(260px + env(safe-area-inset-bottom, 0px));
    background: #0a0a0a !important;
    color: #eaeaea !important;
    min-height: 60vh;
    /* Critical: do NOT use `transform`, `filter`, `backdrop-filter`,
       or `will-change` on .yvi-page — any of these would create a
       containing block that traps the fixed-position tray. */
    transform: none !important;
    filter: none !important;
    contain: layout style;
}
@media (max-width: 768px) {
    .yvi-page { padding-bottom: calc(280px + env(safe-area-inset-bottom, 0px)); }
}
.yvi-page * { box-sizing: border-box; }

/* Centered connect hero on empty state */
.yvi-page.yvi-empty { padding: 24px 20px !important; min-height: 80vh; display:flex; align-items:center; justify-content:center; }
.yvi-connect-hero {
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 28px;
    background: #141414;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.yvi-connect-hero-icon { width:64px; height:64px; margin:0 auto 16px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; }
.yvi-connect-hero-icon img { width:38px; height:38px; display:block; }
.yvi-connect-hero-title { font-size:18px; color:#fff; margin:0 0 8px; font-weight:700; }
.yvi-connect-helper { font-size:13px; color:#aaa; line-height:1.55; margin:0 0 20px; }
.yvi-connect-hero .yvi-connect-btn {
    min-width: 220px;
    display: inline-flex;
    margin: 0 auto;
    height: 44px;
    padding: 12px 22px;
    font-size: 14px;
}
.yvi-connect-hero .yvi-connect-btn img { width:18px; height:18px; }

/* Header: pills + search/filter — dark */
.yvi-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: #141414;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.yvi-channels-pills-large {
    gap: 10px;
}
.yvi-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.yvi-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px 10px 36px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    background: #1e1e1e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
    font-size: 13px;
    color: #fff;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.yvi-search:focus { border-color: #444; box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
.yvi-search::placeholder { color: #777; }
.yvi-status-filter {
    padding: 10px 32px 10px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    background: #1e1e1e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    font-size: 13px;
    color: #fff;
    appearance: none;
    cursor: pointer;
}

/* Tabs — dark, grey/white buttons */
.yvi-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: #141414;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    width: fit-content;
}
.yvi-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #aaa !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.yvi-tab svg { width: 16px; height: 16px; flex-shrink: 0; fill: currentColor; stroke: currentColor; }
.yvi-tab:hover { color: #fff !important; background: #2a2a2a !important; border-color: rgba(255,255,255,0.08) !important; }
.yvi-tab.active { background: #e8e8e8 !important; color: #111111 !important; border-color: #e8e8e8 !important; box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important; }
.yvi-tab.active svg { color: #111111 !important; fill: #111111 !important; }
.yvi-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
}
.yvi-tab.active .yvi-tab-count { background: rgba(0,0,0,0.12); color: #111; }

/* Content / Grid */
.yvi-content { background: transparent; }
.yvi-grid-wrap { min-height: 200px; }
.yvi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
@media (max-width: 640px) {
    .yvi-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
.yvi-grid-empty {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    background: #141414;
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 12px;
    font-size: 14px;
}
.yvi-load-more-wrap { text-align: center; margin-top: 20px; }
.yvi-load-more[hidden] { display: none !important; }

/* Card — dark */
.yvi-card-wrap { animation: yvi-card-in 0.28s ease forwards; opacity: 0; transform: translateY(6px); }
@keyframes yvi-card-in { to { opacity: 1; transform: translateY(0); } }
.yvi-card {
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    position: relative;
}
.yvi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); border-color: rgba(255,255,255,0.14); }
.yvi-card-short { /* Shorts vertical emphasis */ }
.yvi-card-imported { opacity: 0.55; pointer-events: none; }
.yvi-card-imported .yvi-card-check { pointer-events: none; }
.yvi-card-selected { border-color: #111111 !important; box-shadow: 0 0 0 1px #111111 inset, 0 8px 24px rgba(0,0,0,0.08) !important; }
.yvi-card-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: #252525;
    overflow: hidden;
}
.yvi-card-short .yvi-card-thumb { aspect-ratio: 9/16; }
.yvi-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yvi-card-duration, .yvi-card-shorts-badge, .yvi-card-imported-badge {
    position: absolute;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}
.yvi-card-duration { bottom: 6px; right: 6px; background: rgba(0,0,0,0.78); color: #fff; }
.yvi-card-shorts-badge { top: 6px; left: 6px; background: #ff0000; color: #fff; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
.yvi-card-imported-badge { top: 6px; right: 6px; background: #111; color: #fff; }
.yvi-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s, background 0.18s;
}
.yvi-card:hover .yvi-card-overlay { opacity: 1; background: rgba(0,0,0,0.18); }
.yvi-card-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.yvi-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; background: #1a1a1a; }
.yvi-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: #f0f0f0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
}
.yvi-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #aaa;
    font-size: 12px;
}
.yvi-card-channel-avatar { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.yvi-card-channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yvi-card-stats {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #999;
    font-size: 11px;
}
.yvi-card-stats span { display: inline-flex; align-items: center; gap: 4px; }
.yvi-card-stats svg { opacity: 0.7; }
.yvi-card-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
}
.yvi-card-check { position: absolute; opacity: 0; pointer-events: none; }
.yvi-card-check-box {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    background: rgba(0,0,0,0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    backdrop-filter: blur(4px);
}
.yvi-card-check:checked + .yvi-card-check-box {
    background: #111111;
    border-color: #111111;
}
.yvi-card-check:checked + .yvi-card-check-box svg { opacity: 1; }
.yvi-card-check-box svg { opacity: 0; transition: opacity 0.15s; }

/* Skeleton — dark */
.yvi-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.yvi-skeleton-card {
    height: 220px;
    border-radius: 14px;
    background: linear-gradient(90deg, #1e1e1e 25%, #2a2a2a 37%, #1e1e1e 63%);
    background-size: 400% 100%;
    animation: yvi-skeleton 1.4s ease infinite;
    border: 1px solid rgba(255,255,255,0.06);
}
@keyframes yvi-skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Tray (sticky bottom) — ALWAYS pinned to the viewport. Uses
   `position: fixed` with `!important` so no parent transform/filter/
   will-change on the Hub or theme can break the containing block. */
.yvi-tray {
    position: fixed !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    left: 8px !important;
    right: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    background: #111111 !important;
    color: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55) !important;
    z-index: 2147483646 !important; /* near-max — above any theme/HUB modal */
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    box-sizing: border-box !important;
    min-height: 64px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    flex-wrap: wrap !important;
    overscroll-behavior: contain;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0); /* promote to its own layer — prevents iOS Safari from mis-anchoring */
    will-change: transform;
}
.yvi-tray-info { font-size: 13.5px !important; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.yvi-tray-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    flex: 1 1 auto !important;
    justify-content: flex-end !important;
    min-width: 0 !important;
}
.yvi-tray .yvi-btn {
    padding: 12px 18px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    height: 44px !important;
    min-height: 44px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    word-break: keep-all !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
}
.yvi-tray .yvi-btn-primary { background: #ffffff !important; color: #111111 !important; }
.yvi-tray .yvi-btn-primary:disabled { background: rgba(255,255,255,0.18) !important; color: rgba(255,255,255,0.55) !important; cursor: not-allowed !important; opacity: 0.6 !important; }
.yvi-tray .yvi-btn-ghost { background: rgba(255,255,255,0.06) !important; color: #ffffff !important; border-color: rgba(255,255,255,0.18) !important; }
.yvi-tray .yvi-btn-ghost:disabled { opacity: 0.4 !important; cursor: not-allowed !important; }
.yvi-tray .yvi-playlist-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    color: #fff !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    padding: 6px 10px !important;
    background: rgba(255,255,255,0.04) !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
}
.yvi-tray .yvi-playlist-toggle input { accent-color: #fff; width:16px; height:16px; }
.yvi-playlist-disabled-note { font-size: 12.5px; color: rgba(255,255,255,0.7); white-space: nowrap; flex: 0 0 auto; }
@media (min-width: 769px) {
    .yvi-tray {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) translateZ(0) !important;
        width: max-content !important;
        max-width: min(960px, calc(100vw - 16px)) !important;
        flex-wrap: nowrap !important;
    }
    .yvi-tray-actions { flex-wrap: nowrap !important; }
    .yvi-tray .yvi-btn { padding: 14px 22px !important; font-size: 15px !important; height: 48px !important; min-height: 48px !important; }
}
@media (max-width: 768px) {
    .yvi-tray { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 380px) {
    .yvi-tray { padding: 10px 12px; gap: 6px; }
    .yvi-tray .yvi-btn { padding: 10px 12px !important; font-size: 12.5px !important; height: 40px !important; min-height: 40px !important; }
    .yvi-tray .yvi-playlist-toggle { font-size: 12px !important; padding: 4px 8px !important; }
}

/* Playlist mode (Create new / Add to existing) */
.yvi-playlist-mode {
    display: inline-flex;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 14px;
    gap: 4px;
}
.yvi-playlist-mode-btn {
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s;
}
.yvi-playlist-mode-btn:hover { color: #fff; }
.yvi-playlist-mode-btn.active {
    background: #e8e8e8;
    color: #111;
}
.yvi-playlist-pane[hidden] { display: none !important; }
.yvi-existing-playlist-search {
    width: 100%;
    padding: 10px 14px;
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.yvi-existing-playlist-search:focus { outline:none; border-color: #444; box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
.yvi-existing-playlist-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px;
    background: #141414;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.yvi-existing-playlist-empty { font-size:12px; color: #888; padding: 14px; text-align:center; }
.yvi-existing-playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    color: #eaeaea;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
}
.yvi-existing-playlist-item:hover { border-color: rgba(255,255,255,0.18); background: #202020; }
.yvi-existing-playlist-item.active { border-color: #fff; background: #2a2a2a; }
.yvi-existing-playlist-thumb {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: #252525 center/cover no-repeat;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #888;
}
.yvi-existing-playlist-thumb-fallback { font-size: 16px; }
.yvi-existing-playlist-info { flex: 1; min-width: 0; }
.yvi-existing-playlist-title { font-size: 13px; font-weight: 600; color: #fff; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yvi-existing-playlist-meta { font-size: 11px; color: #888; display: block; margin-top: 2px; }
.yvi-existing-playlist-selected { margin-top: 10px; font-size: 12.5px; color: #cfcfcf; background: #1a1a1a; border:1px solid rgba(255,255,255,0.08); border-radius:8px; padding:8px 12px; display:flex; align-items:center; gap:8px; }
.yvi-existing-playlist-selected strong { color:#fff; }
.yvi-existing-playlist-clear { margin-left:auto; background:transparent; border:0; color:#aaa; cursor:pointer; font-size:18px; line-height:1; }
.yvi-existing-playlist-clear:hover { color:#fff; }

/* Modals — dark */
.yvi-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(2px);
    z-index: 50;
}
.yvi-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    z-index: 51;
    display: flex;
    flex-direction: column;
}
.yvi-modal[hidden] { display: none !important; }
.yvi-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    background: #1a1a1a;
    border-radius: 16px 16px 0 0;
}
.yvi-modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: #fff; }
.yvi-modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: #2a2a2a;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.yvi-modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.yvi-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: #141414;
    border-radius: 0 0 16px 16px;
    position: sticky;
    bottom: 0;
}
.yvi-form-section { background: #141414; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 14px; }
.yvi-form-section-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: #fff; }
.yvi-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .yvi-form-grid { grid-template-columns: 1fr; } }
.yvi-field label { display: block; font-size: 12px; font-weight: 600; color: #ccc; margin-bottom: 6px; }
.yvi-field input, .yvi-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: #222;
    color: #fff;
    font-size: 13px;
    outline: none;
}
.yvi-field input:focus, .yvi-field select:focus { border-color: #555; box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
.yvi-selected-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 180px; overflow: auto; }
.yvi-selected-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #222;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}
.yvi-selected-thumb { width: 48px; height: 28px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.yvi-selected-title { flex: 1; font-size: 12px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yvi-selected-badge { padding: 2px 6px; border-radius: 999px; background: #ff0000; color: #fff; font-size: 10px; font-weight: 700; }
.yvi-selected-remove {
    width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.12);
    background: #2a2a2a; color: #ccc; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.yvi-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #ccc; cursor: pointer; }
.yvi-progress { display: flex; flex-direction: column; gap: 10px; }
.yvi-progress-track { height: 8px; background: #2a2a2a; border-radius: 999px; overflow: hidden; }
.yvi-progress-bar { height: 100%; background: #ffffff; border-radius: 999px; transition: width 0.22s; }
.yvi-progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: #aaa; }
.yvi-progress-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.yvi-progress-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    font-size: 13px;
    color: #fff;
}
.yvi-progress-item.yvi-progress-created { border-color: rgba(74,222,128,0.3); background: rgba(34,197,94,0.08); }
.yvi-progress-item.yvi-progress-error { border-color: rgba(248,113,113,0.3); background: rgba(239,68,68,0.08); }

/* Hub dark theme — keep yvi-page dark when embedded */
.mshub-dashboard .yvi-page,
.mshub-dashboard .yvi-page * {
    color: #eaeaea;
}
.mshub-dashboard .yvi-page .yvi-card-title { color: #f0f0f0; }
.mshub-dashboard .yvi-page .yvi-card-meta { color: #aaa; }
.mshub-dashboard .yvi-page .yvi-card-stats { color: #999; }
.yvi-modal-open { overflow: hidden; }
