/* ==========================================================================
   LIVE WINDOW MANAGER CSS v5
   #live-outer-controls → POZA #app-container, w czarnym obszarze ekranu
   ========================================================================== */

/* ========================================================================
   OUTER CONTROLS CONTAINER
   Dołączony do document.body, pozycjonowany dynamicznie przez JS
   w czarnym obszarze poza skalowanym 1920x1080 kontenerem.
   Niewidoczny dla widza podczas nadawania (poza obszarem OBS capture).
   ======================================================================== */
.live-outer-controls {
    position: fixed;      /* JS nadpisuje top/left przez updateOuterControlsPosition() */
    z-index: 9999999;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    pointer-events: auto;
    /* Subtelne oznaczenie obszaru operatora */
    background: rgba(6, 8, 16, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 16px;
    padding: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.8);
    max-width: 520px;
    flex-wrap: wrap;
}

/* Etykieta "OPERATOR" w rogu - widoczna tylko lokalnie */
.live-outer-controls::before {
    content: '🎛 PANEL OPERATORA';
    position: absolute;
    top: -22px;
    left: 0;
    font-size: 0.62rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: rgba(212, 175, 55, 0.6);
    white-space: nowrap;
    text-transform: uppercase;
}

/* ========================================================================
   MINIMIZED DOCK (wewnątrz .live-outer-controls)
   ======================================================================== */
.live-minimized-dock {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Round icon button */
.live-dock-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(18,22,36,0.97), rgba(8,10,18,0.97));
    border: 2px solid rgba(212,175,55,0.75);
    color: #d4af37;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 14px rgba(0,0,0,0.85), 0 0 10px rgba(212,175,55,0.2);
    transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
    animation: dockIconPop 0.35s cubic-bezier(0.16,1,0.3,1);
    padding: 0;
}

@keyframes dockIconPop {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

.live-dock-btn:hover {
    background: #d4af37;
    color: #000;
    border-color: #fff;
    transform: scale(1.2);
    box-shadow: 0 8px 24px rgba(212,175,55,0.9);
}

/* Tooltip */
.live-dock-btn::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(12,14,24,0.97);
    color: #f3e5ab;
    border: 1px solid rgba(212,175,55,0.5);
    border-radius: 7px;
    padding: 4px 10px;
    font-family: 'Montserrat','Outfit',sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.7);
}

.live-dock-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================================================
   GLOBAL BG BUTTON (wewnątrz .live-outer-controls, brak position:fixed)
   ======================================================================== */
.live-bg-global-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(18,22,36,0.97), rgba(8,10,18,0.97));
    border: 2px solid rgba(212,175,55,0.75);
    color: #d4af37;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.85), 0 0 14px rgba(212,175,55,0.25);
    transition: all 0.25s ease;
    flex-shrink: 0;
    padding: 0;
}

.live-bg-global-btn:hover {
    background: #d4af37;
    color: #000;
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 0 24px rgba(212,175,55,0.9);
}

/* ========================================================================
   BG PICKER PANEL (wewnątrz .live-outer-controls, position:relative)
   ======================================================================== */
.live-bg-picker-panel {
    position: absolute;
    z-index: 99999;
    width: 480px;
    max-width: calc(100vw - 30px);
    max-height: 560px;
    overflow-y: auto;
    background: linear-gradient(160deg, rgba(12,14,24,0.98) 0%, rgba(6,8,16,0.99) 100%);
    border: 1.5px solid rgba(212,175,55,0.45);
    border-radius: 18px;
    padding: 18px 20px 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.95), 0 0 30px rgba(212,175,55,0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-family: 'Montserrat','Outfit',sans-serif;
    color: #f3e5ab;
    animation: bgPanelIn 0.3s cubic-bezier(0.16,1,0.3,1);
}

@keyframes bgPanelIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bg-picker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #d4af37;
    border-bottom: 1px solid rgba(212,175,55,0.2);
    padding-bottom: 10px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.bg-picker-close {
    margin-left: auto;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    color: #f3e5ab;
    width: 26px; height: 26px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
}
.bg-picker-close:hover { background: #d4af37; color: #000; }

.bg-picker-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(212,175,55,0.75);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.bg-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}

