/* style.css - 2026.01.06 완전 통합본 (헤더 수정 + 기존 기능 100% 유지) */

/* 1. 기본 설정 (폰트, 배경) */
@font-face {
    font-family: 'ZenSerif';
    src: url('fonts/ZEN-SERIF-Regular.otf') format('opentype'),
         url('fonts/ZEN-SERIF-TTF-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: 'ZenSerif', serif;
    background-color: #ffffff;
    margin: 0;
    color: #333;
}

button, input, textarea, select, .filter-tag, .admin-badge, .logo {
    font-family: 'ZenSerif', serif !important;
}

/* 2. 고정 헤더 (여기가 수정된 부분입니다) */
.sticky-header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    padding: 10px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    backdrop-filter: blur(5px);
}

/* [수정] 헤더 레이아웃: 정중앙 로고 구현 */
.header-top {
    display: flex;
    justify-content: space-between; /* 좌우 끝으로 밀기 */
    align-items: center;
    position: relative; /* 로고 위치 기준점 */
    height: 40px; /* 높이 고정 */
    margin-bottom: 10px;
}

/* [신규] 왼쪽/오른쪽 영역 확보 */
.header-left, .header-right {
    z-index: 10; /* 로고보다 위에 오게 함 (클릭 가능하도록) */
    display: flex; 
    align-items: center;
    gap: 10px;
}

/* [수정] 로고: 무조건 화면 정중앙 위치 */
.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
    letter-spacing: -1px;
    white-space: nowrap;
    
    /* [수정] 아래 두 줄을 추가하세요! */
    z-index: 20;       /* 양옆 버튼(z-index:10)보다 위로 올리기 */
    cursor: pointer;   /* 마우스 올리면 손가락 모양 나오게 하기 */
}

/* [신규] 새로고침 버튼 스타일 */
.refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #f0f0f0;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
}
.refresh-btn:hover {
    background-color: #e0e0e0;
    transform: rotate(180deg);
}

/* [수정] 관리자 뱃지 (로그인/로그아웃) - 절대 위치 제거 */
.admin-badge {
    /* position: absolute;  <-- 삭제 */
    /* right: 0; <-- 삭제 */
    font-size: 0.7em;
    text-decoration: none;
    color: #999;
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}
.admin-badge:hover {
    background: #f0f0f0;
    color: #333;
}

/* 3. 태그 필터 바 */
.tag-filter-bar {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    padding-bottom: 5px;    
    margin-bottom: 2px;
    scrollbar-width: none;
    cursor: grab;
    user-select: none;
}
.tag-filter-bar.active {
    cursor: grabbing;
}
.tag-filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-tag {
    background: #f0f0f0;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    color: #555;
    font-family: 'Nanum Gothic', sans-serif;
    transition: all 0.2s;
}

.filter-tag.active {
    background: #000;
    color: #fff;
    font-weight: bold;
}

.filter-tag:hover {
    background: #ddd;
}

/* 4. 검색창 및 컨트롤 */
.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 0 5px 10px 5px;
    max-width: 100%;
}

#search-box {
    flex: 1;
    max-width: 600px;
    box-sizing: border-box;
    padding: 10px 15px;
    font-size: 14px;
    font-family: 'Nanum Gothic', sans-serif;
    border: 1px solid #ddd;
    border-radius: 25px;
    background-color: #f9f9f9;
    transition: all 0.2s;
    outline: none;
}

#search-box:focus {
    background-color: #fff;
    border-color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.new-post-toggle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    position: relative; 
    font-size: 0;
    transition: transform 0.2s;
}
.new-post-toggle-btn::before {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); width: 18px; height: 2px;
    background-color: #fff; border-radius: 1px;
}
.new-post-toggle-btn::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); width: 2px; height: 18px;
    background-color: #fff; border-radius: 1px;
}
.new-post-toggle-btn:hover {
    background-color: #333;
    transform: rotate(90deg);
}

