/* ==========================================================================
   YouTube Video Player & Mini Media Player Styles (qr_audio_player.css)
   Sayfa işaretlerini koruyan, videolarda birebir YouTube oynatıcı arayüzü
   ========================================================================== */

/* Overlay Arka Plan */
#qr-radio-player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483690 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
    padding: 16px;
    pointer-events: none;
}

/* Video modunda tam ekran koyu karartmalı modal */
#qr-radio-player-overlay.is-active.is-video-mode {
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Ses modunda şeffaf arka plan - sayfayı, çizimleri ve etkileşimleri ASLA engellemez */
#qr-radio-player-overlay.is-active.is-audio-mode {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1;
    visibility: visible;
    pointer-events: none !important;
    display: block !important;
}

/* Varsayılan fallback */
#qr-radio-player-overlay.is-active:not(.is-audio-mode) {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Video oynatıcı açıkken sayfadaki tuval ve arka plan tıklamalarını kilitle (Ses modunda kitlemez!) */
body.qr-video-active #page-target-overlay,
body.qr-video-active #drawing-canvas,
body.qr-video-active canvas,
body.qr-video-active .interaction-zone:not(.qr-audio-hotspot),
body.qr-video-active .interaction-item,
body.qr-video-active [id^="p8-"],
body.qr-video-active [id^="p10-"],
body.qr-video-active [id^="p11-"],
body.qr-video-active [id^="p14-"],
body.qr-video-active [id^="match-"],
body.qr-video-active svg.interaction-svg {
    pointer-events: none !important;
}

/* ==========================================================================
   ANA OYNATICI KARTI (Base Container)
   ========================================================================== */
.mini-media-player {
    position: relative;
    background: #0f0f0f;
    color: #ffffff;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", Arial, sans-serif;
    z-index: 2147483695 !important;
    pointer-events: auto !important;
    transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* ==========================================================================
   1. YOUTUBE VİDEO OYNATICI EKRANI (is-youtube-video)
   ========================================================================== */
.mini-media-player.is-youtube-video {
    width: min(840px, 94vw);
    max-width: 94vw;
    border-radius: 12px;
    overflow: hidden;
    background: #000000;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.9), 0 6px 20px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
}

/* Video Viewport 16:9 */
.mini-media-player.is-youtube-video .yt-video-viewport {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 75vh;
    background: #000000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mini-media-player.is-youtube-video .yt-video-viewport video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000000;
}

/* YouTube Header (Top Overlay) */
.mini-media-player.is-youtube-video .yt-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 10px 16px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 25;
    box-sizing: border-box;
    transition: opacity 0.25s ease-out;
}

.yt-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

/* YouTube Logo Badge */
.yt-logo-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

.yt-logo-svg {
    display: block;
    flex-shrink: 0;
}

.yt-logo-text {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: #ffffff;
    font-family: "YouTube Sans", Roboto, sans-serif;
    line-height: 1;
}

.yt-title-container {
    min-width: 0;
    flex: 1;
}

.yt-video-title,
.mini-player-title.yt-title {
    font-size: 14px;
    font-weight: 500;
    color: #f1f1f1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.yt-video-subtitle,
.mini-player-subtitle.yt-subtitle {
    font-size: 11px;
    color: #aaaaaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* YouTube Kapat Butonu */
.yt-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    color: #ffffff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.yt-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

/* Center Big Play Button (YouTube Classic) */
.yt-center-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    background: rgba(0, 0, 0, 0.15);
    pointer-events: auto;
}

.yt-big-play-icon {
    width: 68px;
    height: 48px;
    cursor: pointer;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.yt-big-play-icon:hover {
    transform: scale(1.15);
}

.yt-big-play-icon svg {
    display: block;
}

/* Tap Feedback Pulse */
.yt-tap-feedback {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 22;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.6);
}

.yt-tap-feedback.is-animating {
    animation: yt-tap-pulse 0.45s ease-out forwards;
}

@keyframes yt-tap-pulse {
    0% {
        opacity: 0.9;
        transform: scale(0.8);
    }
    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}

/* ==========================================================================
   YOUTUBE ALT KONTROL ÇUBUĞU (yt-bottom-bar)
   ========================================================================== */
.mini-media-player.is-youtube-video .yt-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
    padding: 0 14px 8px;
    z-index: 25;
    box-sizing: border-box;
    transition: opacity 0.25s ease-out;
}

