/* 헤더 스타일 */
.main-header { background: var(--card-background); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 1000; border-bottom: 1px solid var(--border-color); }
.header-content { display: flex; justify-content: space-between; align-items: center; height: 70px; padding: 0 1rem; }
/* 사이트 로고 및 제목 */
.site-title { display: flex; align-items: center; gap: 0.5rem; outline: none; text-decoration: none; flex-shrink: 0; }
.site-title:focus, .site-logo:focus { outline: none; border: none; }
.site-logo { width: 150px; height: auto; outline: none; border: none; box-shadow: none; }
/* 메뉴 토글 버튼 */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 10px; z-index: 1001; }
.menu-icon { width: 24px; height: 2px; background-color: var(--text-primary); display: block; position: relative; transition: all 0.3s ease; }
.menu-icon::before, .menu-icon::after { content: ''; width: 24px; height: 2px; background-color: var(--text-primary); position: absolute; left: 0; transition: all 0.3s ease; }
.menu-icon::before { top: -8px; }
.menu-icon::after { top: 8px; }
.menu-toggle.active .menu-icon { background-color: transparent; }
.menu-toggle.active .menu-icon::before { transform: rotate(45deg); top: 0; }
.menu-toggle.active .menu-icon::after { transform: rotate(-45deg); top: 0; }

/* 검색 아이콘 스타일 */
.search-icon {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-icon:hover {
    color: var(--accent-color);
}

.search-icon svg {
    width: 20px;
    height: 20px;
}

/* 데스크톱 검색 아이콘 */
.desktop-search {
    order: 3;
    margin-left: 0.5rem;
}

/* 모바일 검색 아이콘 (메뉴 내부) */
.mobile-search {
    display: none;
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    gap: 0.5rem;
    font-size: 1rem;
}

.mobile-search:hover {
    background-color: var(--accent-color);
    color: white;
}

/* 내비게이션 - 우측 정렬 */
.main-nav { display: flex; align-items: center; flex-wrap: nowrap; gap: 0.7rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; padding-left: 1rem; }
.main-nav::-webkit-scrollbar { display: none; }
.nav-link { color: var(--text-primary); text-decoration: none; padding: 0.5rem 0.7rem; border-radius: 6px; transition: all 0.25s ease; font-size: 0.95rem; white-space: nowrap; }
.nav-link:hover, .nav-link.active { background: var(--accent-color); color: white; }
/* 컨테이너 최적화 */
.container { max-width: 1200px; width: 95%; margin: 0 auto; padding: 0 20px; }
.main-header .container { max-width: 1200px; width: 95%; }
/* 카테고리 네비게이션 - 헤더로 통합되었으므로 스타일만 유지 */
.category-nav { background: var(--card-background); padding: 1rem 0; border-bottom: 1px solid var(--border-color); }
.category-nav .container { display: flex; gap: 1rem; overflow-x: auto; padding: 0 1rem; }
.category-link { color: var(--text-primary); text-decoration: none; padding: 0.5rem 1rem; border-radius: 6px; white-space: nowrap; transition: all 0.2s ease; }
.category-link:hover, .category-link.active { background: var(--accent-color); color: white; }
/* 반응형 */
@media (max-width: 1024px) { 
    .site-logo { width: 130px; } 
    .nav-link { padding: 0.5rem 0.6rem; font-size: 0.9rem; }
    .desktop-search { margin-right: 0.5rem; }
}
@media (max-width: 768px) {
    .container, .main-header .container { width: 100%; padding: 0; }
    .header-content { padding: 0 0.5rem; }
    .site-title { font-size: 1.2rem; }
    .site-logo { width: 120px; }
    .menu-toggle { display: block; order: 3; }
    .desktop-search { display: none; } /* 데스크톱 검색 아이콘 숨김 */
    .mobile-search { display: flex; } /* 모바일 메뉴 내 검색 아이콘 표시 */
    .main-nav { display: none; flex-direction: column; align-items: flex-start; position: absolute; top: 70px; left: 0; width: 100%; background-color: var(--card-background); box-shadow: var(--shadow-lg); z-index: 1001; padding: 1rem; border-radius: 0 0 12px 12px; border-top: 1px solid var(--border-color); max-height: 80vh; overflow-y: auto; }
    .main-nav.active { display: flex; animation: slideDown 0.3s ease; }
    .nav-link { width: 100%; padding: 0.8rem 1rem; border-radius: 8px; font-size: 1rem; }
    .nav-link:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.1); }
    .category-nav .container { padding: 0; }
}
@media (max-width: 480px) { 
    .container, .main-header .container { width: 100%; padding: 0; }
    .header-content { height: 60px; }
    .site-logo { width: 110px; }
    .main-nav { top: 60px; }
    .nav-link { padding: 0.7rem 0.9rem; }
    .mobile-search { font-size: 0.95rem; }
}
/* 애니메이션 */
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* 검색 결과 페이지 스타일 */
.search-results {
    min-height: calc(100vh - 300px);
}

