/**
 * レッスン表示画面レスポンシブCSS
 * モバイル・タブレット・デスクトップ対応
 */

/* レスポンシブレイアウトコンテナ */
.lesson-responsive-container {
    position: relative;
    width: 100%;
}

/* 視聴ページ（lessonshow）では独自のヘッダーを使用するため標準ナビゲーションを非表示 */
@media (max-width: 576px) {
    body.lessonshow:not(.playlist-lesson) .navbar,
    body.lessonshow:not(.playlist-lesson) #floatnav {
        display: none !important;
    }

    /* レッスンページのコンテナ */
    .lesson-responsive-container {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* モバイル用固定ヘッダー */
    .mobile-fixed-header {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 56px !important; /* ヘッダーの高さ */
        z-index: 1001 !important; /* 動画プレイヤーより上 */
        background: #fff !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }

    .lessonshow:is(.playlist-lesson) {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        padding-top: 182px; /* 動画プレイヤー用のスペース（少し小さめ） */
    }

    .lessonshow:not(.playlist-lesson) {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        padding-top: 183px; /* 動画プレイヤーにボタンが隠れないサイズを確保 */
    }

    body.lessonshow:not(.playlist-lesson) .video-section {
        position: fixed;
        top: 53px; /* ヘッダーの高さに合わせて調整 */
        left: 0;
        width: 100%;
        z-index: 1000;
    }

    /* プレイリストページでも動画を固定表示 */
    body.playlist-lesson .video-section {
        position: fixed;
        top: 57px;
        left: 0px !important;
        right: 0px !important;
        width: 100%;
        margin: 0px !important;
        padding: 0 !important;
        z-index: 1000;
        aspect-ratio: 16/9;
        height: auto;
        max-height: 225px; /* 動画読み込み失敗時の高さ制限 */
    }

    /* プレイリストページのナビゲーションを固定 */
    body.playlist-lesson .navbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
    }

    /* 動画プレイヤー内のiframeも高さ制限 */
    .video-section iframe {
        max-height: 230px !important;
        width: 100% !important;
    }

    /* videowrapperの調整 */
    .video-section #videowrapper {
        position: relative;
        width: 100%;
        height: 230px; /* 固定高さを設定 */
        overflow: hidden;
    }

    /* プレイリストページのvideowrapperの調整 */
    body.playlist-lesson .video-section #videowrapper {
        position: relative;
        width: 100%;
        height: 225px; /* 固定高さを設定 */
        overflow: hidden;
    }

    .video-section #videowrapper:before {
        display: none !important; /* アスペクト比用のpaddingを無効化 */
    }

    /* iframeの表示を確実にする */
    .video-section #videocontent {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* モバイル版での準備中画像の表示調整 */
    .video-section .rockvideo {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .video-section #videocontentinner {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        position: relative;
    }

    .video-section #videocontentinner img[alt="準備中"] {
        width: auto;
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
    }

    /* 次へ前へボタンを画面端に調整 */
    .post-nav {
        margin-top: 1rem !important; /* 動画プレイヤーとの間隔を確保 */
    }

    .post-nav .btn-group {
        margin-left: -1rem !important;
        margin-right: -1rem !important;
        flex: 0 0 100%;
    }
}

/* チャートコンテナのスタイル */
.chart-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 120px;
    margin: 0 auto;
}

.chart-container canvas {
    display: block;
    max-width: 100%;
    height: auto !important;
}

/* デフォルトのチャートサイズ（PC版） */
.chart-canvas {
    width: 120px !important;
    height: 120px !important;
}

.chart-container .count {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.chart-container .count em {
    font-size: 1.75rem;
    font-weight: bold;
    color: #f38273;
    font-style: normal;
}

.chart-container .count .caption {
    font-size: 1.25rem;
    color: #f38273;
}

/* 統合カードのヘッダー間の境界線 */
.card-header.border-top {
    border-top: 1px solid #dee2e6 !important;
}

/* 動画説明文の高さ制限（この動画について+チャプター+おさらい一塊） */
.video-description .description-content {
    line-height: 1.5 !important;
    overflow: hidden !important;
    transition: max-height 0.3s ease-out !important;
}

.video-description .description-content.collapsed {
    overflow: hidden !important;
}

.video-description .description-content.expanded {
    overflow: visible !important;
}

/* カテゴリーページ専用 */

.category-description .description-content {
    transition: max-height 0.3s ease-out !important;
    color: #777;
    font-size: 0.85rem;
}

.category-description .description-content.collapsed {
    overflow: hidden !important;
}

.category-description .description-content.expanded {
    overflow: visible !important;
}

@media (max-width: 576px) {
    .category-description .description-content {
        font-size: 12px;
    }
}

/* もっと見る/少なく表示ボタンのスタイル */
.video-description .show-more-btn,
.video-description .show-less-btn {
    color: #f38273 !important;
}

.video-description .show-more-btn:hover,
.video-description .show-less-btn:hover {
    color: #d37063 !important;
    text-decoration: none !important;
}

/* カテゴリーページ用のボタンスタイル */
.category-description .show-more-btn,
.category-description .show-less-btn {
    color: #f38273 !important;
    text-decoration: none !important;
}

.category-description .show-more-btn:hover,
.category-description .show-less-btn:hover {
    color: #d37063 !important;
    text-decoration: none !important;
}

/* チャプター表示の調整 */
#accordionChapter {
    margin: 1rem 0;
}

