body {
    background-color: #f8f8f8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* 메인 콘텐츠 영역 */
.main-layout {
    flex: 1;
    width: 100%;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    padding: 1rem;
    grid-template-areas:
        "nav-top content"
        "nav-bottom content";
}

/* 왼쪽 사이드바 */
.filter {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* shadow-md */
    align-self: baseline;
    width: 100%;
    grid-area: nav-top;
    scale: 1.04;
}

.sidebar {
    grid-area: nav-bottom;
}
/* 사이드바 활성화 클래스 */
.filter.sidebar-active {
    left: 0;
}

/* 사이드바 오버레이 (모바일에서만 보임) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5); /* 반투명 검정 오버레이 */
    z-index: 99; /* 사이드바 아래, 콘텐츠 위에 오도록 */
    display: none; /* 기본적으로 숨김 */
}
.sidebar-overlay.overlay-active {
    display: block; /* 활성화 시 보임 */
}
.filter h2 {
    font-size: 1.25rem; /* text-xl */
    font-weight: 600; /* font-semibold */
    margin-bottom: 1rem; /* mb-4 */
    color: #333;
}
.filter nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.filter nav ul li {
    margin-bottom: 0.5rem; /* mb-2 */
}
.filter nav ul li a {
    display: block;
    padding: 0.5rem 0.75rem; /* py-2 px-3 */
    border-radius: 0.375rem; /* rounded-md */
    color: #4a4a4a; /* gray-700 */
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.filter nav ul li a:hover {
    background-color: #dbeafe; /* blue-100 */
    color: #1d4ed8; /* blue-700 */
}

.filter .active {
    background-color: #dbeafe; /* blue-100 */
    color: #1d4ed8; /* blue-700 */
}
.filter .filter-section {
    margin-top: 2rem; /* mt-8 */
}
.filter .filter-section h3 {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600; /* font-semibold */
    margin-bottom: 0.75rem; /* mb-3 */
    color: #333;
}
.filter .filter-section .filter-group {
    margin-bottom: 1rem; /* mb-4 */
}
.filter .filter-section label {
    display: block;
    font-size: 0.875rem; /* text-sm */
    font-weight: 500; /* font-medium */
    color: #4a4a4a; /* gray-700 */
    margin-bottom: 0.25rem; /* mb-1 */
}
.search-container {
    display: flex;
    gap: 0.5rem;
}
.search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc; /* border-gray-300 */
    border-radius: 0.375rem; /* rounded-md */
    outline: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    font-size: 14px;
}
.search-input:focus {
    outline: none;
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.search-btn {
    width: 90px;
    /* border: 1px solid; */
    background: #dbeafe;
    border-radius: 0.5rem;
    font-weight: 600;
    color: #1d4ed8;
    cursor: pointer;
}
.filter .filter-section select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc; /* border-gray-300 */
    border-radius: 0.375rem; /* rounded-md */
    outline: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.filter .filter-section select:focus {
    border-color: #3b82f6; /* focus:border-blue-500 */
    box-shadow: 0 0 0 1px #3b82f6; /* focus:ring-blue-500 */
}

/* 메인 콘텐츠 영역 */
section#main-content {
    flex: 1;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    align-self: flex-start;
    grid-area: content;
}
section#main-content h1 {
    font-size: 1.875rem; /* text-3xl */
    font-weight: bold;
    margin-bottom: 1.5rem; /* mb-6 */
    color: #333;
}


section#main-content .page-section {
    margin-bottom: 2rem; /* mb-8 */
}
section#main-content .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem; /* gap-6 */
}
/* 카드 스타일 */
.card {
    background-color: #f9fafb; /* gray-50 */
    padding: 1rem;
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* shadow-sm */
    transition: box-shadow 0.2s ease-in-out;
}
.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* hover:shadow-md */
}

.card.channel-card img {
    width: 4rem; /* w-16 */
    height: 4rem; /* h-16 */
    border-radius: 9999px; /* rounded-full */
}
.card.video-card img {
    width: 100%; /* w-full */
    height: auto;
    border-radius: 0.375rem; /* rounded-md */
}