/* 기본 설정 */
@font-face { font-family: 'GmarketSansMedium'; src: local('GmarketSansMedium'), url('/GmarketSansMedium.woff') format('woff'); font-weight: normal; font-style: normal; font-display: swap; }
:root { --primary-color: #e9ecef; --accent-color: #60a5fa; --background-color: #0f172a; --card-background: #1e293b; --text-primary: #f8fafc; --text-secondary: #94a3b8; --border-color: #2d3748; --hover-color: #3b82f6; --shadow-sm: 0 2px 4px rgba(0,0,0,0.2); --shadow-md: 0 4px 6px rgba(0,0,0,0.3); --shadow-lg: 0 10px 15px rgba(0,0,0,0.3); --transition: all 0.3s ease; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'GmarketSansMedium', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: var(--background-color); color: var(--text-primary); line-height: 1.6; }

/* 상단 추천 게시글 섹션 */
.featured-posts { padding: 60px 0; background: var(--card-background); margin-bottom: 40px; box-shadow: var(--shadow-sm); }
.section-title { text-align: center; font-size: 28px; margin-bottom: 40px; color: var(--text-primary); position: relative; }
.section-title::after { content: ''; display: block; width: 50px; height: 3px; background: var(--accent-color); margin: 15px auto 0; border-radius: 2px; }
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; list-style: none; padding: 0; }
.featured-item { border-radius: 12px; overflow: hidden; background: var(--card-background); box-shadow: var(--shadow-md); transition: var(--transition); }
.featured-item:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.featured-link { text-decoration: none; color: inherit; display: block; }
.featured-image-wrapper { position: relative; padding-top: 60%; overflow: hidden; }
.featured-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: var(--transition); }
.featured-item:hover .featured-image { transform: scale(1.05); }
.featured-content { padding: 20px; }
.featured-category { display: inline-block; background: var(--accent-color); color: white; padding: 4px 12px; border-radius: 20px; font-size: 14px; margin-bottom: 12px; }
.featured-title { font-size: 18px; margin-bottom: 12px; color: var(--text-primary); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.featured-meta { display: flex; justify-content: space-between; color: var(--text-secondary); font-size: 14px; }

/* 일반 게시글 목록 */
.post-list { padding-top: 17px; }
.post-item { background: var(--card-background); border-radius: 12px; overflow: hidden; margin-bottom: 30px; box-shadow: var(--shadow-md); transition: var(--transition); }
.post-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.post-link { display: flex; text-decoration: none; color: inherit; }
.post-thumbnail { flex: 0 0 280px; position: relative; height: 260px; overflow: hidden; border-radius: 12px 0 0 12px; }
.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.post-content { flex: 1; padding: 25px; display: flex; flex-direction: column; }
.post-header { margin-bottom: 15px; }
.post-category { display: inline-block; background: var(--accent-color); color: white; padding: 4px 12px; border-radius: 20px; font-size: 14px; margin-bottom: 10px; }
.post-title { font-size: 22px; color: var(--text-primary); line-height: 1.4; margin: 0 0 15px; }
.post-excerpt { color: var(--text-secondary); font-size: 15px; line-height: 1.6; margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--text-secondary); font-size: 14px; }

/* 페이지네이션 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 50px; padding: 20px 0; }
.pagination a { color: var(--text-primary); text-decoration: none; padding: 8px 16px; border-radius: 6px; transition: var(--transition); }
.pagination a.active { background: var(--accent-color); color: white; }
.pagination a:hover:not(.active) { background: var(--border-color); }
.page-dots { color: var(--text-secondary); }
.page-arrow { display: flex; align-items: center; justify-content: center; }

/* 총개시물 스타일 */
.post-list-header { display: flex; justify-content: flex-end; margin-bottom: 15px; }
.post-count { color: var(--text-secondary); font-size: 15px; background: var(--card-background); padding: 6px 12px; border-radius: 15px; box-shadow: var(--shadow-sm); }