#accordionChapter .btn {
    margin-bottom: 0.5rem;
}

.video-thumbnail {
    position: relative;
    width: 100px;
    min-width: 100px;
    height: 56px; /* 16:9のアスペクト比 */
    background: #f0f0f0;
    border-radius: 4px;
    overflow: visible;
}

/* カテゴリページ専用の大きめサムネイル */
.category-video-thumbnail {
    position: relative;
    width: 100px;
    min-width: 100px;
    height: 56px; /* 16:9のアスペクト比 */
    background: #f0f0f0;
    border-radius: 4px;
    overflow: visible;
}

.thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 画像エラー時のプレースホルダー表示 */
.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    text-align: center;
    padding: 5px;
    background: #f0f0f0;
}

/* 動画時間バッジ（左下） */
.thumbnail-playtime {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 2px 2px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* プレミアムバッジ（右下） */
.thumbnail-premium {
    position: absolute;
    bottom: 2px;
    right: 2%;
    background: #ffd700;
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 準備中バッジ（右下） */
.thumbnail-preparation {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #999;
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.thumbnail-img.grayscale {
    filter: grayscale(100%);
    opacity: 0.6;
}

.thumbnail-overlay {
    position: absolute;
    top: -5px;
    left: -5px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* 準備中オーバーレイアイコン：グレー背景、白いアイコン */
.thumbnail-overlay.bg-secondary {
    background-color: #999 !important;
    color: white;
}

/* 視聴不可オーバーレイアイコン：黒背景、白いアイコン */
.thumbnail-overlay.bg-dark {
    background-color: #000;
    color: white;
}

/* 動画情報 */
.category-video-info{
    line-height: 1.2;
}
/* カテゴリーマスターバッジ */
.category-description-container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
}

.category-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-description-text {
    flex-grow: 1;
    margin-bottom: 0;
}

.category-master-badge-container {
    margin-top: 15px;
    align-self: flex-end;
    flex-shrink: 0;
}

.category-master-badge-container .category-master-icon {
    width: 55px;
    height: auto;
    display: block;
}

/* プレイリストモーダル特有のスタイル調整 */
.playlist-multi-modal {
    z-index: 9999 !important;
}

.report-multi-modal {
    z-index: 9999 !important;
}

/* 準備中動画プレイヤーの縦中央配置 */
#videowrapper .rockvideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#videowrapper #videocontentinner {
    width: 100%;
}

/* 動画進捗バー（サムネイル下端に重なる） */
.video-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.video-progress-bar .progress-fill {
    height: 100%;
    width: 0%;
    background: #f38273;
    transition: width 0.3s ease;
}

/* 進捗パーセンテージ表示（右下角） */
.video-progress-label {
    position: absolute;
    bottom: 6px;
    right: 4px;
    font-size: 10px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: bold;
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 3px;
    border-radius: 2px;
}

/* 動画リスト */
.video-list-item{
    line-height: 1.2;
}
/* スマホ用：カテゴリページ動画タイトルのフォントサイズ調整 */
@media (max-width: 576px) {
    /* カテゴリページの動画リストのタイトル */
    #video-list-container .fs-5 {
        font-size: 14px  !important; /* 1.25remから14px に縮小 */
    }

    #video-list-container .font-weight-bold {
        font-size: 14px !important;
    }
}

/* タブレット用：少し大きめ */
@media (min-width: 577px) and (max-width: 768px) {
    #video-list-container .fs-5 {
        font-size: 1.1rem !important;
    }

    #video-list-container .font-weight-bold {
        font-size: 1.1rem !important;
    }
}

/* カテゴリーページの動画リストホバー効果 */
#video-list-container .video-item {
    display: block;
    text-decoration: none;
    transition: background-color 0.2s ease;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 0.5rem;
}

#video-list-container .video-item:hover {
    background-color: #f8f9fa;
}

/* 準備中動画はホバー効果なし */
#video-list-container .video-link.disabled:hover {
    background-color: transparent;
    cursor: default;
}
