/* ================================================== */
/* ★★★ view.css - Artplayer 專用適配樣式 ★★★ */
/* ================================================== */

@import url('./assets/fonts/nunito.css');

:root {
    /* 沿用原本的變數設定 */
    --bg-color: #f8f9fa;
    --sidebar-bg: rgba(255, 255, 255, 0.96); /* 稍微透明一點 */
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --brand-color: #3b82f6;
    --active-bg: #eff6ff;
    --active-text: #2563eb;
    --radius-md: 12px;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Nunito", sans-serif;
    background-color: #000;
    height: 100%;
    overflow: hidden; /* 防止捲軸 */
}

/* --- 1. 播放器容器 (關鍵修正：使用 dvh) --- */
.artplayer-app {
    width: 100%;
    height: 100dvh; /* Dynamic Viewport Height 解決 iOS 工具列問題 */
    position: relative;
    z-index: 1;
}

/* view.css */

/* --- 2. 側邊欄 Layer (Artplayer 內部圖層) --- */
.art-layer-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    /* 修改高度：預留底部空間給控制列 (Artplayer 預設控制列高度約 44px~50px)
       或者保持 100% 但透過 padding 避開 */
    height: 100%; 
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* ★ 關鍵修正 1：調整 Z-Index */
    /* 控制列通常是 z-index: 100 左右。
       如果您希望「再按一次清單按鈕關閉」，側邊欄不能擋住按鈕。
       但在手機上，側邊欄通常是全覆蓋體驗較好。
       
       這裡建議維持 110，但在 JS 中增加邏輯，或者接受「點擊遮罩關閉」的行為。
    */
    z-index: 110; 
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0,0,0,0.2);
}
/* --- 3. 互動遮罩 Layer --- */
.art-layer-mask {
    /* ...原有設定... */
    z-index: 105; /* 介於影片與側邊欄之間，但蓋住控制列 */
}


/* ★ 新增：手機版全螢幕時的強制樣式 */
/* 當進入網頁全螢幕時，確保沒有其他元素干擾點擊 */
.artplayer-app.art-fullscreen-web .art-controls {
    z-index: 115 !important; /* 強制控制列浮在側邊欄之上 (如果需要) */
}
/* view.css 補強 */
.art-layer-sidebar.show {
    transform: translateX(0); /* 滑入畫面 */
}

.art-layer-mask.show {
    opacity: 1;
    pointer-events: auto; /* 允許點擊遮罩來關閉 */
}
/* --- 4. 側邊欄內部內容樣式 (移植自原版) --- */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.playlist-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.playlist-item:hover {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.playlist-item.active {
    background-color: var(--active-bg);
    color: var(--active-text);
    font-weight: 600;
}

.playlist-item i {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.playlist-item.active i {
    color: var(--active-text);
}

/* --- 5. RWD 響應式設定 --- */
@media (max-width: 768px) {
    .art-layer-sidebar {
        width: 85%; /* 手機版不佔滿，留一點邊看得到影片背景 */
        max-width: 320px;
    }
}



/* 確保右鍵選單被禁用時，滑鼠游標顯示正常 (針對電腦版輔助) */
.art-video {
    pointer-events: auto; 
}

/* view.css - 新增樣式 */

/* --- 直式手機專用樣式 (Portrait) --- */
@media (max-width: 768px) and (orientation: portrait) {
    
    /* 1. 改變側邊欄位置：從「右側滑入」改為「底部滑入」 */
    .art-layer-sidebar {
        width: 100% !important;     /* 寬度佔滿 */
        max-width: 100% !important;
        height: 50vh;               /* 高度佔螢幕一半 (剛好填滿影片下方的空白) */
        top: auto;                  /* 取消頂部定位 */
        bottom: 0;                  /* 固定在底部 */
        right: 0;
        left: 0;
        
        /* 修改動畫方向：原本是 translateX(100%)，現在改成 translateY(100%) 往下藏 */
        transform: translateY(100%); 
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1); /* 改成上方有線條 */
        
        /* 圓角優化：讓它看起來像個抽屜 */
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    /* 2. 顯示時的動畫狀態 */
    .art-layer-sidebar.show {
        transform: translateY(0); /* 往上滑出 */
    }

    /* 3. 調整清單內容高度 */
    .playlist-scroll {
        /* 確保底部留白，避免被 iPhone Home Indicator 擋住 */
        padding-bottom: 30px; 
    }
}