:root {
    --primary-color: #224daa;
    --secondary-color: #224daa;
    --dark-color: #333;
    --light-color: #f0f2f5;
    --font-family: 'SUIT', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 헤더 스타일 */
header {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    transition: padding 0.3s ease;
}

header .container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    height: 38px;
    width: auto;
    transition: height 0.3s ease;
}

.filter-buttons {
    display: flex;
    gap: 0.4rem;
    white-space: nowrap;
    overflow-x: auto;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    padding: 4px 0;
    flex-grow: 1;
    justify-content: flex-end;
}

/* Chrome, Safari 등을 위한 스크롤바 숨김 */
.filter-buttons::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background-color: white;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 0.8rem;
    flex-shrink: 0; /* 버튼이 줄어들지 않도록 설정 */
}

.filter-btn:hover, .filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 소형 모바일 화면 (320px 이하) */
@media (max-width: 320px) {
    header {
        padding: 0.5rem 0;
    }
    
    header .container {
        flex-direction: column;
        gap: 0.6rem;
        align-items: center;
        justify-content: center;
    }
    
    .logo {
        margin-bottom: 0.3rem;
    }
    
    .logo img {
        height: 32px;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.3rem;
    }
    
    .filter-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* 모바일 화면 (576px 이하) */
@media (max-width: 576px) {
    header .container {
        flex-direction: column;
        gap: 0.6rem;
        align-items: center;
        justify-content: center;
        padding: 0 0.5rem;
    }
    
    .logo {
        margin-bottom: 0.3rem;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
        max-width: 100%;
    }
    
    .filter-btn {
        font-size: 0.75rem;
    }
}

/* 태블릿 화면 (577px ~ 767px) */
@media (min-width: 577px) and (max-width: 767px) {
    header {
        padding: 0.8rem 0;
    }
    
    .logo img {
        height: 42px;
    }
    
    .filter-buttons {
        max-width: 75%;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* 중간 화면 (768px 이상) */
@media (min-width: 768px) {
    header {
        padding: 1rem 0;
    }
    
    .logo img {
        height: 48px;
    }
    
    .filter-buttons {
        max-width: 70%;
        gap: 0.6rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* 대형 화면 (1200px 이상) */
@media (min-width: 1200px) {
    header {
        padding: 1.1rem 0;
    }
    
    .logo img {
        height: 52px;
    }
    
    .filter-btn {
        padding: 0.55rem 1.1rem;
        font-size: 0.95rem;
    }
    
    .filter-buttons {
        gap: 0.8rem;
    }
}

/* 비디오 그리드 스타일 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding: 15px 0;
    justify-content: center;
    margin: 0 auto;
}

/* Masonry 레이아웃을 위한 설정 */
.video-grid:after {
    content: '';
    display: block;
    clear: both;
}

/* 애니메이션 카드 스타일 */
.video-card {
    break-inside: avoid;
    margin-bottom: 10px;
    width: 100%;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    opacity: 1;
    transform-origin: center;
    backface-visibility: hidden;
    will-change: transform, opacity;
    padding: 0.25rem;
    display: inline-block;
}

/* 쇼츠 비디오 카드 스타일 */
.video-card.shorts-video {
    width: 100%;
    max-width: 360px;
}

.video-card-inner {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.video-card-inner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #f0f0f0;
    overflow: hidden;
}

/* 쇼츠 썸네일 컨테이너 */
.video-card.shorts-video .thumbnail-container {
    aspect-ratio: 9/16;
    width: 100%;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card-inner:hover .thumbnail-container img {
    transform: scale(1.05);
}

.video-info {
    padding: 10px 12px;
}

.video-title {
    font-size: 1rem;
    margin: 8px 0 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-date {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    margin-bottom: 7px;
}

/* 팝업 스타일 */
.video-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    z-index: 1000;
    overflow: hidden;
}

.popup-container {
    width: 100%;
    height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: black;
    position: relative;
}

.popup-container .video-container {
    position: relative;
    width: 100%;
    height: 100vh;
    padding-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-container #player {
    position: absolute;
    width: 100%;
    height: 100%;
}

.popup-container .plyr {
    width: 100%;
    height: 100%;
    --plyr-color-main: var(--primary-color);
    --plyr-video-background: black;
}

.popup-container .plyr__video-wrapper {
    height: 100%;
    background: black;
}

.popup-container iframe {
    width: 100%;
    height: 100%;
    background: black;
}

.popup-container .popup-header {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    border: none;
    z-index: 2;
}

.popup-container .close-btn {
    background: rgba(128, 128, 128, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.popup-container .close-btn:hover {
    background: rgba(128, 128, 128, 1);
    transform: scale(1.1);
}

.popup-container .close-icon {
    display: inline-block;
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.popup-container .close-btn:hover .close-icon {
    transform: rotate(90deg);
}

.popup-container .video-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
    max-height: 30vh;
    overflow-y: auto;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.popup-container:hover .video-info {
    opacity: 1;
}

.popup-container .video-title {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.popup-container .video-date {
    color: rgba(255, 255, 255, 0.8);
}

/* 쇼츠 모드 특정 스타일 */
.popup-container.shorts-mode .video-container {
    width: calc(100vh * 9/16);
    max-width: 100%;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .popup-container .video-container {
        width: 100%;
        height: calc(100vh - 60px);
    }
    
    .popup-container.shorts-mode .video-container {
        width: 100%;
        height: calc(100vw * 16/9);
        max-height: 70vh;
    }
    
    .popup-container .video-info {
        max-height: 40vh;
    }
}

@media (orientation: landscape) and (max-width: 768px) {
    .popup-container.shorts-mode .video-container {
        width: calc(100vh * 9/16);
        height: 100vh;
        max-height: none;
    }
}

/* Plyr 커스텀 스타일 */
.plyr {
    --plyr-color-main: var(--primary-color);
    --plyr-menu-background: rgba(0, 0, 0, 0.9);
    --plyr-menu-color: white;
    --plyr-tooltip-background: rgba(0, 0, 0, 0.9);
    --plyr-tooltip-color: white;
    --plyr-range-fill-background: var(--primary-color);
}

.plyr--video {
    height: 100%;
}

.plyr__video-wrapper {
    height: 100%;
    background: black;
}

/* csPlayer 추가 스타일 */
#csPlayerContainer .csPlayer {
    --playerBg: #000;
    --playerColor: #fff;
    --sliderBg: var(--secondary-color);
    --sliderThumbColor: var(--primary-color);
    --sliderSeekTrackColor: var(--primary-color);
    --startBtnBg: var(--primary-color);
    --settingsBg: #222;
    --settingsTextColor: #fff;
}

.video-info {
    padding: 1rem;
}

.video-description {
    margin-bottom: 1rem;
    white-space: pre-line;
}

/* 로딩 표시기 */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
    grid-column: 1 / -1;
    width: 100%;
}


@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.85; }
}

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

.loading-active .loading {
    display: block;
}

/* 반응형 그리드 */
@media (max-width: 359px) {
    /* 갤럭시 폴드 3 외부 화면 등 매우 좁은 화면 */
    .video-grid {
        grid-template-columns: 1fr; /* 1줄로 표시 */
        gap: 10px;
    }
    
    .video-card, .video-card.shorts-video {
        max-width: 100%; /* 화면 너비에 맞춤 */
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    .video-title {
        font-size: 0.9rem;
        margin: 6px 0 3px;
        -webkit-line-clamp: 2;
    }
    
    .video-date {
        font-size: 0.75rem;
    }
    
    .video-info {
        padding: 8px 10px;
    }
    
    .shorts-badge, .live-badge {
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .live-dot {
        width: 5px;
        height: 5px;
    }
    
    /* 컨테이너 패딩 줄임 */
    .container {
        padding: 0 0.5rem;
    }
}

/* 모바일 세로 화면 (360px~480px) - 1줄 표시 */
@media (min-width: 360px) and (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr; /* 1줄로 표시 */
        gap: 12px;
    }
    
    .video-card, .video-card.shorts-video {
        max-width: 100%;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    /* 작은 태블릿 화면 */
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 12px;
    }
    
    .video-card, .video-card.shorts-video {
        max-width: 100%;
    }
}

@media (min-width: 768px) {
    /* 태블릿 및 데스크탑 */
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
    }
    
    .video-card, .video-card.shorts-video {
        max-width: 360px;
    }
}

@media (min-width: 1200px) {
    /* 넓은 화면 */
    .video-grid {
        max-width: 1600px;
    }
}

.no-videos {
    text-align: center;
    padding: 2rem;
    font-size: 1rem;
    color: var(--secondary-color);
    grid-column: 1 / -1;
    width: 100%;
}

/* 스켈레톤 로딩 효과 */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

.video-card.loading .thumbnail-container {
    aspect-ratio: 16/9;
    background: #f0f0f0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.video-card.loading .video-info {
    padding: 1rem;
}

.video-card.loading .video-title {
    height: 24px;
    width: 80%;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.video-card.loading .video-date {
    height: 16px;
    width: 40%;
    border-radius: 4px;
}

/* 비디오 카드 스타일 */
.video-card {
    width: 360px;
    padding: 0.25rem;
    margin-bottom: 0.5rem;
    break-inside: avoid;
    display: inline-block;
}

.video-card-inner {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.video-card-inner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #f0f0f0;
    overflow: hidden;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card-inner:hover .thumbnail-container img {
    transform: scale(1.05);
}

.video-info {
    padding: 1rem;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.video-date {
    font-size: 0.875rem;
    color: var(--gray-color);
}

/* 로딩 상태 숨기기 */
.loading {
    display: none;
}

.loading-active .loading {
    display: block;
}

.shorts-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #FF0000;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shorts-badge::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M10 14.65v-5.3L15 12l-5 2.65zm7.77-4.33-1.2-.5L18 9.06c1.84-.96 2.53-3.23 1.56-5.06s-3.24-2.53-5.07-1.56L6 6.94c-1.29.68-2.07 2.04-2 3.49.07 1.42.93 2.67 2.22 3.25.03.01 1.2.5 1.2.5L6 14.93c-1.83.97-2.53 3.24-1.56 5.07.97 1.83 3.24 2.53 5.07 1.56l8.5-4.5c1.29-.68 2.06-2.04 1.99-3.49-.07-1.42-.94-2.68-2.23-3.25zm-.23 5.86-8.5 4.5c-1.34.71-3.01.2-3.72-1.14-.71-1.34-.2-3.01 1.14-3.72l2.04-1.08v-1.21l-.69-.28-1.11-.46c-.99-.41-1.65-1.35-1.7-2.41-.05-1.06.52-2.06 1.46-2.56l8.5-4.5c1.34-.71 3.01-.2 3.72 1.14.71 1.34.2 3.01-1.14 3.72L15.5 9.26v1.21l1.8.74c.99.41 1.65 1.35 1.7 2.41.05 1.06-.52 2.06-1.46 2.56z"/></svg>') center/contain no-repeat;
}

/* 새 비디오 카드 애니메이션 효과 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card.new-card {
    animation: fadeIn 0.5s ease forwards;
}

/* 배지 스타일 추가 */
.live-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(204, 0, 0, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.live-dot {
    width: 5px;
    height: 5px;
    background-color: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.info-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(59, 89, 152, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.info-badge::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1-8h-2V7h2v2z"/></svg>') center/contain no-repeat;
}

.new-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 170, 0, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.new-badge::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>') center/contain no-repeat;
}

/* 다른 뱃지와 함께 있을 경우 */
.new-badge-with-other {
    top: 36px;
}

.shorts-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #FF0000;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 안내 카드 효과 */
.info-card .video-card-inner {
    border: 1px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 5px rgba(59, 89, 152, 0.2);
}

.info-card .video-card-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        rgba(255, 255, 255, 0), 
        rgba(255, 255, 255, 0.2), 
        rgba(255, 255, 255, 0.5), 
        rgba(255, 255, 255, 0.2), 
        rgba(255, 255, 255, 0)
    );
    z-index: 1001;
    transform: skewX(-20deg);
    animation: glowingBorder 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
}

/* 예배시간 안내 카드 지연 효과 */
#worship-time .video-card-inner::before {
    animation-delay: 0.5s;
}

/* 오시는 길 카드 지연 효과 */
#directions .video-card-inner::before {
    animation-delay: 3s;
}

@keyframes glowingBorder {
    0% {
        left: -60%;
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
    }
    100% {
        left: 150%;
        opacity: 0;
    }
}

/* 로딩 인디케이터 */
.loading-indicator {
    width: 40px;
    height: 40px;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.loading-indicator::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(59, 89, 152, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    box-sizing: border-box;
    transform-origin: center center;
    animation: spinner 0.8s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

.info-description {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

.video-description-preview {
    font-size: 14px;
    color: #666;
    line-height: 1.3;
    margin: 0;
} 