/* =========================================
   PLAYER SAYFASI DÜZENİ (LAYOUT)
   ========================================= */

.player-layout {
    display: flex;
    gap: 15px; /* Boşluklar */
    margin-top: 20px;
    margin-bottom: 60px;
    align-items: flex-start;
}

/* --- SOL ALAN (ANA İÇERİK) --- */
.player-main {
    flex: 3;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0; /* VİDEO İÇİN 0 PADDING */
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    padding-bottom: 15px;
}

/* Video altındaki içerikler için kenar boşlukları (Masaüstü için default 15px) */
.video-header,
.video-meta-section,
.separator,
.video-actions-bar {
    padding-left: 15px;
    padding-right: 15px;
}

/* --- SAĞ ALAN (SIDEBAR) --- */
.player-sidebar {
    flex: 1;
    min-width: 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 15px;
    box-shadow: var(--shadow-sm);
    height: auto;
    overflow: visible;
}

/* =========================================
   CUSTOM VIDEO PLAYER
   ========================================= */

.custom-video-player {
    position: relative;
    width: 100%;
    background-color: #000;
    overflow: hidden; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    aspect-ratio: 16 / 9;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    container-type: inline-size; 
    z-index: 10;
}

/* Ambilight Blur Background */
.player-blur-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(50px) brightness(0.3);
    transform: scale(1.2);
    z-index: 1;
}

/* Video Elementi */
.player-video {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    object-fit: contain;
}

/* Büyük Orta Play Butonu */
.center-play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 70px; height: 70px;
    background-color: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    z-index: 5;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.9);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.custom-video-player.paused .center-play-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.center-play-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.5);
}

/* --- KONTROL PANELİ --- */
.player-controls {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 20px 15px 10px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-video-player:hover .player-controls,
.custom-video-player.paused .player-controls {
    opacity: 1;
}

/* İlerleme Çubuğu (Video) */
.progress-area {
    position: relative;
    width: 100%;
    height: 5px;
    background: rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: height 0.1s;
    margin-bottom: 5px;
}

.progress-area:hover {
    height: 8px;
}

.progress-bar {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 6px;
    overflow: hidden;
}

.progress-filled {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    position: relative;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.7);
}

.progress-range {
    position: absolute;
    top: -5px; left: 0;
    width: 100%; height: 15px;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

/* Alt Kontroller */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    padding: 0;
    width: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.time-display {
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 0px;
    font-variant-numeric: tabular-nums;
    opacity: 0.9;
}

/* Ses Kontrolü (SADECE MUTE BUTONU) */
.volume-container, .audio-volume-container {
    display: flex;
    align-items: center;
    /* Slider ve karmaşık yapılar kaldırıldı */
}

/* Eğer JS tarafında slider varsa onu gizle */
.volume-slider-wrapper {
    display: none !important; 
}

/* Otomatik Oynatma Switch */
.autoplay-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 5px;
}

.autoplay-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.3);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(14px); }

/* =========================================
   MUSIC PLAYER STİLLERİ
   ========================================= */
.music-player-wrapper {
    position: relative;
    background-color: #121212;
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: #fff;
    padding: 30px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.blur-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(60px) brightness(0.3);
    z-index: 0;
    transform: scale(1.2);
}

.player-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.album-art {
    width: 200px;
    height: 200px;
    margin-bottom: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}

.music-player-wrapper.playing .album-art { transform: scale(1.02); }
.album-art img { width: 100%; height: 100%; object-fit: cover; }

.track-info { margin-bottom: 25px; }

.track-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 5px;
    color: #fff;
}

.track-artist {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.8;
    color: #e0e0e0;
}

/* Audio Controls Wrapper */
.audio-controls-wrapper {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 12px 25px;
    backdrop-filter: blur(10px);
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.audio-ctrl-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem;
    transition: all 0.2s;
    background: rgba(255,255,255,0.1);
    color: #fff; border: 1px solid rgba(255,255,255,0.2);
    margin: 0;
}

.play-btn-lg {
    width: 50px; height: 50px;
    font-size: 1.3rem;
    background: var(--primary-color);
    border-color: var(--primary-color);
    flex-shrink: 0;
}

