/* ========================================
   배경 씬 라이브러리 페이지 스타일
   ======================================== */

/* 페이지 헤더 */
.backgrounds-page {
    min-height: calc(100vh - var(--navbar-height));
    padding: var(--spacing-2xl) 0;
}

.page-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.page-header h1 {
    font-size: var(--font-4xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.page-description {
    font-size: var(--font-lg);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.last-updated {
    font-size: var(--font-sm);
    color: var(--text-light);
}

/* 필터 섹션 */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    padding-left: 3rem;
    border: 2px solid #eee;
    border-radius: var(--border-radius-full);
    font-size: var(--font-base);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 136, 0, 0.1);
}

.search-icon {
    position: absolute;
    left: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    flex: 2;
}

.filter-tag {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid #eee;
    border-radius: var(--border-radius-full);
    background: var(--bg-white);
    cursor: pointer;
    font-size: var(--font-sm);
    font-weight: 500;
    transition: var(--transition);
}

.filter-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-tag.active {
    background: var(--gradient-main);
    color: white;
    border-color: transparent;
}

.view-options {
    display: flex;
    gap: var(--spacing-xs);
}

.view-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #eee;
    border-radius: var(--border-radius-sm);
    background: var(--bg-white);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.view-btn:hover {
    border-color: var(--primary-color);
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: transparent;
}

/* 통계 바 */
.stats-bar {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.stat-item strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* 배경 그리드 */
.backgrounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.backgrounds-grid.list-view {
    grid-template-columns: 1fr;
}

/* 배경 카드 */
.background-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    cursor: pointer;
}

.background-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

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

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

.background-card:hover .card-thumbnail img {
    transform: scale(1.05);
}

.card-thumbnail .no-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    color: var(--text-light);
    font-size: 3rem;
}

.card-category {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: var(--font-xs);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
}

.card-content {
    padding: var(--spacing-md);
}

.card-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.card-tag {
    padding: 2px 8px;
    background: var(--bg-gray);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    border-radius: var(--border-radius-sm);
}

/* 리스트 뷰 카드 */
.backgrounds-grid.list-view .background-card {
    display: flex;
    flex-direction: row;
}

.backgrounds-grid.list-view .card-thumbnail {
    width: 200px;
    min-width: 200px;
    aspect-ratio: auto;
    height: 112px;
}

.backgrounds-grid.list-view .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 로딩 */
.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-3xl);
    color: var(--text-secondary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

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

/* 데이터 없음 / 검색 결과 없음 */
.no-data,
.no-results {
    text-align: center;
    padding: var(--spacing-3xl);
    color: var(--text-secondary);
}

.no-data-icon,
.no-results-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

.no-data h3,
.no-results h3 {
    font-size: var(--font-2xl);
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

/* 모달 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-info {
    background: var(--bg-white);
    padding: var(--spacing-lg);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-top: -5px;
}

.modal-info h3 {
    font-size: var(--font-xl);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.modal-info p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.modal-tags .card-tag {
    background: var(--primary-color);
    color: white;
}

/* 반응형 */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: var(--font-3xl);
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-tags {
        justify-content: center;
    }

    .view-options {
        justify-content: center;
    }

    .backgrounds-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .backgrounds-grid.list-view .background-card {
        flex-direction: column;
    }

    .backgrounds-grid.list-view .card-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .stats-bar {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .backgrounds-grid {
        grid-template-columns: 1fr;
    }
}