.controls {
    text-align: center;
    font-size: 0.9em;
}
.control-btn {
    background: white;
    border: 1px solid #333;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    margin-right: 5px;
    font-family: 'Nanum Gothic', sans-serif;
}
.control-btn:hover { background: #f9f9f9; }
.control-btn.active-mode {
    background: #ff4081; color: white; border-color: #ff4081;
}

/* 5. 업로드 섹션 */
.upload-section {
    background: #fafafa;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    border-radius: 10px;
}
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.9em;
}
textarea {
    width: 100%; padding: 10px; border: 1px solid #ddd;
    border-radius: 4px; resize: vertical; font-family: inherit; box-sizing: border-box;
}
.ingredients-wrapper { margin: 15px 0; }
.tags-container { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.tag-checkbox span {
    background: #fff; border: 1px solid #eee; padding: 4px 8px;
    border-radius: 20px; font-size: 0.8em; cursor: pointer;
}
.tag-checkbox input:checked + span { background: #333; color: white; }
.tag-checkbox input { display: none; }
input[type="text"] {
    width: 100%; padding: 8px; border: 1px solid #ddd;
    border-radius: 4px; box-sizing: border-box;
}
.upload-btn {
    width: 100%; background-color: #000; color: white; padding: 10px;
    border: none; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 1em;
}
.upload-btn:hover { background-color: #333; }

/* 6. 갤러리 그리드 */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 300px));
    gap: 15px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    justify-content: center;
}
.card {
    background: white; position: relative; cursor: pointer; transition: transform 0.2s;
}
.card:hover { transform: translateY(-3px); }
.card-image-wrapper {
    width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
    border-radius: 8px; position: relative;
}
.card-image-wrapper img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.card-fav-icon {
    position: absolute; 
    top: 8px; 
    left: 8px; 
    font-size: 15px;
    color: rgba(255,255,255,0.5); 
    cursor: pointer; 
    z-index: 5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); 
    transition: all 0.2s;
    
    /* [수정] 아래 두 줄을 추가하면 회색 네모가 사라집니다! */
    background: none; 
    border: none;
    padding: 0; /* 버튼 안쪽 여백도 없애면 더 깔끔합니다 */
}
.card-fav-icon:hover { transform: scale(1.1); }
.card-fav-icon.active { color: #ff4081; opacity: 1; }

.edit-overlay-btn {
    position: absolute; top: 8px; right: 8px; z-index: 20;
    font-size: 17px; line-height: 1.2; font-weight: bold;
    text-decoration: none; cursor: pointer; color: white; 
    mix-blend-mode: difference; opacity: 0.7;
    transition: transform 0.2s, opacity 0.2s;
}
.edit-overlay-btn:hover { opacity: 1.0; transform: scale(1.1); }

.card-info { padding: 12px 10px; }
.card-title {
    display: block; font-weight: bold; font-size: 1.15em;
    margin-bottom: 6px; line-height: 1.2; color: #111;
}
.star-display { display: flex; gap: 2px; margin-bottom: 10px; }
.star { font-size: 16px; color: #ddd; cursor: pointer; }
.star.filled { color: #ffd700; }
.tags { margin-bottom: 5px; line-height: 1.6; }
.hashtag {
    display: inline-block; color: #555; font-size: 0.85em;
    margin-right: 4px; cursor: pointer; font-weight: bold;
}
.hashtag:hover { text-decoration: underline; color: #555; }

/* 8. 상세 보기 모달 (Lightbox) */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); 
    justify-content: center; align-items: center; padding: 20px; box-sizing: border-box;
}
.modal-content {
    background-color: #000; width: fit-content; max-width: 95%; height: 85vh;
    border-radius: 15px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden; display: flex; position: relative; flex-direction: row;
}
.close-modal {
    position: absolute; top: 20px; right: 20px; color: white; 
    font-size: 40px; font-weight: 300; cursor: pointer; z-index: 2005;
    background: none; border: none; line-height: 1; mix-blend-mode: difference;
}
.modal-body { display: flex; width: 100%; height: 100%; }

.modal-image-area {
    background: #000; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; align-items: center;
    justify-content: flex-start; padding: 40px; scrollbar-width: none; 
}
.modal-image-area::-webkit-scrollbar { display: none; }
.modal-image-area img {
    max-height: calc(85vh - 80px); width: auto; object-fit: contain; 
    display: block; margin-bottom: 20px;
}

/* 모달 정보 영역 (공유 버튼 위치 기준점) */
.modal-info-area {
    width: 350px; flex: none; padding: 40px;
    display: flex; flex-direction: column; overflow-y: auto;
    background: white; height: 100%; box-sizing: border-box;
    border-left: 1px solid #eee;
    
    position: relative; /* 공유 버튼 위치 기준 */
    padding-bottom: 80px !important; /* 버튼이 내용 가리지 않게 여백 확보 */
}

#modal-title {
    margin-top: 0; font-size: 1.2em; border-bottom: 2px solid #000;
    padding-bottom: 10px; margin-bottom: 20px;
}
.modal-desc-text {
    font-size: 1em; line-height: 1.6; margin-bottom: 20px;
    white-space: pre-wrap; color: #444;
}
.modal-tags-list { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-tags-list .hashtag {
    font-size: 0.9em; background: #f0f0f0; padding: 4px 10px;
    border-radius: 15px; text-decoration: none; color: #333;
}

/* 모바일 슬라이드 영역 (PC에선 숨김) */
.mobile-info-slide { display: none; }

/* 공유 버튼 스타일 (원형 아이콘) */
.share-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    
    width: 45px;
    height: 45px;
    border-radius: 50%;
    
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    cursor: pointer;
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    transition: all 0.2s;
    z-index: 10;
    padding: 0;
}

.share-btn:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
    transform: scale(1.05);
}

