/* 動画詳細ページ専用スタイル */

.video-detail {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    /* コンテンツがレイアウトを破壊しないよう保護 */
    contain: layout style;
    overflow: hidden;
}

.video-thumbnail-large {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.video-thumbnail-large img {
    width: 100%;
    height: auto;
    display: block;
}

.video-title-large {
    font-size: 1.8rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.video-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.meta-right {
    display: flex;
    align-items: center;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.2);
}

.category-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.view-count-large {
    font-size: 1.1rem;
    color: #666;
    font-weight: 500;
}

.video-date {
    color: #999;
    font-size: 0.95rem;
}

.video-description {
    margin-bottom: 2rem;
}

.video-description h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.video-description p {
    line-height: 1.8;
    color: #555;
}

.video-content {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.video-content h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.content-body {
    line-height: 1.9;
    color: #333;
    /* コンテンツ内のスタイルが外部に影響しないよう隔離 */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* コンテンツ内のposition:fixedなどを無効化（埋め込み動画は除外） */
.content-body:not(.embed-container) * {
    position: relative !important;
}

.content-body:not(.embed-container) *[style*="position: fixed"],
.content-body:not(.embed-container) *[style*="position:fixed"] {
    position: relative !important;
}

/* 埋め込み動画コンテナ */
.content-body.embed-container {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    overflow: visible;
}

.content-body.embed-container iframe,
.content-body.embed-container video {
    max-width: 100%;
    border-radius: 8px;
}

.content-body.embed-container > div {
    max-width: 100%;
    overflow: visible;
}

/* FANZA/DUGA埋め込み用 - アスペクト比を維持 */
.video-content {
    overflow: visible;
}

.video-content .content-body > div[style*="padding-top"] {
    margin-bottom: 10px;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
    margin-top: 2em;
    margin-bottom: 1em;
    color: var(--text-color);
}

.content-body h1 {
    font-size: 1.8rem;
}

.content-body h2 {
    font-size: 1.5rem;
}

.content-body h3 {
    font-size: 1.3rem;
}

.content-body p {
    margin-bottom: 1rem;
}

.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.content-body a {
    color: var(--primary-color);
    text-decoration: underline;
}

.content-body a:hover {
    color: var(--secondary-color);
}

.content-body ul,
.content-body ol {
    margin: 1rem 0 1rem 2rem;
    line-height: 1.8;
}

.content-body li {
    margin-bottom: 0.5rem;
}

.content-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: #666;
    font-style: italic;
}

.content-body code {
    background: #f4f4f4;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content-body pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.content-body table th,
.content-body table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.content-body table th {
    background: var(--bg-color);
    font-weight: 600;
}

.video-tags-large {
    margin-bottom: 2rem;
}

.video-tags-large h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.tag-list .tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.tag-list .tag:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.video-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.btn-watch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.btn-watch-full {
    display: flex;
    width: 100%;
    margin-bottom: 1.5rem;
}

.btn-watch:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.4);
}

/* シェアボタン */
.share-buttons {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 10px;
    border: 2px dashed var(--border-color);
}

.share-label {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
    text-align: center;
}

.share-buttons-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    color: white;
}

.btn-share svg {
    flex-shrink: 0;
}

.btn-twitter {
    background: linear-gradient(135deg, #1DA1F2, #0d8bd9);
    box-shadow: 0 2px 8px rgba(29, 161, 242, 0.3);
}

.btn-twitter:hover {
    background: linear-gradient(135deg, #0d8bd9, #0a6fb0);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.4);
}

.btn-facebook {
    background: linear-gradient(135deg, #1877F2, #0e5fc7);
    box-shadow: 0 2px 8px rgba(24, 119, 242, 0.3);
}

.btn-facebook:hover {
    background: linear-gradient(135deg, #0e5fc7, #0a4a9d);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

.btn-line {
    background: linear-gradient(135deg, #00B900, #009600);
    box-shadow: 0 2px 8px rgba(0, 185, 0, 0.3);
}

.btn-line:hover {
    background: linear-gradient(135deg, #009600, #007500);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 185, 0, 0.4);
}

.btn-hatena {
    background: linear-gradient(135deg, #00A4DE, #0082b3);
    box-shadow: 0 2px 8px rgba(0, 164, 222, 0.3);
}

.btn-hatena:hover {
    background: linear-gradient(135deg, #0082b3, #006689);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 164, 222, 0.4);
}

.btn-copy {
    background: linear-gradient(135deg, #6c757d, #545b62);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.btn-copy:hover {
    background: linear-gradient(135deg, #545b62, #3e4347);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.btn-copy.copied {
    background: linear-gradient(135deg, #28a745, #1e8035);
}

.btn-pinterest {
    background: linear-gradient(135deg, #E60023, #c9001f);
    box-shadow: 0 2px 8px rgba(230, 0, 35, 0.3);
}

.btn-pinterest:hover {
    background: linear-gradient(135deg, #c9001f, #ad001a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 0, 35, 0.4);
}

.admin-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-back {
    display: inline-block;
    padding: 1rem 2rem;
    background: white;
    color: var(--text-color);
    text-decoration: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-delete {
    padding: 1rem 2rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* フリースペース */
.freespace-top,
.freespace-bottom {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
}

.freespace-top {
    margin-top: 0;
}

.freespace-bottom {
    margin-bottom: 0;
}

/* 関連動画セクション */
.related-videos-section {
    margin: 3rem auto 2rem;
    max-width: 1200px;
    padding: 2rem;
    background: var(--bg-color);
    border-radius: 12px;
}

.related-videos-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    text-align: center;
}

.related-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-video-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.related-video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.related-video-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.related-video-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0f0f0;
}

.related-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f5f5f5;
    transition: transform 0.3s;
}

.related-video-card:hover .related-video-thumbnail img {
    transform: scale(1.1);
}

.related-video-info {
    padding: 1rem;
}

.related-video-title {
    font-size: 1rem;
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.related-video-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.related-views {
    font-weight: 500;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .video-detail {
        padding: 1.5rem;
    }

    .video-title-large {
        font-size: 1.4rem;
    }

    .video-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .video-actions {
        flex-direction: column;
    }

    .btn-watch,
    .btn-back,
    .btn-delete {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .related-videos-section {
        padding: 1.5rem;
        margin: 2rem 0 1.5rem;
    }

    .related-videos-title {
        font-size: 1.4rem;
    }

    .related-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .related-video-thumbnail {
        height: 120px;
    }

    .related-video-title {
        font-size: 0.9rem;
    }
}
