/**
 * 컨텐츠 뷰어 스타일 (content 모드)
 * iframe/video 전체화면 뷰어
 */


/* 아이피스쿨측 요청으로 플랫폼 컨텐츠 뷰화면에서는 헤더를 숨김 */
.header {
    display: none !important;
}

.viewer-container {
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
}

.content-viewer-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.content-viewer-scrollbar::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.content-viewer-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.content-viewer-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
}

.content-viewer-page .header {
    position: static;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 2026-10-19 밤 2 대표: 막힌 화면(체험 끝·로그인 필요·구매 필요)에서는 머리를 보인다 — 로그인 창을 닫아도 메인으로 갈 수 있게 */
.content-viewer-page.viewer-denied .header {
    display: block !important;   /* 위의 .header { display: none !important } 보다 세게 */
    transform: none;
}
.content-viewer-page.viewer-denied .viewer-error {
    padding-top: 80px;
}

.viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #fff;
    width: 100%;
    min-height: 100%;
    text-align: center;
    flex: 1;
}

.viewer-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ff6c0f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


.content-wrapper {
    width: 100%;
    margin: 0;
}

.content-iframe,
.content-video {
    width: 100%;
    height: 100%;
    border: none;
}

.content-video {
    object-fit: contain;
}

/* ============================================
   비디오/iframe 영역 (content_detail과 동일)  
   ============================================ */
.video-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    overflow: hidden;
    background-color: #fff;
}

.video-wrapper {
    position: relative;
    width: min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
    aspect-ratio: 16 / 9;
    max-height: none;
    background-color: #fff;
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-wrapper .no-media,
.video-wrapper .auth-required,
.video-wrapper .video-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background-color: #1a1a1a;
    color: #666;
}

.video-wrapper .auth-required {
    color: #999;
}

.video-wrapper .auth-required svg {
    color: #ff6c0f;
}

@media (max-width: 768px) {
    .video-container {
        position: sticky;
        top: 0;
        z-index: 900;
    }

    .content-main {
        padding-bottom: 32px;
    }
}

.viewer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 120px 20px 160px;
    text-align: center;
    background: #1f2937;
    color: #fff;
    min-height: calc(100vh - 220px);
}

.viewer-error svg {
    stroke: #ff6c0f;
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 8px 24px rgba(255, 108, 15, 0.35));
}

.viewer-error p {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    max-width: 760px;
    padding: 0 20px;
    line-height: 1.5;
    word-break: keep-all; /* 2026-10-18 체험 끝 안내가 낱말 중간에서 줄 바뀌지 않게 */
}

.error-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-back {
    padding: 14px 32px;
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-purchase {
    padding: 14px 32px;
    background: #ff6c0f;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-purchase:hover {
    background: #e55a00;
}

/* 반응형 */
@media (max-width: 768px) {
    .content-iframe,
    .content-video {
        height: 100vh;
    }
}

/* ============================================
   카테고리 컨텐츠 섹션
   ============================================ */
.category-contents-section {
    background: #fff;
    padding: 32px 100px;
    margin-top: 0;
    width: 100%;
}

.category-contents-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.category-contents-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 정렬 버튼 */
.category-sort-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.category-sort-buttons .sort-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-sort-buttons .sort-btn:hover {
    border-color: #ff6c0f;
    color: #ff6c0f;
}

.category-sort-buttons .sort-btn.active {
    background: #ff6c0f;
    border-color: #ff6c0f;
    color: #fff;
}

.category-contents-header h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: #ff6c0f;
    border-radius: 2px;
}

.category-contents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.category-content-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.category-content-card .card-thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f5f5f5;
}

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

.category-content-card .card-price-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.category-content-card .card-price-badge.free {
    background: #4CAF50;
    color: #fff;
}

.category-content-card .card-price-badge.paid {
    background: #ff6c0f;
    color: #fff;
}

.category-content-card .card-info {
    display: flex;
    gap: 10px;
    padding: 12px;
}

.category-content-card .card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.category-content-card .card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-content-card .card-details {
    flex: 1;
    min-width: 0;
}

.category-content-card .card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-content-card .card-subtitle {
    font-size: 12px;
    color: #888;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-contents-more {
    text-align: center;
    margin-top: 24px;
}

.category-contents-more button {
    padding: 12px 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-contents-more button:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.category-contents-section .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.category-contents-section .content-loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.category-contents-section .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #ff6c0f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 카테고리 컨텐츠 반응형 */
@media (max-width: 768px) {
    .category-contents-section {
        padding: 20px 16px;
    }

    .category-contents-header {
        flex-wrap: wrap;
    }

    .category-sort-buttons .sort-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .category-contents-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .category-content-card .card-info {
        padding: 10px;
    }

    .category-content-card .card-title {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .category-contents-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-content-card .card-avatar {
        width: 24px;
        height: 24px;
    }

    .category-content-card .card-title {
        font-size: 12px;
    }
}
