/* ===== 기본 리셋 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #121212;
    color: #ffffff;
    line-height: 1.6;
}

/* ===== 메인 컨테이너 ===== */
.podcasts-main {
    min-height: 100vh;
    background-color: #121212;
}

/* 모바일에서는 콘텐츠를 중앙 정렬 */
@media (max-width: 768px) {
    .podcasts-main {
        max-width: 1200px;
        margin: 0 auto;
        width: 100%;
    }
}

/* ===== 컨테이너 ===== */
.container {
    padding: 0 20px;
}

/* ===== 카테고리 섹션 ===== */
.categories-section {
    border-bottom: 1px solid #333333;
    padding: 20px 0;
}

.categories-section .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 40px;
    justify-content: flex-start;
    align-items: center;
}

.category-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    background-color: #2a2a2a;
    border: 1px solid #404040;
    border-radius: 20px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
    text-decoration: none;
}

.category-btn:hover {
    background-color: #404040;
    border-color: #606060;
    text-decoration: none;
}

.category-btn.active {
    background-color: #1fa1eb;
    border-color: #1fa1eb;
    color: #ffffff;
    text-decoration: none;
}

.category-btn:focus {
    outline: 2px solid #1fa1eb;
    outline-offset: 2px;
    text-decoration: none;
}

/* 카테고리 버튼들이 화면에 맞게 배치되도록 반응형 처리 */
@media (max-width: 768px) {
    .categories-list {
        gap: 8px;
        padding: 12px 20px;
    }

    .filters-section {
        padding: 20px 10px !important;
    }

    .results-header {
        padding: 16px 10px !important;
    }

    .pagination-section {
        padding: 24px 20px;
    }

    .category-btn {
        font-size: 13px;
        padding: 6px 12px;
        text-decoration: none;
    }
}

@media (max-width: 480px) {
    .categories-list {
        gap: 6px;
    }

    .category-btn {
        font-size: 12px;
        padding: 4px 8px;
        text-decoration: none;
    }
}

/* ===== 필터 섹션 ===== */
.filters-section {
    border-bottom: 1px solid #333333;
    padding: 20px 40px;
}

.filters-section .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.filters-form {
    width: 100%;
    padding: 10px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.select-wrapper {
    position: relative;
    height: 42px;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #404040;
    border-radius: 6px;
    background-color: #2a2a2a;
    color: #ffffff;
    font-size: 14px;
    transition: border-color 0.2s ease;
    height: 42px;
    box-sizing: border-box;
}

.filter-select:focus {
    outline: none;
    border-color: #1fa1eb;
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.25);
}

.search-wrapper {
    display: flex;
    gap: 0;
    border: 1px solid #404040;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s ease;
    height: 42px;
}

.search-wrapper:focus-within {
    border-color: #1fa1eb;
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.25);
}

.search-input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background-color: #2a2a2a;
    color: #ffffff;
    font-size: 14px;
    height: 40px;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
}

.search-btn {
    padding: 10px 16px;
    background-color: #1fa1eb;
    border: none;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background-color: #1aa34a;
}

/* ===== 결과 헤더 ===== */
.results-header {
    border-bottom: 1px solid #333333;
    padding: 16px 40px;
}