.share-btn svg {
    width: 20px;
    height: 20px;
    fill: #555;
    transition: fill 0.2s;
}

.share-btn:hover svg {
    fill: #000;
}

/* 9. 모바일 반응형 */
@media (max-width: 768px) {
    .gallery { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 10px; }
    .modal { padding: 0 !important; background-color: #000 !important; }
    .modal-content {
        flex-direction: column; width: 100vw !important; height: 100dvh !important;
        max-width: none !important; max-height: none !important;
        border-radius: 0 !important; box-shadow: none !important; background: black;
    }
    .modal-image-area {
        flex-direction: row; overflow-x: auto; overflow-y: hidden;
        scroll-snap-type: x mandatory; padding: 0 !important; align-items: flex-start;
    }
    .mobile-slide-item, .mobile-info-slide {
        width: 100vw; height: 100dvh; min-width: 100vw; min-height: 100dvh;
        scroll-snap-align: center; flex-shrink: 0; margin: 0 !important;
        box-sizing: border-box; display: flex; align-items: flex-start;
        justify-content: center; padding: 0 !important;
    }
    .mobile-slide-item img {
        width: 100vw !important; height: auto !important; max-width: none !important;
        max-height: none !important; margin: 0 !important;
        object-fit: contain; object-position: top center;
    }
    
    /* 모바일 정보 슬라이드 */
    .mobile-info-slide {
        background: white; padding: 40px 20px 80px 20px !important; 
        overflow-y: auto; flex-direction: column !important;
        justify-content: flex-start !important; align-items: flex-start !important;
        
        position: relative; /* 공유 버튼 기준 */
    }
    
    .mobile-info-slide h2 {
        border-bottom: 2px solid #000; padding-bottom: 10px;
        margin-top: 0; width: 100%;
    }
    .mobile-info-slide .modal-desc-text {
        font-size: 1.1em; line-height: 1.6; color: #111;
        margin-top: 20px; width: 100%;
    }
    .mobile-info-slide .modal-tags-list {
        margin-top: 20px; gap: 10px; width: 100%;
    }
    .modal-info-area { display: none !important; }
    .close-modal {
        top: auto; bottom: 30px; left: 50%; right: auto;
        transform: translateX(-50%); font-size: 50px; opacity: 0.9;
    }
    
    /* 모바일 공유 버튼 위치 조정 */
    .share-btn {
        bottom: 25px;
        right: 25px;
        width: 50px;
        height: 50px;
        background-color: white;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
}

/* 10. 로그인 페이지 전용 스타일 */
.login-body {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; background-color: #f9f9f9; margin: 0;
}
.login-box {
    background: white; width: 100%; max-width: 400px;
    padding: 50px 40px; border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05); text-align: center;
}
.login-box h2 {
    margin-top: 0; margin-bottom: 30px; font-size: 1.8em; letter-spacing: -0.5px;
}
.login-box input {
    width: 100%; padding: 12px 15px; margin-bottom: 12px;
    border: 1px solid #ddd; border-radius: 8px; font-size: 16px;
    box-sizing: border-box; transition: border-color 0.2s;
}
.login-box input:focus { outline: none; border-color: #333; }
.login-box button.upload-btn {
    width: 100%; margin-top: 10px; padding: 12px;
    font-size: 16px; background-color: #000; color: #fff; border-radius: 8px;
}
.login-box a { display: inline-block; margin-top: 20px; color: #999; }

/* 로그인 체크박스 스타일 유지 */
.checkbox-container { text-align: left; margin-bottom: 15px; padding-left: 2px; }
.save-id-label {
    display: inline-flex; align-items: center; font-size: 14px;
    color: #666; cursor: pointer; font-family: 'Nanum Gothic', sans-serif;
}
.save-id-label input {
    width: auto !important; margin: 0 8px 0 0 !important;
    cursor: pointer; transform: scale(1.2);
}
.save-id-label input:checked + span { color: #333; font-weight: bold; }

/* 게스트용 읽기 전용 별점 */
.star.readonly {
    cursor: default !important;
}
.star.readonly:hover {
    transform: none !important;
    color: #ddd !important;
}
.star.readonly.filled:hover {
    color: #ffd700 !important;
}