/* /home/rocky/my_photo_website/static/css/style.css */

/* --- 기본 스타일 --- */
body {
    font-family: Arial, sans-serif;
    background-color: #ffffff; 
    margin: 0;
    padding: 0;
    color: #333;
}
.container { /* (삭제 또는 필요 시 사용) */ }

/* --- 헤더 --- */
.header {
    background-color: #333; color: #fff; padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header-content {
    max-width: 1200px; margin: 0 auto; display: flex;
    justify-content: space-between; align-items: center;
}
.logo-section {
    display: flex; align-items: center; font-size: 1.8em;
    font-weight: bold; color: #fff; white-space: nowrap;
}
.logo-image {
    width: 32px; height: 32px; margin-right: 10px;
    border-radius: 50%; display: inline-block; object-fit: cover; vertical-align: middle;
}
.logo-section a { text-decoration: none; color: inherit; }
.search-bar { display: flex; align-items: center; }
.search-bar form { display: flex; gap: 5px; }
.search-bar input[type="text"] {
    padding: 8px 15px; border: 1px solid #555; border-radius: 20px;
    width: 250px; background-color: #fff; color: #333;
}
.search-bar button {
    background-color: #007bff; color: white; border: none;
    padding: 8px 15px; border-radius: 20px; cursor: pointer; transition: background-color 0.2s;
}
.search-bar button:hover { background-color: #0056b3; }

/* --- 토글 필터 섹션 --- */
.filter-section { 
    max-width: 1200px; margin: 20px auto; padding: 0 20px; 
    background-color: transparent; border: none; box-shadow: none;
}
/* 페이지당 개수 선택 */
.filter-controls {
    text-align: left; 
    margin-bottom: 10px;
}
.filter-controls label, .filter-controls select {
    font-weight: bold;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}
/* 필터 토글 헤더 */
.filter-header { 
    background-color: #e9ecef; padding: 10px 15px; cursor: pointer;
    border-radius: 5px; font-weight: bold; margin-bottom: 5px; color: #495057;
}
.filter-options { 
    padding: 15px; background-color: #ffffff; border: 1px solid #ddd;
    border-top: none; border-radius: 0 0 5px 5px; display: none; margin-bottom: 15px;
}
.filter-options.active { display: block; }

/* 🚨 계층형 리스트 스타일 (수정됨) 🚨 */
.filter-options ul {
    list-style: none; padding: 0; margin: 0;
    display: block; /* 기본은 block (중분류 리스트) */
    width: 100%;
}
.filter-options .category-list {
    /* 중분류 리스트 (가로 정렬) */
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.filter-options .category-list li {
    list-style: none; /* li 태그 스타일 초기화 */
}
.filter-options .category-title {
    /* 중분류 제목 (컬러, 흑백 등) */
    font-weight: bold;
    font-size: 1.0em; 
    color: #212529; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 20px; /* 둥근 알약 모양 */
    background-color: #e9ecef; 
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block; 
}
.filter-options .category-title:hover {
    background-color: #dee2e6; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
}
.filter-options .category-all {
    /* '전체 보기' 링크 스타일 */
    font-weight: bold;
    font-size: 1.0em;
    color: #007bff;
    padding: 10px 15px;
    text-decoration: none;
}
.filter-options .category-back {
    /* '뒤로 가기' 링크 스타일 */
    font-weight: bold;
    font-size: 0.9em;
    color: #dc3545;
    padding: 10px 15px;
    cursor: pointer;
    text-decoration: none;
}

.filter-options .subcategory-list {
    /* 하위 항목 리스트 (초기 숨김) */
    display: none; 
    flex-wrap: wrap;
    gap: 8px; /* 태그 사이 간격 */
    padding-left: 0;
    margin-top: 10px;
}
.filter-options .subcategory-list li {
    list-style: none; 
}
.filter-options .subcategory-list li a {
    /* 하위 항목 '태그' 스타일 */
    font-size: 0.9em;
    color: #495057; 
    background-color: #fff; 
    border: 1px solid #dee2e6; 
    border-radius: 20px; /* 둥근 알약 모양 */
    padding: 6px 12px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s, color 0.2s;
}
.filter-options .subcategory-list li a:hover {
    background-color: #f8f9fa;
    color: #000;
    border-color: #ccc;
}
/* ------------------------------------- */


/* --- 사진 그리드 (PC 5열, 1:1 정사각형) --- */
.photo-grid {
    background-color: transparent;
    border: none;
    box-shadow: none;
    
    display: grid;
    grid-template-columns: repeat(5, 1fr); 
    gap: 15px; 
    padding: 20px; 
    max-width: 1200px; 
    margin: 0 auto; 
}
.photo-card {
    background-color: transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    width: 100%;
}
.photo-card a { display: block; line-height: 0; }
.photo-card img {
    width: 100%;
    aspect-ratio: 1 / 1; 
    object-fit: cover;
    
    display: block;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}
.photo-card img:hover { opacity: 0.85; }

/* 검색 결과 없음 메시지 */
.no-results { 
    grid-column: 1 / -1;
    text-align: center; 
    padding: 50px; 
    font-size: 1.5em; 
    color: #888; 
}

/* --- 상세 페이지 스타일 (기존 유지) --- */
.detail-container {
    max-width: 900px; margin: 30px auto; padding: 20px;
    background-color: #fff; 
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.detail-navigation {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid #eee;
    font-size: 0.9em; text-transform: uppercase;
}
.nav-link { 
    text-decoration: none; color: #007bff; font-weight: bold;
    padding: 5px 0; transition: color 0.2s;
}
.nav-link:hover { text-decoration: underline; color: #0056b3; }
.nav-link.disabled { color: #ccc; pointer-events: none; }
.overview-link { 
    text-decoration: none; color: #555; font-weight: bold;
    padding: 5px 10px; border: 1px solid #ccc; border-radius: 4px;
    transition: background-color 0.2s;
}
.overview-link:hover { background-color: #f0f0f0; color: #000; }
.detail-image-wrapper { text-align: center; margin-bottom: 30px; }
.detail-image { max-width: 100%; max-height: 80vh; width: auto; height: auto; display: block; margin: 0 auto; border-radius: 4px; object-fit: contain; }
.photo-meta.horizontal-meta {
    margin-top: 15px; font-size: 0.9em; line-height: 1.6;
    color: #555; text-align: center; border-top: 1px solid #eee;
    padding-top: 15px;
}
.photo-meta.horizontal-meta .meta-item {
    display: inline-block; 
    margin: 0 15px 10px 0; 
}
.photo-meta.horizontal-meta strong {
    font-weight: bold; color: #111; margin-right: 5px;
    text-transform: uppercase; font-size: 0.85em;
}
.photo-meta.horizontal-meta span { color: #555; }
.photo-meta .description.single-line-desc {
    margin-top: 10px; color: #333; font-size: 0.95em; text-align: center;
}
.back-link.simple-back-link {
    display: block; text-align: center; margin-top: 30px;
}
.back-link.simple-back-link a {
    display: inline-block; padding: 8px 18px; background-color: #6c757d;
    color: #fff; text-decoration: none; border-radius: 5px;
    transition: background-color 0.3s ease; font-size: 0.9em;
}
.back-link.simple-back-link a:hover { background-color: #5a6268; }

/* --- 페이지네이션 (가운데 정렬 및 문법 오류 수정) --- */
.pagination {
    text-align: center;
    padding: 20px 0;
}
.pagination a, .pagination .current-page {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: none;
}

.pagination a:visited,
.pagination a:hover,
.pagination a:active {
    color: #333 !important; 
    background-color: #f0f0f0; 
} 
.pagination .current-page {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

/* ================================== */
/* 모바일 화면 (화면 너비 768px 이하) */
/* ================================== */
@media (max-width: 768px) {

    /* --- 헤더 --- */
    .header-content {
        flex-direction: column; 
        align-items: center; 
        gap: 15px; 
    }
    .logo-section {
        justify-content: center; 
        width: 100%; 
    }
    .search-bar {
        width: 90%; 
        max-width: 400px; 
        margin: 0 auto; 
    }
    .search-bar form { width: 100%; }
    .search-bar input[type="text"] {
        width: 90%; 
        flex-grow: 1; 
    }
    .search-bar button {
        padding: 5px 15px;
        font-size: 0.9em;
        flex-shrink: 0;
    }

    /* --- 필터 섹션 --- */
    .filter-section { padding: 0 10px; }
    .filter-options ul { justify-content: center; }
    .filter-options .category-list { justify-content: center; } 
    .filter-options .subcategory-list { justify-content: center; } 

    /* --- 사진 그리드 (모바일 3열) --- */
    .photo-grid {
        grid-template-columns: repeat(3, 1fr); /* 3열로 변경 */
        gap: 10px; 
        padding: 10px; 
    }
    .photo-card img {
        height: auto; 
        aspect-ratio: 1 / 1; /* 1:1 비율 */
        object-fit: cover;
    }
}

/* ================================== */
/* 더 작은 모바일 화면 (480px 이하) */
/* ================================== */
@media (max-width: 480px) {
    /* 1열 그리드 주석 처리 (3열 유지) */
    /* .photo-grid {
        grid-template-columns: 1fr; 
    } 
    */ 

    .logo-section {
        font-size: 1.5em; 
    }
    .search-bar input[type="text"] {
        width: 80%; 
    }
}

/* --- 리뷰 더 보기 스타일 --- */
.review-container {
    display: inline-block; 
    margin-right: 15px;
    vertical-align: top;
}
.review-content.hidden {
    display: none; 
}
.review-content {
    display: inline; 
}
.read-more-btn {
    background: none;
    border: none;
    color: #007bff;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
    text-decoration: underline;
}
.read-more-btn:hover {
    color: #0056b3;
}

/* 모바일에서는 리뷰가 줄바꿈되어 보일 수 있음 */
@media (max-width: 768px) {
    .review-container {
        display: block; 
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .review-container {
        display: block;
        margin-bottom: 20px;
        font-size: 0.5em;
        width: 100%
    }

    .review-container strong {
        display: block;
        margin-bottom: 5px;
        font-size: 0.5em;
    }

    .review-content {
        display: block;
        line-height: 1.5;
    }

    .read-more-btn {
        front-size: 0.8em;
        margin-left: 3px;
    }
}