/* Kırmızı Arama / İlerleme Çubuğu (YouTube Red Scrubber) */
.yt-progress-container {
    width: 100%;
    height: 18px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.yt-progress-rail {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    position: relative;
    transition: height 0.12s ease;
}

.yt-progress-container:hover .yt-progress-rail {
    height: 6px;
}

.yt-progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 2px;
    pointer-events: none;
}

.yt-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #FF0000;
    border-radius: 2px;
    pointer-events: none;
}

.yt-scrubber-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 13px;
    height: 13px;
    background: #FF0000;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.12s ease;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.yt-progress-container:hover .yt-scrubber-handle,
.mini-media-player.is-dragging-track .yt-scrubber-handle {
    transform: translate(-50%, -50%) scale(1);
}

/* Kontrol Butonları Satırı */
.yt-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 42px;
    width: 100%;
}

.yt-controls-left,
.yt-controls-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.yt-btn {
    background: none;
    border: none;
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.yt-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.yt-btn:active {
    transform: scale(0.92);
}

.yt-btn svg {
    display: block;
    fill: #ffffff;
}

/* Ses Seviyesi Kutusu ve Slider */
.yt-volume-box {
    display: flex;
    align-items: center;
}

.yt-volume-slider-wrap {
    width: 0px;
    overflow: hidden;
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), margin 0.22s ease;
    display: flex;
    align-items: center;
    margin-left: 0;
}

.yt-volume-box:hover .yt-volume-slider-wrap {
    width: 65px;
    margin-left: 4px;
    margin-right: 6px;
}

.yt-volume-slider {
    width: 60px;
    height: 4px;
    accent-color: #FF0000;
    cursor: pointer;
}

/* Süre Göstergesi */
.yt-time-display {
    font-size: 12px;
    color: #dddddd;
    font-family: Roboto, Arial, sans-serif;
    margin-left: 8px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.yt-time-sep {
    color: #888888;
    margin: 0 4px;
}

/* CC ve Ayarlar Badge */
.yt-badge-cc {
    font-size: 10px;
    font-weight: 800;
    border: 1.5px solid #ffffff;
    border-radius: 3px;
    padding: 1px 3px;
    line-height: 1;
    color: #ffffff;
    letter-spacing: 0.5px;
}

/* Autohide - Kontroller Gizlendiğinde */
.mini-media-player.is-youtube-video.yt-controls-hidden {
    cursor: none;
}

.mini-media-player.is-youtube-video.yt-controls-hidden .yt-header,
.mini-media-player.is-youtube-video.yt-controls-hidden .yt-bottom-bar,
.mini-media-player.is-youtube-video.yt-controls-hidden .yt-center-play-overlay {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   2. TAM EKRAN (Fullscreen) MODU
   ========================================================================== */
.mini-media-player.is-fullscreen,
.mini-media-player:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.mini-media-player.is-fullscreen .yt-video-viewport,
.mini-media-player:fullscreen .yt-video-viewport {
    width: 100vw !important;
    height: 100vh !important;
    aspect-ratio: auto !important;
    max-height: 100vh !important;
}

/* ==========================================================================
   3. KOMPAKT SES MODU (is-audio-only)
   Kitabın hemen altında, kırmızı işaretli bölgede yatay kapsül oynatıcı
   ========================================================================== */
.mini-media-player.is-audio-only {
    position: fixed !important;
    left: 50% !important;
    bottom: 12px !important;
    transform: translateX(-50%) !important;
    width: min(450px, 92vw) !important;
    max-width: 92vw !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 20px !important;
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.16) !important;
    padding: 7px 14px 9px 14px !important;
    z-index: 2147483700 !important;
    pointer-events: auto !important;
    touch-action: none;
    margin: 0 !important;
    box-sizing: border-box !important;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#qr-radio-player-overlay.is-active .mini-media-player.is-audio-only {
    opacity: 1 !important;
    visibility: visible !important;
}

.mini-media-player.is-audio-only .yt-video-viewport {
    display: none !important;
}

.mini-media-player.is-audio-only .yt-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 4px !important;
    gap: 8px !important;
    cursor: grab;
}

