/* 1. 영상 관리 영역 기본 스타일 */
.video-area {
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    height: 100%;
}

.video-header {
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 관리자 버튼 스타일 */
.video-header .btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.video-header .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* 2. 상위 카테고리 탭 스타일 */
.category-navigation .nav-tabs {
    border-bottom: 1px solid #dee2e6;
}

.category-navigation .nav-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    color: #6c757d;
    font-weight: 500;
}

.category-navigation .nav-tabs .nav-link:hover {
    border-color: #e9ecef #e9ecef #dee2e6;
    color: #495057;
}

.category-navigation .nav-tabs .nav-link.active {
    color: #007bff;
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

/* 3. 하위 카테고리 네비게이션 스타일 */
.subcat-navigation .nav-pills {
    margin-bottom: 1rem;
}

.subcat-navigation .nav-pills .nav-link {
    color: #6c757d;
    background-color: #f8f9fa;
    margin-right: 0.5rem;
    border-radius: 50px;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.subcat-navigation .nav-pills .nav-link.active {
    color: #fff;
    background-color: #28a745;
}

/* 4. 영상 카드 스타일 */
.video-item .card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.video-item .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.video-item .card-title {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    height: 2.8rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-item .card-text {
    color: #6c757d;
}

.video-item .card-footer {
    border-top: 1px solid rgba(0,0,0,.05);
    background-color: rgba(0,0,0,.01);
}

/* 영상 썸네일 컨테이너 */
.video-link {
    position: relative;
    display: block;
    padding-top: 56.25%; /* 16:9 비율 */
    overflow: hidden;
}

.video-link img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-link:hover img {
    transform: scale(1.05);
}

/* 플레이 버튼 오버레이 */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-link:hover .play-button {
    opacity: 1;
}

/* 5. 페이지네이션 스타일 */
.pagination-container {
    margin-top: 1.5rem;
}

.pagination .page-link {
    color: #6c757d;
}

.pagination .page-item.active .page-link {
    background-color: #28a745;
    border-color: #28a745;
}

/* 6. 모달 스타일 */
.modal-content {
    border: none;
    border-radius: 0.3rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

/* 카테고리 관리 스타일 */
.handle {
    cursor: move;
    color: #999;
}

.list-group-item {
    background-color: #f9f9f9;
}

.list-group-item.ui-sortable-helper {
    background-color: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 7. 반응형 스타일 */
@media (max-width: 767px) {
    .video-item .card-title {
        font-size: 0.9rem;
        height: 2.5rem;
    }
    
    .play-button {
        font-size: 2rem;
        opacity: 0.7; /* 모바일에서 항상 일부 보이게 */
    }
    
    .subcat-navigation .nav-pills .nav-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}

/* 8. 미리보기 스타일 */
#previewContainer, #editPreviewContainer {
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    padding: 1rem;
    background-color: #f8f9fa;
}

#previewContainer .card, #editPreviewContainer .card {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 9. 로딩 애니메이션 */
.fa-spinner {
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 10. 드래그 앤 드롭 관련 스타일 */
.ui-sortable-helper {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
    transform: scale(1.05) !important;
    transition: none !important;
}

.ui-sortable-placeholder {
    visibility: visible !important;
    background-color: #f0f8ff !important;
    border: 2px dashed #add8e6 !important;
    border-radius: 5px;
    opacity: 0.5;
}

/* 11. 알림 메시지 스타일 */
.alert-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 300px;
    animation: fadeInOut 5s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* 12. 쇼츠 배지 스타일 */
.shorts-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #f00;
    color: #fff;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: bold;
    z-index: 10;
}

/* 13. 카테고리 스와이퍼 스타일 - 미니멀 모던 디자인 */
.category-swiper-container {
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
    padding: 0;
}

.category-swiper {
    width: 100%;
    height: auto;
    padding: 2px 0;
}

.category-swiper .swiper-wrapper {
    display: flex;
}

.category-swiper .swiper-slide {
    width: auto !important;
    flex-shrink: 0;
    padding: 0 3px;
}

.category-swiper .swiper-slide .category-tab {
    display: inline-flex;
    align-items: center;
    padding: 4px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
    font-size: 16px;
}

.category-swiper .swiper-slide .category-tab:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    text-decoration: none;
}

.category-swiper .swiper-slide.active .category-tab {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.category-swiper .swiper-slide.active .category-tab:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* 14. 하위 카테고리 스와이퍼 스타일 - 심플 직사각형 디자인 */
.subcategory-swiper-container {
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
    padding: 0px 0;
    margin-top: 5px;
}

.subcategory-swiper {
    width: 100%;
    height: auto;
}

.subcategory-swiper .swiper-wrapper {
    display: flex;
}

.subcategory-swiper .swiper-slide {
    width: auto !important;
    flex-shrink: 0;
    padding: 0 2px;
}

.subcategory-swiper .swiper-slide .subcategory-tab {
    display: inline-flex;
    align-items: center;
    padding: 2px 12px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    color: #94a3b8;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
}

.subcategory-swiper .swiper-slide .subcategory-tab:hover {
    background: #d1d5db;
    border-color: #9ca3af;
    color: #64748b;
    text-decoration: none;
}

.subcategory-swiper .swiper-slide.active .subcategory-tab {
    background: #60a5fa;
    border-color: #60a5fa;
    color: #ffffff;
    font-weight: 500;
}

.subcategory-swiper .swiper-slide.active .subcategory-tab:hover {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* 15. 스와이퍼 반응형 디자인 */
@media (max-width: 768px) {
    .category-swiper {
        padding: 2px 0;
    }
    
    .category-swiper .swiper-slide .category-tab {
        padding: 3px 12px;
        font-size: 15px;
    }
    
    .subcategory-swiper .swiper-slide .subcategory-tab {
        padding: 2px 10px;
        font-size: 13px;
    }
}

/* 16. 개선된 플레이 버튼 스타일 */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 3rem;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    opacity: 0.8;
}

.video-link:hover .play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-link {
    position: relative;
    display: block;
    overflow: hidden;
}

.video-link:hover {
    text-decoration: none;
}

.card-img-top {
    transition: transform 0.3s ease;
}

.video-link:hover .card-img-top {
    transform: scale(1.05);
}

/* 17. 카테고리 간 여백 강제 조정 */
.category-swiper-container {
    margin-bottom: 5px !important;
    margin-top: 0 !important;
}

.subcategory-swiper-container {
    margin-top: 3px !important;
    margin-bottom: 12px !important;
}

.category-swiper {
    padding: 0 !important;
    margin: 0 !important;
}

.subcategory-swiper {
    padding: 0 !important;
    margin: 0 !important;
}

/* Bootstrap 기본 여백 제거 */
.category-navigation {
    margin-bottom: 0 !important;
}

.tab-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.tab-pane {
    padding-top: 0 !important;
}

/* 추가로 확인해볼 부분 */
.video-area .mb-3 {
    margin-bottom: 0.5rem !important;
}

.video-area .mb-2 {
    margin-bottom: 0.3rem !important;
}

/* 18. 카테고리 배지 스타일 */
.category-badge-container {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

.category-badge {
    font-size: 0.75em;
    padding: 4px 8px;
    background-color: rgba(0, 123, 255, 0.9) !important;
    color: white !important;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 검색 모드일 때 비디오 카드 여백 조정 */
.video-item .card {
    position: relative;
}

.video-item .card-img-top {
    margin-top: 0;
}

/* 반응형 배지 */
@media (max-width: 576px) {
    .category-badge {
        font-size: 0.65em;
        padding: 2px 6px;
    }
}

/* 19. 검색 상태 표시 스타일 */
#searchStatusContainer {
    transition: all 0.3s ease;
}

#searchStatusContainer .alert {
    margin-bottom: 1rem;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#searchStatusContainer .alert-info {
    background-color: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

/* 검색창 토글 애니메이션 */
#videoSearchLayer {
    transition: all 0.3s ease;
}

#videoSearchLayer .card {
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 20. 영상 스와이퍼 네비게이션 버튼 제어 */
.video-swiper .swiper-button-next,
.video-swiper .swiper-button-prev {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-swiper.swiper-initialized .swiper-button-next,
.video-swiper.swiper-initialized .swiper-button-prev {
    opacity: 1;
    visibility: visible;
}

/* 페이지가 1개뿐일 때 화살표 숨김 */
.video-swiper .swiper-button-disabled {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 로딩 중일 때 화살표 숨김 */
.video-swiper:has(.fa-spinner) .swiper-button-next,
.video-swiper:has(.fa-spinner) .swiper-button-prev {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 대체 방법 (CSS :has가 지원되지 않는 브라우저용) */
.video-loading .swiper-button-next,
.video-loading .swiper-button-prev {
    opacity: 0 !important;
    visibility: hidden !important;
}