.audio-progress-container {
    flex-grow: 1; display: flex; align-items: center; gap: 10px;
    font-size: 0.8rem; color: #eee;
}

/* --- DÜZELTİLMİŞ AUDIO PROGRESS BAR --- */
.audio-progress-bar {
    flex: 1; height: 5px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px; 
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.audio-progress-filled {
    position: absolute;
    top: 0; left: 0;
    height: 100%; width: 0%;
    background-color: var(--primary-color);
    border-radius: 6px;
    z-index: 1;
}

.audio-progress-range {
    position: absolute;
    left: 0;
    width: 100%; 
    height: 20px; 
    top: 50%;
    transform: translateY(-50%);
    opacity: 0; 
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

/* =========================================
   VİDEO BAŞLIK VE DETAYLAR
   ========================================= */
.video-header { margin-top: 15px; }

.video-title {
    font-size: clamp(1.3rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.3;
}

/* Aksiyon Barı */
.video-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: transparent;
    border: none;
    margin-bottom: 15px;
}

.view-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.dot-separator { margin: 0 5px; }

/* --- KOMPAKT BUTON STİLLERİ --- */
.action-buttons { 
    display: flex; 
    gap: 8px; 
    flex-wrap: wrap;
}

.btn-action {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 36px;
    padding: 0 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-main);
    transition: var(--transition);
}

.btn-action i { font-size: 1rem; }

.btn-action:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
}

.btn-action.active {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.08);
}

.separator {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 15px 15px; /* Yanlardan 15px boşluk */
}

/* =========================================
   KANAL BİLGİSİ
   ========================================= */
.video-meta-section { margin-top: 15px; }

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.channel-avatar {
    width: 45px; height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.channel-text { 
    flex: 1; 
    min-width: 0;
}

.channel-name {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem; /* Font küçültüldü */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-sub-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.handle { 
    margin-right: 5px; 
    max-width: 150px; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap;
}

/* Abone Butonu */
.btn-subscribe {
    border: none;
    border-radius: 18px;
    height: 36px;
    padding: 0 16px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--primary-color);
    color: #fff;
    white-space: nowrap;
}

.btn-subscribe:hover { background-color: var(--primary-hover); }

.btn-subscribe.subscribed {
    background-color: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

/* =========================================
   AÇIKLAMA KUTUSU
   ========================================= */
.video-description-box {
    background: var(--bg-body);
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid var(--border-color);
    margin-left: 15px; 
    margin-right: 15px;
}

.description-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.video-description-box.collapsed .description-content {
    max-height: 60px;
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.toggle-desc-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    padding: 5px 0 0;
    font-size: 0.85rem;
    margin-top: 5px;
}

.toggle-desc-btn:hover { text-decoration: underline; }

.video-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.tag-link {
    color: var(--primary-color);
    font-weight: 500; text-decoration: none;
    font-size: 0.8rem;
}

/* =========================================
   SIDEBAR & İLGİLİ İÇERİKLER
   ========================================= */
.sidebar-header-row {
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin: 0; }

.sidebar-list { display: flex; flex-direction: column; gap: 12px; }

.sidebar-card {
    display: flex; gap: 10px;
    text-decoration: none; color: var(--text-main);
    transition: var(--transition);
    position: relative; /* Overlay için gerekli */
}

.sidebar-thumb {
    position: relative;
    width: 140px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    aspect-ratio: 16 / 9;
}

.sidebar-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.sidebar-card:hover .sidebar-thumb img { transform: scale(1.05); }

/* --- SIDEBAR VIDEO PLAY İKONU --- */
.video-card-sm .sidebar-thumb::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 0; 
    height: 0; 
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid #fff;
    z-index: 5;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.video-card-sm .sidebar-thumb::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    opacity: 0;
    z-index: 4;
    transition: all 0.3s ease;
}

.video-card-sm:hover .sidebar-thumb::after,
.video-card-sm:hover .sidebar-thumb::before {
    opacity: 1;
}

.sidebar-info {
    flex: 1; display: flex; flex-direction: column; min-width: 0;
}

.sidebar-item-title {
    font-size: 0.9rem; font-weight: 600; margin: 0 0 3px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.3;
}

.sidebar-card:hover .sidebar-item-title { color: var(--primary-color); }

.sidebar-item-meta { font-size: 0.8rem; color: var(--text-muted); }
.sidebar-item-views { font-size: 0.75rem; color: var(--text-muted); }

.duration-badge-sm {
    position: absolute; bottom: 4px; right: 4px;
    background: rgba(0,0,0,0.8); color: #fff;
    padding: 1px 4px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 600;
}

.sidebar-icon-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3); display: flex;
    align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem;
}