.results-header .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.results-info {
    padding: 0px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.results-count {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background-color: #404040;
    color: #ffffff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== 채널 그리드 ===== */
.channels-section {
    padding: 24px 0;
}

.channels-container {
    display: grid;
    gap: 20px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-primary {
    background-color: var(--ytm-accent, #8ab4f8);
    color: var(--ytm-bg-primary, #121212);
    border-color: var(--ytm-accent, #8ab4f8);
    box-shadow: 0 2px 8px rgba(138, 180, 248, 0.3);
}

.btn-primary:hover {
    background-color: var(--ytm-accent-hover, #aecbfa);
    border-color: var(--ytm-accent-hover, #aecbfa);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 180, 248, 0.4);
}

.btn-secondary {
    background-color: transparent;
    color: var(--ytm-text-secondary, #aaaaaa);
    border-color: var(--ytm-border, #3a3a3a);
}

.btn-secondary:hover {
    background-color: var(--ytm-bg-hover, #3a3a3a);
    color: var(--ytm-text-primary, #ffffff);
    border-color: var(--ytm-accent, #8ab4f8);
}

/* 빈 결과 */
.no-channels {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    background-color: var(--ytm-bg-secondary, #1e1e1e);
    border-radius: 16px;
    border: 1px solid var(--ytm-border, #3a3a3a);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.no-channels-icon {
    font-size: 48px;
    color: var(--ytm-text-muted, #717171);
    margin-bottom: 16px;
}

.no-channels-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ytm-text-primary, #ffffff);
    margin-bottom: 8px;
}

.no-channels-text {
    font-size: 14px;
    color: var(--ytm-text-secondary, #aaaaaa);
}

/* ===== 페이지네이션 ===== */
.pagination-section {
    border-top: 1px solid var(--ytm-border, #3a3a3a);
    padding: 24px 40px;
}

.pagination-section .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.pagination-info {
    text-align: center;
    margin-bottom: 20px;
}

.pagination-text {
    color: var(--ytm-text-secondary, #aaaaaa);
    font-size: 14px;
}

.pagination-nav {
    display: flex;
    justify-content: center;
}

.pagination-buttons {
    display: flex;
    gap: 12px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background-color: var(--ytm-bg-tertiary, #2a2a2a);
    border: 1px solid var(--ytm-border, #3a3a3a);
    border-radius: 8px;
    color: var(--ytm-text-primary, #ffffff);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(.disabled) {
    background-color: var(--ytm-bg-hover, #3a3a3a);
    border-color: var(--ytm-accent, #8ab4f8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--ytm-text-muted, #717171);
}

/* ===== 통합 디자인 ===== */

/* ===== 채널 카드 그리드 (사이드바 고려 반응형 레이아웃) ===== */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 0 0 28px 0;
    width: 100%;
    place-items: start;
}

/* PC에서는 좌우 여백 추가 */
@media (min-width: 769px) {
    .channels-grid {
        padding: 0 20px 28px 20px;
    }
}

/* 아주 작은 모바일 (400px 이하, 사이드바 없음): 1열 */
@media (max-width: 400px) {
    .channels-grid {
        grid-template-columns: 1fr;
    }
}

/* 작은 모바일/태블릿 (401px-768px, 사이드바 없음): 2열 */
@media (min-width: 401px) and (max-width: 768px) {
    .channels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 데스크톱 (769px-1024px, 사이드바 있음): 2열 */
@media (min-width: 769px) and (max-width: 1024px) {
    .channels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 중간 데스크톱 (1025px-1200px, 사이드바 있음): 3열 */
@media (min-width: 1025px) and (max-width: 1200px) {
    .channels-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 큰 데스크톱 (1201px-1440px, 사이드바 있음): 4열 */
@media (min-width: 1201px) and (max-width: 1440px) {
    .channels-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 초대형 데스크톱 (1441px 이상, 사이드바 있음): 4열 */
@media (min-width: 1441px) {
    .channels-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== 채널 카드 디자인 (다크모드 타일형) ===== */
.pc-channel-card {
    background: var(--ytm-bg-secondary, #1e1e1e);
    border: 1px solid var(--ytm-border, #3a3a3a);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: auto;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    width: 100%;
    margin-bottom: 0;
    position: relative;
}

.channel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: var(--ytm-accent, #8ab4f8);
}

.pc-channel-image {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 비율 유지 */
    background: var(--ytm-bg-tertiary, #2a2a2a);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.pc-channel-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    /* Ensure image displays properly */
    display: block;
    min-height: 100%;
}

.no-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ytm-bg-tertiary, #2a2a2a) 0%, var(--ytm-bg-secondary, #1e1e1e) 100%);
    border-radius: 8px 8px 0 0;
}

.no-thumbnail i {
    font-size: 48px;
    color: var(--ytm-text-muted, #717171);
    opacity: 0.6;
}

.pc-channel-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--ytm-bg-secondary, #1e1e1e);
}

.pc-channel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ytm-text-primary, #ffffff);
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pc-channel-title a,
.pc-channel-title .channel-link {
    color: #ffffff !important;
    text-decoration: none !important;
}

.pc-channel-title a:hover,
.pc-channel-title .channel-link:hover {
    color: #ffffff !important;
    text-decoration: none !important;
}

.channel-title a {
    color: inherit;
    text-decoration: none;
}

.channel-title a:hover {
    color: var(--ytm-accent, #8ab4f8);
}

.pc-channel-author {
    font-size: 14px;
    color: var(--ytm-text-secondary, #aaaaaa);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.pc-channel-description {
    font-size: 14px;
    color: var(--ytm-text-muted, #717171);
    line-height: 1.5;
    margin: 0;
    flex: 1;
    max-height: 6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

.pc-channel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.pc-meta-item {
    font-size: 11px;
    color: var(--ytm-text-muted, #717171);
    font-weight: 500;
    opacity: 0.8;
}

.meta-item:hover {
    color: var(--ytm-text-secondary, #aaaaaa);
    opacity: 1;
}

.pc-channel-actions {
    padding: 12px 16px 16px 16px;
    background: var(--ytm-bg-tertiary, #2a2a2a);
    border-top: 1px solid var(--ytm-border, #3a3a3a);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 -16px -16px -16px;
    position: relative;
}

.pc-channel-date {
    font-size: 12px;
    color: var(--ytm-text-muted, #717171);
    font-weight: 500;
}

/* ===== 로딩 스피너 스타일 ===== */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner.show {
    display: flex !important;
}

.spinner {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 로고 컨테이너 */
.spinner .logo-container {
    position: relative;
    z-index: 3;
    animation: logoPulse 2s ease-in-out infinite;
}

/* 로고 이미지 */
.spinner .logo-container img {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 0 8px rgba(31, 161, 235, 0.3));
}

/* 외부 회전 링들 */
.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: spin 2s linear infinite;
}

.spinner::before {
    width: 100%;
    height: 100%;
    border-top: 2px solid rgba(31, 161, 235, 0.6);
    border-right: 2px solid rgba(138, 180, 248, 0.4);
    top: 0;
    left: 0;
    animation: spin 2s linear infinite;
}

.spinner::after {
    width: 85%;
    height: 85%;
    top: 7.5%;
    left: 7.5%;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    border-left: 2px solid rgba(138, 180, 248, 0.3);
    animation: spin 1.5s linear infinite reverse;
}

/* 파티클 효과 */
.spinner .particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(31, 161, 235, 0.8) 0%, rgba(138, 180, 248, 0.4) 70%, transparent 100%);
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
}

.spinner .particle:nth-child(1) {
    top: 10%;
    left: 50%;
    animation-delay: 0s;
}

.spinner .particle:nth-child(2) {
    top: 50%;
    right: 10%;
    animation-delay: 0.5s;
}

.spinner .particle:nth-child(3) {
    bottom: 10%;
    left: 50%;
    animation-delay: 1s;
}

.spinner .particle:nth-child(4) {
    top: 50%;
    left: 10%;
    animation-delay: 1.5s;
}

/* 빛나는 링 효과 */
.spinner .shine-ring {
    position: absolute;
    width: 110%;
    height: 110%;
    top: -5%;
    left: -5%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(31, 161, 235, 0.2) 60deg,
        rgba(138, 180, 248, 0.4) 120deg,
        transparent 180deg,
        transparent 240deg,
        rgba(31, 161, 235, 0.2) 300deg,
        transparent 360deg
    );
    animation: shineRotate 3s linear infinite;
    z-index: 1;
}

/* 배경 빛 효과 */
.spinner .bg-glow {
    position: absolute;
    width: 140%;
    height: 140%;
    top: -20%;
    left: -20%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(31, 161, 235, 0.1) 0%, rgba(138, 180, 248, 0.05) 50%, transparent 70%);
    animation: bgPulse 4s ease-in-out infinite alternate;
    z-index: 0;
}

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

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1.2);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.4);
    }
}

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

@keyframes particleFloat {
    0%, 100% {
        opacity: 0.3;
        transform: translateY(0px) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-20px) scale(1.2);
    }
}

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

@keyframes bgPulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* ===== Podcasts 페이지용 ytm-content 스타일 ===== */
.ytm-content {
    margin: 0;
    overflow: visible;
}

/* ===== 모바일 반응형 ===== */
/* 768px 이하에서 사이드바가 사라지므로 전체 너비 사용 제거 */