.mini-media-player.is-audio-only .yt-header:active {
    cursor: grabbing;
}

.mini-media-player.is-audio-only .yt-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    min-width: 0 !important;
    flex: 1 !important;
}

.mini-media-player.is-audio-only .mini-player-icon {
    font-size: 15px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.mini-media-player.is-audio-only .yt-title-container {
    min-width: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1px !important;
}

.mini-media-player.is-audio-only .mini-player-title {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #f8fafc !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.mini-media-player.is-audio-only .mini-player-subtitle {
    font-size: 10.5px !important;
    color: #94a3b8 !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.mini-media-player.is-audio-only .yt-close-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    color: #cbd5e1 !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.15s, transform 0.15s !important;
    padding: 0 !important;
}

.mini-media-player.is-audio-only .yt-close-btn:hover {
    background: rgba(239, 68, 68, 0.8) !important;
    color: #ffffff !important;
    transform: scale(1.1) !important;
}

.mini-media-player.is-audio-only .yt-bottom-bar {
    position: static !important;
    background: none !important;
    padding: 0 !important;
}

.mini-media-player.is-audio-only .yt-progress-container {
    height: 10px !important;
    margin-bottom: 4px !important;
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
}

.mini-media-player.is-audio-only .yt-progress-rail {
    height: 4px !important;
    background: rgba(255, 255, 255, 0.18) !important;
    border-radius: 2px !important;
    transition: height 0.15s ease !important;
}

.mini-media-player.is-audio-only .yt-progress-container:hover .yt-progress-rail {
    height: 6px !important;
}

.mini-media-player.is-audio-only .yt-progress-played {
    background: linear-gradient(90deg, #38bdf8 0%, #2563eb 100%) !important;
    border-radius: 2px !important;
}

.mini-media-player.is-audio-only .yt-scrubber-handle {
    width: 10px !important;
    height: 10px !important;
    transform: translate(-50%, -50%) scale(1) !important;
    background: #38bdf8 !important;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.8) !important;
}

.mini-media-player.is-audio-only .yt-controls-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 30px !important;
}

.mini-media-player.is-audio-only .yt-controls-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
}

.mini-media-player.is-audio-only .yt-play-btn {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4) !important;
    transition: transform 0.12s ease, background 0.15s ease !important;
}

.mini-media-player.is-audio-only .yt-play-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #1d4ed8 100%) !important;
    transform: scale(1.06) !important;
}

.mini-media-player.is-audio-only .yt-play-btn svg {
    width: 16px !important;
    height: 16px !important;
}

.mini-media-player.is-audio-only .yt-replay-btn {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.mini-media-player.is-audio-only .yt-replay-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
}

.mini-media-player.is-audio-only .yt-replay-btn svg {
    width: 16px !important;
    height: 16px !important;
}

.mini-media-player.is-audio-only .yt-mute-btn {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.mini-media-player.is-audio-only .yt-mute-btn:hover {
    background: rgba(255, 255, 255, 0.18) !important;
}

.mini-media-player.is-audio-only .yt-mute-btn svg {
    width: 18px !important;
    height: 18px !important;
}

.mini-media-player.is-audio-only .yt-time-display {
    font-size: 11px !important;
    color: #cbd5e1 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Roboto", monospace !important;
    margin-left: auto !important;
    letter-spacing: 0.3px !important;
}

.mini-media-player.is-audio-only .yt-controls-right {
    display: none !important;
}

/* Mobil Cihaz Uyumluluğu */
@media (max-width: 600px) {
    .mini-media-player.is-youtube-video {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        border: none;
    }
    .yt-title-container {
        max-width: 180px;
    }
    .yt-volume-box:hover .yt-volume-slider-wrap {
        width: 45px;
    }
}
