/* =========================================
   1. ПОСТЕРЫ, ТЕКСТ И ГРАДИЕНТЫ В ЛЕНТЕ
   ========================================= */
.poster-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; z-index: 2; transition: opacity 0.4s ease-out; background-color: #111; }
.overlay-gradient { position: absolute; bottom: 0; left: 0; width: 100%; height: 60%; background: var(--overlay-gradient); z-index: 3; pointer-events: none; }

.movie-info { position: absolute; bottom: calc(var(--safe-bottom) + 15px); left: 20px; right: 80px; z-index: 4; pointer-events: auto; cursor: pointer; }
.movie-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; text-shadow: 0 2px 10px rgba(0,0,0,0.8); line-height: 1.1; }
.movie-meta { display: flex; gap: 12px; align-items: center; font-size: 14px; font-weight: 600; color: #ddd; margin-bottom: 12px; }
.rating { background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); color: #fff; padding: 4px 10px; border-radius: 8px; display: flex; align-items: center; gap: 4px; border: 1px solid var(--glass-border); }
.rating svg { width: 14px; height: 14px; fill: #f5c518; }
.movie-desc { font-size: 14px; line-height: 1.5; color: #ccc; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.more-hint { font-size: 13px; color: rgba(255,255,255,0.6); margin-top: 4px; font-weight: 500;}

.yt-fallback-msg {
    display: none; 
    position: absolute; 
    top: 25%; left: 20px; right: 80px; 
    background: rgba(20, 20, 20, 0.85); color: #fff; padding: 20px; border-radius: 18px;
    z-index: 10; border: 1px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); 
    text-align: center; flex-direction: column; align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
body.yt-blocked .yt-fallback-msg { display: flex !important; }

/* =========================================
   2. КНОПКИ ДЕЙСТВИЙ (Справа и сверху)
   ========================================= */
.actions { position: absolute; bottom: calc(var(--safe-bottom) + 15px); right: 15px; z-index: 4; display: flex; flex-direction: column; gap: 15px; align-items: center; }
.action-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; pointer-events: auto; }
.action-btn { width: 48px; height: 48px; background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-radius: 16px; display: flex; justify-content: center; align-items: center; border: 1px solid var(--glass-border); transition: background 0.2s, transform 0.1s; }
.action-btn:active { transform: scale(0.9); }
.action-btn svg { width: 24px; height: 24px; fill: #fff; transition: fill 0.3s; }

.top-actions { position: fixed; top: var(--safe-top); right: 20px; z-index: 50; display: flex; gap: 10px; align-items: center; }
.top-left-actions { position: fixed; top: var(--safe-top); left: 20px; z-index: 50; display: flex; gap: 10px; align-items: center; }
.top-btn { width: 44px; height: 44px; background: rgba(0,0,0,0.5); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-radius: 14px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: transform 0.1s; position: relative; }
.top-btn:active { transform: scale(0.9); }
.top-btn svg { width: 22px; height: 22px; fill: #fff; }

/* =========================================
   3. УВЕДОМЛЕНИЯ И НОВЫЙ ЛОАДЕР (ЛОГОТИП)
   ========================================= */
#toast-container { position: fixed; top: max(20px, env(safe-area-inset-top)); right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(20, 20, 20, 0.95); color: #fff; padding: 12px 20px; border-radius: 12px; border-left: 4px solid var(--accent); font-size: 14px; font-weight: 500; box-shadow: 0 4px 15px rgba(0,0,0,0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; pointer-events: auto; }
.toast-fadeOut { animation: fadeOutRight 0.3s ease forwards; }

/* Новый красивый лоадер */
#status-msg { 
    position: fixed; z-index: 999999; top: 50%; left: 50%; 
    transform: translate(-50%, -50%); 
    display: flex; flex-direction: column; align-items: center; gap: 15px; 
    transition: opacity 0.3s; pointer-events: none; 
}
.pulsing-logo { 
    width: 80px; height: 80px; 
    border-radius: 50%; 
    animation: pulseLogo 1.5s ease-in-out infinite; 
    box-shadow: 0 0 20px rgba(229,9,20,0.6); 
}
@keyframes pulseLogo { 
    0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 20px rgba(229,9,20,0.4); } 
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 50px rgba(229,9,20,0.8); } 
    100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 20px rgba(229,9,20,0.4); } 
}