.bg-preset-tile {
    aspect-ratio: 16/9;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.bg-preset-tile span {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 3px 5px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    font-size: 0.62rem; font-weight: 700; color: #fff;
    text-align: center; font-family: 'Montserrat', sans-serif;
}
.bg-preset-tile:hover  { border-color: #d4af37; transform: scale(1.05); box-shadow: 0 0 14px rgba(212,175,55,0.7); }
.bg-preset-tile.active { border-color: #d4af37; box-shadow: 0 0 18px rgba(212,175,55,0.9); }

.bg-picker-color-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.bg-color-input { width: 48px; height: 32px; border-radius: 7px; border: 1.5px solid rgba(212,175,55,0.5); cursor: pointer; background: none; padding: 2px; }
.bg-picker-color-row label { font-size: 0.78rem; color: rgba(243,229,171,0.75); }

.bg-picker-url-row { display: flex; gap: 7px; margin-bottom: 4px; }
.bg-url-input { flex:1; background: rgba(255,255,255,0.05); border: 1.5px solid rgba(212,175,55,0.3); border-radius: 8px; color:#f3e5ab; padding:7px 10px; font-size:0.76rem; font-family:'Montserrat',sans-serif; outline:none; transition:border-color 0.2s; }
.bg-url-input:focus { border-color: #d4af37; }
.bg-url-apply-btn { background:rgba(212,175,55,0.15); border:1.5px solid rgba(212,175,55,0.5); color:#d4af37; padding:7px 12px; border-radius:8px; cursor:pointer; font-weight:700; font-size:0.76rem; transition:all 0.2s; white-space:nowrap; }
.bg-url-apply-btn:hover { background:#d4af37; color:#000; }

.bg-file-pick-btn { display:inline-flex; align-items:center; gap:7px; background:rgba(100,149,237,0.13); border:1.5px solid rgba(100,149,237,0.45); color:#8ab4f8; padding:7px 14px; border-radius:8px; cursor:pointer; font-weight:700; font-size:0.76rem; font-family:'Montserrat',sans-serif; transition:all 0.2s; white-space:nowrap; user-select:none; }
.bg-file-pick-btn:hover { background:rgba(100,149,237,0.3); color:#fff; border-color:#8ab4f8; box-shadow:0 0 12px rgba(100,149,237,0.5); }
.bg-file-pick-name { flex:1; font-size:0.72rem; color:rgba(243,229,171,0.55); font-style:italic; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; align-self:center; }

.bg-video-capture-btn { width:100%; background:rgba(220,20,60,0.12); border:1.5px solid rgba(220,20,60,0.4); color:#ff6b8a; padding:9px 14px; border-radius:9px; cursor:pointer; font-weight:700; font-size:0.78rem; font-family:'Montserrat',sans-serif; display:flex; align-items:center; justify-content:center; gap:7px; transition:all 0.2s; margin-top:4px; }
.bg-video-capture-btn:hover { background:#dc143c; color:#fff; border-color:#dc143c; box-shadow:0 0 16px rgba(220,20,60,0.6); }

/* ========================================================================
   WINDOW CARD — kontrolki wewnątrz #app-container
   ======================================================================== */
.live-window-card { position: relative; }

.live-win-controls {
    position: absolute;
    top: 10px; right: 12px;
    z-index: 99999;
    display: flex; gap: 8px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(-4px);
}
.live-window-card:hover > .live-win-controls,
#livePrayerOverlay:hover > .live-win-controls {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0);
}

.live-win-btn {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: rgba(12,14,24,0.92);
    border: 1.5px solid rgba(212,175,55,0.65);
    color: #f3e5ab;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.6);
    padding: 0;
}
.live-win-btn:hover { background: #d4af37; color: #000; transform: scale(1.12); box-shadow: 0 0 16px rgba(212,175,55,0.8); }
.live-win-btn.drag-handle        { cursor: grab; }
.live-win-btn.drag-handle:active { cursor: grabbing; }

.live-window-card.is-dragging,
.live-window-card.is-resizing {
    box-shadow: 0 0 30px rgba(212,175,55,0.5), 0 16px 36px rgba(0,0,0,0.85) !important;
    z-index: 99999 !important;
}

.live-win-resize-handle {
    position: absolute; bottom: 4px; right: 4px;
    width: 24px; height: 24px;
    z-index: 99998;
    display: flex; align-items: center; justify-content: center;
    color: rgba(212,175,55,0.85); font-size: 0.68rem;
    cursor: nwse-resize;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease, transform 0.2s ease;
    border-radius: 6px;
    background: rgba(12,14,24,0.88);
    border-right: 2px solid rgba(212,175,55,0.9);
    border-bottom: 2px solid rgba(212,175,55,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.live-window-card:hover > .live-win-resize-handle,
#livePrayerOverlay:hover > .live-win-resize-handle {
    opacity: 1 !important;
    pointer-events: auto !important;
}
.live-win-resize-handle:hover { color:#000; background:#d4af37; border-color:#fff; transform:scale(1.18); }

.live-win-minimized { display: none !important; }

/* ========================================================================
   QR SIDECAR — specjalne reguły
   Sidecar normalnie ma opacity:0 i pointer-events:none (ukryty).
   Kontrolki okna muszą być dostępne ZAWSZE dla operatora —
   wymuszamy widoczność przy hover niezależnie od stanu .active.
   ======================================================================== */
.qr-sidecar.live-window-card {
    /* Kontrolki muszą wystawac poza overflow:hidden rodzica */
    overflow: visible !important;
}

/* Gdy operator najedzie na sidecar, force-show kontrolki */
.qr-sidecar.live-window-card:hover {
    /* Tymczasowo aktywuj pointer-events żeby chwytać hover */
    pointer-events: auto !important;
    opacity: 0.92 !important;
    z-index: 99 !important;
}

.qr-sidecar.live-window-card:hover > .live-win-controls,
.qr-sidecar.live-window-card:hover > .live-win-resize-handle {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0);
}

/* ========================================================================
   SHOP AD SIDECAR / WIDGET
   ======================================================================== */
.shop-sidecar {
    width: 250px;
    background: rgba(12, 14, 24, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(212, 175, 55, 0.45);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    overflow: visible;
}

.shop-sidecar:hover {
    border-color: rgba(212, 175, 55, 0.85);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 30px rgba(212, 175, 55, 0.35);
}

.shop-sidecar-link {
    display: block;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    position: relative;
}

.shop-sidecar-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.shop-sidecar-link:hover .shop-sidecar-img {
    transform: scale(1.04);
}

.shop-sidecar-badge {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(12, 14, 24, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.7);
    color: #d4af37;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.7);
    pointer-events: none;
    transition: all 0.25s ease;
}

.shop-sidecar-link:hover .shop-sidecar-badge {
    background: #d4af37;
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
}