.card.video-card {
    position: relative;
}

.sub-info {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 0.4rem;
    background: rgb(255, 20, 20);
    color: white;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

.video-channel-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card.video-card .video-channel-info img {
    width: 36px;
    height: 36px;
    border-radius: 9999px; /* rounded-full */
}

.video-channel-info p {
    font-size: 0.875rem; /* text-sm */
    color: #4a5568; /* gray-600 */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.card h3 {
    font-size: 1rem; /* text-lg */
    color: #1a202c; /* gray-900 */
    margin-bottom: 0.25rem; /* mb-1 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}
.card.channel-card h3 {
    text-align: center;
}
.card p {
    font-size: 0.875rem; /* text-sm */
    color: #4a5568; /* gray-600 */
}
.card.channel-card p {
    text-align: center;
}
.card p.sub-info {
    font-size: 0.75rem; /* text-xs */
    color: #718096; /* gray-500 */
    margin-top: 0.5rem; /* mt-2 */
}
.card.channel-card p.sub-info {
    text-align: center;
}


.channel-card .rank, .video-card .rank {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 1rem 0.7rem;
    background: rgb(255, 20, 20);
    color: white;
    font-size: 1rem;
    border-radius: 0.5rem;
}

.channel-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Channel Header */
.channel-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-radius: 0.5rem;
}

.channel-header:hover {
    scale: 1.02;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.channel-avatar {
    flex-shrink: 0;
}

.channel-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.channel-info {
    flex: 1;
}

.channel-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.channel-category {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.subscriber-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* Channel Stats */
.channel-stats {
    padding: 0.3rem 0rem;

}

.stat-item {
    display: grid;
    grid-template-columns: 1fr 20px 1fr;
    border-radius: 0.5rem;
    background-color: #f1f5f9;
    padding: 0.5rem;
}
.stat-option {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-item .stat-label {
    font-size: 0.9rem;
    color: #64748b;
    text-transform: uppercase;
    display: flex;
    letter-spacing: 0.05em;
    align-items: center;
}

.stat-item .stat-value {
    font-size: 1rem;
    font-weight: 600;
}

.growth-positive {
    color: #ff3232;
}

/* Channel Description */
.channel-description {
    padding: 1rem 1.5rem;
    flex: 1;
}

.channel-description p {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

/* Channel Tags */
.channel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.5rem 1rem;
}

.tag {
    background: #f1f5f9;
    color: #475569;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Recent Videos */

.recent-videos h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.video-list {
    display: flex;
    gap: 0.75rem;
}

.video-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.video-item:hover{
    scale: 1.4;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.video-item img {
    width: 100%;
    max-width: 170px;
    height: 100%;
    border-radius: 0.25rem;
    object-fit: cover;
    flex-shrink: 0;
}

.video-info {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-views {
    font-size: 0.75rem;
    color: #64748b;
}

.page_bottom{
    display:flex;
    align-items: center;
    justify-content: center;
    margin: 40px 0;
}

.pagination li{
    display:inline;
    border: none;
}

.page-item a{
    display: block;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
    padding: 5px 10px;
    float: left;
    margin-right: 5px;
}

.active{
    font-weight:600;
    color: white;
}

.active a{
    background-color: rgb(234 51 35);
    color: white;
}


/* 유틸리티 클래스 */
.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .main-layout {
        /*
            원하는 모바일 순서대로 grid-template-areas를 재정의합니다.
            1순위: nav-top
            2순위: content
            3순위: nav-bottom
        */
        grid-template-areas:
            "nav-top"
            "content"
            "nav-bottom";
        grid-template-columns: 1fr; /* 1개의 컬럼으로 변경 */
        gap: 1rem;
        padding: 0.5rem;
    }

    section#main-content {
        flex: 1;
        background-color: #fff;
        padding: 1rem;
        border-radius: 0.5rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        align-self: flex-start;
        grid-area: content;
    }

    section#main-content h1 {
        font-size: 1.5rem;
        font-weight: bold;
        margin-bottom: 1.5rem;
        color: #333;
    }

    .filter {
        scale: 1;
    }
}