/* 모바일 최적화 */
@media (max-width: 768px) {
    .featured-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px; }
    .post-link { flex-direction: column; }
    .post-thumbnail { flex: none; width: 100%; height: 200px; border-radius: 12px 12px 0 0; }
    .post-content { padding: 15px; }
    .post-title { font-size: 18px; margin-bottom: 10px; }
    .post-excerpt { font-size: 14px; margin-bottom: 10px; -webkit-line-clamp: 2; }
    .featured-posts { padding: 30px 5px; margin-bottom: 20px; }
    .section-title { font-size: 22px; margin-bottom: 25px; }
    .featured-content { padding: 12px; }
    .featured-title { font-size: 16px; margin-bottom: 8px; }
    .post-meta, .featured-meta { font-size: 12px; }
}
@media (max-width: 480px) {
    .featured-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .post-thumbnail { height: 180px; }
    .post-title { font-size: 17px; }
    .featured-category, .post-category { font-size: 12px; padding: 3px 10px; }
    .pagination { gap: 5px; }
    .pagination a { padding: 6px 12px; font-size: 14px; }
    .featured-title { font-size: 14px; }
    .featured-content { padding: 8px; }
}

/* 애니메이션 */
.post-item { animation: fadeIn 0.6s ease backwards; }
.post-item:nth-child(1) { animation-delay: 0.1s; }
.post-item:nth-child(2) { animation-delay: 0.2s; }
.post-item:nth-child(3) { animation-delay: 0.3s; }
.post-item:nth-child(4) { animation-delay: 0.4s; }
.post-item:nth-child(5) { animation-delay: 0.5s; }

/* 접근성 */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
a:focus { outline: 3px solid var(--accent-color); outline-offset: 2px; }

/* 검색 창 스타일 */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-container {
    width: 90%;
    max-width: 600px;
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s;
    border: 1px solid var(--border-color);
}

.search-overlay.active .search-container {
    transform: translateY(0);
}

.search-form {
    display: flex;
    position: relative;
}

.search-input {
    flex: 1;
    border: none;
    border-bottom: 2px solid var(--border-color);
    background-color: transparent;
    padding: 0.8rem 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: var(--accent-color);
}

.search-submit {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 0.8rem;
    cursor: pointer;
    transition: color 0.3s;
}

.search-submit:hover {
    color: var(--accent-color);
}

.search-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 50%;
    transition: background-color 0.3s;
}

.search-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.recent-searches {
    margin-top: 1.5rem;
}

.recent-searches h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* 푸터 검색 버튼 */
.search-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-toggle svg {
    width: 16px;
    height: 16px;
}

/* 검색 결과 페이지 스타일 */
.search-form-container {
    margin-bottom: 1.5rem;
}

.search-form-main {
    display: flex;
    position: relative;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.search-input-main {
    flex: 1;
    border: none;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s;
}

.search-input-main:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.search-submit-main {
    background: var(--accent-color);
    border: none;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-submit-main:hover {
    background-color: var(--hover-color);
}

/* 검색 결과 섹션 스타일 */
.search-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.search-info {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.search-filters {
    background-color: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

.filter-group label {
    margin-right: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background-color: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.search-tag:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* 검색 결과 아이템 스타일 */
.search-post {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.search-post:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.search-post:last-child {
    border-bottom: none;
}

.search-post .post-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    padding: 1rem;
}

.search-post .post-title {
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    transition: color 0.2s;
}

.search-post .post-link:hover .post-title {
    color: var(--accent-color);
}

.search-post .post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

mark {
    background-color: rgba(96, 165, 250, 0.3);
    color: var(--accent-color);
    padding: 0.1em 0;
    border-radius: 2px;
}

/* 검색 결과 없음 스타일 */
.no-results {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.no-results h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-results p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.no-results ul {
    display: inline-block;
    text-align: left;
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.no-results li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* 모바일 검색 스타일 추가 */
@media (max-width: 768px) {
    .search-filters {
        padding: 0.8rem;
    }
    
    .filter-form {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .filter-group {
        width: 100%;
        margin-right: 0;
    }
    
    .filter-group select {
        width: 100%;
        flex: 1;
    }
    
    .search-post .post-link {
        flex-direction: column;
    }
    
    .search-post .post-thumbnail {
        flex: 0 0 auto;
        width: 100%;
        height: 160px;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .search-container {
        width: 95%;
        padding: 1.5rem;
    }
    
    .search-form-main {
        margin-bottom: 1rem;
    }
    
    .search-input-main {
        padding: 0.7rem 1.2rem;
        font-size: 0.95rem;
    }
    
    .search-submit-main {
        width: 36px;
        height: 36px;
    }
}