/**
 * media-panel.css — Стили гласоморфной выезжающей медиа-панели
 */

/* ── Backdrop (полупрозрачное затемнение слева) ──────────────────────────── */
.msp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.35s ease;
}

/* ── Панель (drawer) ─────────────────────────────────────────────────────── */
.msp-panel {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.msp-panel--visible .msp-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.msp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 95vw);
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(10, 10, 20, 0.98) 0%, rgba(20, 15, 35, 0.99) 100%);
    border-left: 1px solid rgba(129, 140, 248, 0.2);
    box-shadow:
        -20px 0 60px rgba(0, 0, 0, 0.6),
        -4px 0 16px rgba(129, 140, 248, 0.08),
        inset 1px 0 0 rgba(255, 255, 255, 0.04);
    transform: translateX(110%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    z-index: 2;
}

.msp-panel--visible .msp-drawer {
    transform: translateX(0);
    pointer-events: auto;
}

.msp-panel--hidden .msp-drawer {
    transform: translateX(110%);
}

/* Fullscreen (Мои видео → клик по ролику) */
.msp-panel--fullscreen .msp-drawer {
    left: 0;
    right: 0;
    width: 100vw;
    max-width: none;
    border-left: none;
    transform: translateY(110%);
}

.msp-panel--fullscreen.msp-panel--visible .msp-drawer {
    transform: translateY(0);
}

.msp-panel--fullscreen.msp-panel--hidden .msp-drawer {
    transform: translateY(110%);
}

.msp-panel--fullscreen .msp-content {
    justify-content: center;
    padding: 8px 16px 16px;
}

.msp-panel--fullscreen .msp-video-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 12px;
}

.msp-panel--fullscreen .msp-video-player {
    flex: 1;
    padding-top: 0;
    min-height: min(70vh, calc(100vh - 140px));
    max-height: calc(100vh - 140px);
}

/* ── Шапка ───────────────────────────────────────────────────────────────── */
.msp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: linear-gradient(
        180deg,
        rgba(99, 102, 241, 0.08) 0%,
        transparent 100%
    );
}

.msp-header-icon {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.6));
}

.msp-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msp-close-btn,
.msp-minimize-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.msp-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(129, 140, 248, 0.4);
    transform: rotate(90deg);
}

.msp-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(129, 140, 248, 0.4);
}

.msp-close-btn .material-symbols-outlined,
.msp-minimize-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ── Контент-область ─────────────────────────────────────────────────────── */
.msp-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(129, 140, 248, 0.3) transparent;
}

.msp-content::-webkit-scrollbar { width: 4px; }
.msp-content::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.3);
    border-radius: 2px;
}

/* ── Видео-карточка ──────────────────────────────────────────────────────── */
.msp-video-card {
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s;
}

.msp-video-card:hover {
    border-color: rgba(129, 140, 248, 0.3);
}

.msp-video-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 11px;
}

.msp-video-player {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #0a0a1a;
}

.msp-video-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.msp-preview-card--thumb {
    display: block;
    padding: 0;
    overflow: hidden;
}

.msp-preview-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0a0a1a;
}

.msp-preview-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.msp-preview-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    background: rgba(0, 0, 0, 0.35);
}

.msp-preview-card--thumb .msp-preview-info {
    padding: 12px 14px;
}

.msp-video-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: rgba(129, 140, 248, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.msp-video-link:hover {
    color: #a5b4fc;
    background: rgba(129, 140, 248, 0.05);
}

.msp-video-link .material-symbols-outlined {
    font-size: 16px;
}

/* ── Превью-карточка (платформы без embed) ───────────────────────────────── */
.msp-preview-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.2s;
}

.msp-preview-card:hover {
    background: rgba(129, 140, 248, 0.07);
    border-color: rgba(129, 140, 248, 0.25);
    transform: translateX(-2px);
}

.msp-preview-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.msp-preview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msp-preview-platform {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.msp-preview-action {
    font-size: 13px;
    color: rgba(129, 140, 248, 0.7);
}

/* ── Сетка изображений ───────────────────────────────────────────────────── */
.msp-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.msp-image-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
    display: block;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.25s ease;
    text-decoration: none;
}

.msp-image-card:hover {
    border-color: rgba(129, 140, 248, 0.35);
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.msp-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.msp-image-card:hover img {
    transform: scale(1.08);
}

.msp-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Подвал ──────────────────────────────────────────────────────────────── */
.msp-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.msp-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 0.03em;
}

/* ── Свёрнутый режим (PIP-стиль) ─────────────────────────────────────────── */
/* Backdrop пропадает — пользователь может взаимодействовать с остальным UI */
.msp-panel--minimized .msp-backdrop {
    opacity: 0;
    pointer-events: none;
}

/* Drawer сжимается в плашку справа снизу (desktop) или внизу шириной экрана (mobile) */
.msp-panel--minimized .msp-drawer {
    top: auto;
    bottom: 20px;
    right: 20px;
    width: min(320px, 90vw);
    height: 64px;
    border-radius: 16px;
    border-left: 1px solid rgba(129, 140, 248, 0.25);
    border-top: 1px solid rgba(129, 140, 248, 0.25);
    cursor: pointer;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(129, 140, 248, 0.15);
    /* Перекрываем transform: translateX(0) из .msp-panel--visible — иначе зависает */
    transform: none;
}

.msp-panel--minimized .msp-header {
    padding: 14px 16px;
    border-bottom: none;
    background: transparent;
    height: 100%;
}

.msp-panel--minimized .msp-title {
    font-size: 13px;
}

.msp-panel--minimized .msp-content,
.msp-panel--minimized .msp-footer {
    display: none;
}

.msp-panel--minimized .msp-minimize-btn {
    /* Кнопка остаётся видна — но клик по плашке тоже разворачивает */
    width: 28px;
    height: 28px;
}

.msp-panel--minimized .msp-close-btn {
    width: 28px;
    height: 28px;
}

/* ── Мобильная адаптация ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .msp-drawer {
        width: 100vw;
        border-left: none;
        border-top: 1px solid rgba(129, 140, 248, 0.2);
        border-radius: 20px 20px 0 0;
        top: auto;
        height: 80vh;
        transform: translateY(110%);
    }

    .msp-panel--visible .msp-drawer {
        transform: translateY(0);
    }

    .msp-panel--hidden .msp-drawer {
        transform: translateY(110%);
    }

    .msp-image-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* На мобиле свёрнутая плашка — внизу на всю ширину (минус отступы) */
    .msp-panel--minimized .msp-drawer {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        border-radius: 14px;
        /* Перекрываем translateY(0) из .msp-panel--visible на мобиле */
        transform: none;
    }
}