/* =========================================
   4. МОДАЛЬНЫЕ ОКНА И БОТТОМШИТЫ
   ========================================= */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.overlay.active { opacity: 1; pointer-events: auto; }

.bottom-sheet { position: fixed; bottom: 0; left: 0; width: 100%; background: #151515; border-radius: 24px 24px 0 0; z-index: 101; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1); padding-bottom: var(--safe-bottom); }
.bottom-sheet.active { transform: translateY(0); }
.sheet-drag-handle { width: 40px; height: 5px; background: #444; border-radius: 3px; margin: 12px auto; }
.sheet-content { position: relative; padding: 10px 20px 20px 20px; max-height: 80vh; overflow-y: auto; overscroll-behavior-y: contain; }

.sheet-close-btn { position: absolute; top: 20px; right: 20px; width: 36px; height: 36px; background: #222; border-radius: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: background 0.2s; }
.sheet-close-btn:hover { background: #333; }
.sheet-close-btn svg { width: 14px; height: 14px; fill: #fff; }

#match-name-input, #join-room-name-input { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(0,0,0,0.5); color: #fff; font-size: 15px; outline: none; transition: 0.2s; box-sizing: border-box; }
#match-name-input:focus, #join-room-name-input:focus { border-color: var(--accent); box-shadow: 0 0 10px rgba(229,9,20,0.3); }

.watch-providers { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
.provider-btn { display: flex; justify-content: center; align-items: center; padding: 16px; border-radius: 14px; font-size: 16px; font-weight: 700; text-decoration: none; text-align: center; transition: transform 0.1s; cursor: pointer; border: none; }
.provider-btn:active { transform: scale(0.97); }
.premium-btn { background: var(--accent); color: #fff; }
.free-btn { background: #2a2a2a; color: #fff; border: 1px solid #444; }

/* =========================================
   5. ФИЛЬТРЫ
   ========================================= */
.filter-chip { padding: 8px 14px; border-radius: 20px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #ccc; font-size: 14px; cursor: pointer; transition: 0.2s; user-select: none; }
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* =========================================
   6. ПОЛНОЭКРАННЫЕ ОКНА И АНИМАЦИИ
   ========================================= */
.fullscreen-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0a0a0a; z-index: 105; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1); overflow-y: auto; padding-bottom: var(--safe-bottom); display: flex; flex-direction: column; }
.fullscreen-modal.active { transform: translateY(0); }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: calc(15px + var(--safe-top)) 20px 15px 20px; border-bottom: 1px solid #222; background: #0a0a0a; position: sticky; top: 0; z-index: 10; margin-top: 0;}
.modal-close { width: 40px; height: 40px; background: #222; border-radius: 14px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: background 0.2s; }
.modal-close:hover { background: #333; }
.modal-close svg { width: 24px; height: 24px; fill: #fff; }

.watchlist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 15px; }
.watchlist-item { aspect-ratio: 2/3; background-size: cover; background-position: center; border-radius: 12px; cursor: pointer; border: 1px solid rgba(255,255,255,0.1); }

#match-celebration-modal { animation: fadeInMatch 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes fadeInMatch { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideInRight { 0% { transform: translateX(120%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutRight { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(120%); opacity: 0; } }

/* =========================================
   7. ДЕСКТОП: САЙДБАРЫ ВМЕСТО БОТТОМШИТОВ
   ========================================= */
@media (min-width: 768px) {
    .bottom-sheet { top: 0; right: 0; bottom: 0; left: auto; width: 450px; height: 100dvh; max-height: 100dvh; border-radius: 24px 0 0 24px; transform: translateX(100%); border-left: 1px solid rgba(255,255,255,0.1); }
    .bottom-sheet.active { transform: translateX(0); }
    .bottom-sheet.left-sidebar { left: 0; right: auto; border-right: 1px solid rgba(255,255,255,0.1); border-left: none; border-radius: 0 24px 24px 0; transform: translateX(-100%); }
    .bottom-sheet.left-sidebar.active { transform: translateX(0); }
    .sheet-drag-handle { display: none; }
    .sheet-content { height: 100%; max-height: 100%; padding: 40px 30px; }
    .watchlist-grid { width: 100%; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-width: 1400px; margin: 0 auto; gap: 20px; padding: 30px; }
    .watchlist-item { border-radius: 16px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
    .watchlist-item:hover { transform: scale(1.05) translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.8); }
}