/* --- TÜR ROZETLERİ (BADGE) --- */
.type-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    margin-top: 5px;
    align-self: flex-start;
    font-weight: 700;
    text-transform: uppercase;
}

.bg-music { background-color: var(--accent-color, #fb8500); }
.bg-lyric { background-color: #fb8500; }

/* =========================================
   RESPONSIVE (TABLET VE KÜÇÜK LAPTOPLAR)
   ========================================= */
@media (max-width: 1024px) {
    .player-layout { 
        flex-direction: column; /* Sidebar alta insin */
    }
    
    .player-main {
        width: 100%; /* Tam genişlik */
    }

    .player-sidebar { 
        width: 100%; 
        min-width: 100%;
        max-width: 100%;
        margin-top: 20px;
    }
}

/* =========================================
   RESPONSIVE (MOBİL - 768px ve Altı)
   ========================================= */
@media (max-width: 768px) {
    .player-layout {
        gap: 0;
        margin-top: 0;
        margin-bottom: 30px;
    }

    .player-main {
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible; /* Breakout için şart */
    }

    /* EDGE TO EDGE PLAYER ÇÖZÜMÜ (BREAKOUT) */
    .custom-video-player,
    .music-player-wrapper {
        width: 100vw;
        max-width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw; /* Ortadan sola tam açıl */
        margin-right: -50vw; /* Ortadan sağa tam açıl */
        
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .music-player-wrapper {
        min-height: 350px; /* Mobilde biraz daha az yükseklik */
        padding: 20px;
    }
    
    .album-art { width: 160px; height: 160px; }
    .track-title { font-size: 1.5rem; }

    /* İÇERİK HİZALAMA */
    .video-header,
    .video-actions-bar,
    .video-meta-section,
    .separator,
    .video-description-box,
    .related-lyrics-section {
        padding-left: 5px;  /* Eşit mesafe */
        padding-right: 5px; /* Eşit mesafe */
        margin-left: 0;
        margin-right: 0;
    }

    /* Video actions bar için margin düzeltme */
    .video-actions-bar {
        margin-top: 10px;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .btn-action {
        flex: 1;
        padding: 0 5px;
        font-size: 0.8rem;
        min-width: auto;
    }
    
    .channel-name { font-size: 0.9rem; } /* Font daha küçük */

    .player-sidebar {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
        box-shadow: none;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-radius: 0;
        padding-left: 5px;
        padding-right: 5px;
        background: transparent;
    }
}

/* YATAY MOBİL (Landscape) İÇİN ÖZEL */
@media (max-width: 900px) and (orientation: landscape) {
    .music-player-wrapper {
        min-height: 280px; /* Yükseklikten tasarruf */
        padding: 15px;
    }
    .album-art { width: 100px; height: 100px; margin-bottom: 10px; }
    .track-title { font-size: 1.2rem; margin-bottom: 2px; }
    .track-artist { font-size: 0.9rem; }
    .track-info { margin-bottom: 10px; }
}

/* 400px Altı Çok Küçük Cihazlar İçin Optimizasyon */
@media (max-width: 400px) {
    .sidebar-thumb {
        width: 100px; 
    }
    
    .sidebar-card {
        gap: 8px;
    }
    
    .sidebar-item-title {
        font-size: 0.85rem;
    }
    
    .btn-action span {
        display: none; 
    }
    
    .btn-action {
        justify-content: center;
    }
    
    .album-art { width: 140px; height: 140px; }
    
    .audio-controls { gap: 10px; }
    .audio-ctrl-btn { width: 35px; height: 35px; }
    .play-btn-lg { width: 45px; height: 45px; }
}