/* ========================================= */
/* [1] 폰트 및 공통 변수 설정 */
/* ========================================= */
@font-face {
    font-family: 'BMJUA';
    src: url('../fonts/BMJUA_ttf.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    /* [레이아웃 크기] */
    --sidebar-width: 260px;
    --header-height: 60px;
    --bottom-nav-height: 60px;

    /* [다크 글래스 테마 색상] */
    --bg-color: #0f1115;
    --bg-gradient: linear-gradient(135deg, #0f1115 0%, #1a1d26 50%, #202430 100%);
    
    /* 컴포넌트 배경 (PC는 반투명 유지) */
    --card-bg: rgba(255, 255, 255, 0.03);
    --sidebar-bg: rgba(15, 17, 21, 0.85); /* PC는 살짝 투명 */
    --input-bg: rgba(255, 255, 255, 0.05);
    
    /* 텍스트 & 테두리 */
    --text-color: #ececf1;
    --text-muted: #949aa5;
    --border-color: rgba(255, 255, 255, 0.08);
    
    /* 포인트 컬러 */
    --primary-blue: #5e6ad2;
    --hover-bg: rgba(255, 255, 255, 0.08);
    
    /* 효과 */
    --glass-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2);
    --backdrop-blur: blur(16px);
}

/* ========================================= */
/* [2] 기본 초기화 (Reset) - 흰색 배경 박멸 */
/* ========================================= */
html {
    background-color: var(--bg-color) !important;
    height: 100%;
}

body {
    font-family: 'BMJUA', 'Noto Sans KR', sans-serif !important;
    background: var(--bg-gradient) !important;
    background-attachment: fixed !important;
    background-color: var(--bg-color) !important; /* 로딩 전 깜빡임 방지 */
    color: var(--text-color);
    margin: 0; padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul, li { list-style: none; padding: 0; margin: 0; }
button, input, textarea, select { font-family: inherit !important; }

/* ========================================= */
/* [3] 레이아웃 구조 (PC 기준) */
/* ========================================= */

/* 사이드바 (PC: 반투명 글래스) */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    background: var(--sidebar-bg) !important;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 25px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-blue);
    cursor: pointer;
}

.nav-list { flex: 1; overflow-y: auto; padding: 0 15px; }

.nav-item {
    display: flex; align-items: center;
    padding: 12px 15px; margin-bottom: 5px;
    border-radius: 12px;
    color: var(--text-muted); font-weight: 500;
    transition: all 0.2s;
}
.nav-item:hover { background-color: var(--hover-bg); color: var(--text-color); }
.nav-item.active-menu { background-color: rgba(94, 106, 210, 0.15); color: #fff; font-weight: bold; }

/* 사이드바 하단 아이콘 그룹 */
.sidebar-footer {
    padding: 15px 10px;
    border-top: 1px solid var(--border-color);
    background: transparent !important;
}

.footer-icon-group { display: flex; justify-content: space-between; gap: 5px; }

.icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 8px 4px;
    border-radius: 12px; transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center;
    flex: 1; min-width: 0;
}
.icon-btn:hover { background-color: var(--hover-bg); color: var(--primary-blue); }
.icon-btn .overlay-text { font-size: 11px; margin-top: 4px; white-space: nowrap; font-weight: 500; }
.icon-btn i, .icon-btn svg { width: 20px; height: 20px; }

/* 메인 컨텐츠 영역 */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 40px; min-height: 100vh;
    box-sizing: border-box;
}

/* ========================================= */
/* [4] 공통 컴포넌트 (카드, 버튼, 입력창) */
/* ========================================= */

/* Glass Card 디자인 */
.google-card, .profile-card, .card {
    background-color: var(--card-bg) !important;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    padding: 24px; margin-bottom: 24px;
    box-shadow: var(--glass-shadow);
    color: var(--text-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; overflow: hidden;
}

.google-card:hover {
    transform: translateY(-4px);
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.4);
}

.card-body { background-color: transparent !important; padding: 0 !important; }

/* 텍스트 가독성 강제 */
h1, h2, h3, h4, h5, h6, .fw-bold { color: #fff !important; }
.text-muted, small, .post-meta { color: var(--text-muted) !important; }

/* 입력창 (Input, Textarea) */
.form-control, input, textarea {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: #fff !important; border-radius: 12px;
}
.form-control:focus, input:focus, textarea:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-blue) !important;
    box-shadow: none !important; color: #fff !important;
}
::placeholder { color: rgba(255, 255, 255, 0.4) !important; opacity: 1; }

/* 게시글 본문 */
#main-post-content {
    padding-top: 0 !important; margin-top: 0 !important;
    line-height: 1.4 !important; text-indent: 0 !important;
}

/* 좋아요 버튼 & 아이콘 */
.btn-like {
    border: none; background: none; padding: 0;
    display: flex; align-items: center; gap: 5px;
    cursor: pointer; color: var(--text-color);
}
.heart-icon {
    width: 24px; height: 24px; fill: transparent;
    stroke: var(--text-color); stroke-width: 2px; transition: all 0.3s;
}
.heart-icon.liked { fill: #ff3b30; stroke: #ff3b30; }

/* 배지 스타일 */
.ip-badge {
    font-size: 11px; color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 6px; border-radius: 4px; margin-left: 6px;
    font-family: monospace; border: 1px solid var(--border-color);
    vertical-align: middle;
}
.admin-badge {
    font-size: 11px; color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px; padding: 2px 6px; margin-left: 6px;
    font-weight: bold; vertical-align: middle;
}

/* ========================================= */
/* [5] 댓글 및 대댓글 (트리 구조) */
/* ========================================= */
.comment-section {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 12px; padding: 15px; margin-top: 15px;
    font-size: 0.95rem; border: 1px solid var(--border-color);
    display: block;
}

.comment-item {
    position: relative; padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.comment-item:last-child { border-bottom: none; }

.comment-content {
    word-break: break-word; color: var(--text-color);
    line-height: 1.5; margin-top: 4px;
}

/* 대댓글 트리 디자인 */
.replies { margin-left: 40px; position: relative; }
.replies .comment-wrapper { position: relative; }

/* 'ㄴ'자 연결선 */
.replies .comment-wrapper::before {
    content: ''; position: absolute; top: -15px; left: -25px;
    width: 20px; height: 50px;
    border-left: 2px solid #4a4d55;
    border-bottom: 2px solid #4a4d55;
    border-bottom-left-radius: 12px; z-index: 1;
}
.replies .comment-wrapper:not(:last-child)::after {
    content: ''; position: absolute; top: 0; left: -25px;
    width: 2px; height: 100%;
    background-color: #4a4d55; z-index: 0;
}

/* 인라인 답글 입력창 */
.inline-reply-form {
    margin-top: 10px; margin-left: 10px; padding: 15px;
    border-radius: 12px; border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.05) !important;
}
.inline-reply-form .bg-light { background-color: transparent !important; }

/* ========================================= */
/* [6] 이미지 업로드 & 슬라이더 */
/* ========================================= */
.dropzone-area {
    border: 3px dashed var(--border-color);
    border-radius: 16px; background-color: rgba(255, 255, 255, 0.02);
    min-height: 200px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
.dropzone-area:hover { border-color: var(--primary-blue); background-color: rgba(94, 106, 210, 0.1); }

#image-preview-list, #main-preview-container {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px;
}
#main-preview-container:empty { display: none !important; }

.preview-item-wrapper { position: relative; width: 80px; height: 80px; }
.preview-item-wrapper img {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--border-color);
}
.preview-item-wrapper .btn-close {
    position: absolute; top: -5px; right: -5px; width: 20px; height: 20px;
    background: #ff4d4f url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/10px no-repeat;
    border-radius: 50%; opacity: 1; border: 2px solid #fff; padding: 0;
}

.post-slider-container { margin-bottom: 1rem; border-radius: 12px; overflow: hidden; }
.post-slider-container .carousel-item img {
    width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block;
}

/* ========================================= */
/* [7] 모달 및 팝업 스타일 */
/* ========================================= */
.modal-content, .image-upload-modal-content {
    background-color: #1a1d26 !important; /* 모달은 항상 불투명 */
    color: #ececf1 !important;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}
.modal-header, .modal-footer { border-color: var(--border-color) !important; }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ========================================= */
/* [8] 홈 화면 히어로 섹션 */
/* ========================================= */
.home-hero {
    text-align: center; padding: 60px 20px; margin-bottom: 40px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0) 100%);
    border: 1px solid var(--border-color); border-radius: 20px;
}
.preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; }

/* ========================================= */
/* [9] 모바일 반응형 (가독성 패치 적용) */
/* ========================================= */
.mobile-header, .mobile-bottom-nav, .sidebar-overlay { display: none !important; }

@media (max-width: 768px) {
    /* 1. 사이드바 (모바일은 불투명) */
    .sidebar {
        width: 280px; transform: translateX(-100%);
        background-color: #1a1d26 !important; /* [패치] 불투명 검정 */
        backdrop-filter: none !important;      /* [패치] 유리 효과 제거 */
        box-shadow: 4px 0 15px rgba(0,0,0,0.5);
    }
    .sidebar.show { transform: translateX(0); }
    .sidebar-footer { display: none !important; }

    /* 2. 메인 컨텐츠 여백 */
    .main-content {
        margin-left: 0 !important; width: 100% !important;
        padding: 20px !important;
        padding-top: calc(var(--header-height) + 20px) !important;
        padding-bottom: calc(var(--bottom-nav-height) + 20px) !important;
    }

    /* 3. 모바일 헤더 (불투명) */
    .mobile-header {
        display: flex !important; position: fixed; top: 0; left: 0; right: 0;
        height: var(--header-height);
        background-color: #1a1d26 !important; /* [패치] 불투명 */
        border-bottom: 1px solid var(--border-color);
        z-index: 1050; align-items: center; padding: 0 20px; justify-content: space-between;
    }

    /* 4. 모바일 하단바 (불투명) */
    .mobile-bottom-nav {
        display: flex !important; position: fixed; bottom: 0; left: 0; right: 0;
        height: var(--bottom-nav-height);
        background-color: #1a1d26 !important; /* [패치] 불투명 */
        border-top: 1px solid var(--border-color);
        z-index: 9999 !important;
        align-items: center; justify-content: space-around;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .nav-icon-item {
        display: flex; flex-direction: column; align-items: center;
        color: var(--text-muted); font-size: 0.7rem; width: 25%;
    }
    .nav-icon-item.active { color: var(--primary-blue); font-weight: bold; }
    .nav-icon-item i, .nav-icon-item svg { width: 24px; height: 24px; margin-bottom: 2px; }

    /* 오버레이 */
    .sidebar-overlay {
        display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.7); z-index: 1090;
    }
    .sidebar-overlay.show { display: block !important; }

    /* 내부 조정 */
    .preview-grid { grid-template-columns: 1fr !important; }
    
    /* 모바일 댓글 (플랫 스타일) */
    .replies { margin-left: 0; padding-left: 0; }
    .replies .comment-item {
        background-color: rgba(255, 255, 255, 0.03);
        padding: 15px 15px 15px 30px !important; margin-top: 5px; border-radius: 8px;
    }
    .replies .comment-item::before {
        content: "↪"; position: absolute; left: 10px; top: 15px;
        color: var(--text-muted); font-size: 14px;
    }
    .replies .comment-wrapper::before,
    .replies .comment-wrapper::after { content: none; }
}

/* style.css 맨 아래에 추가 */

/* 게시판 제목과 작성폼 사이 간격 확보 */
.spacer-box {
    margin-bottom: 3rem !important; /* 기존 mb-3보다 더 넓게 */
    padding-bottom: 1rem;
}

/* 무한 스크롤 애니메이션 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* [사진 크기 조정 패치] */
/* 기존 600px -> 450px로 줄이고 비율 유지 */
.post-slider-container .carousel-item img {
    max-height: 450px !important; /* 높이 제한 */
    object-fit: cover !important; /* 비율 유지하며 꽉 채우기 */
    /* aspect-ratio: 1/1; 제거하거나 auto로 두어 자연스럽게 */
    width: 100%;
}

/* [모바일] 모바일에서는 조금 더 작게 */
@media (max-width: 768px) {
    .post-slider-container .carousel-item img {
        max-height: 400px !important;
    }
}

/* ========================================= */
/* [추가] 댓글 액션 버튼 디자인 개선 (문제 2 해결) */
/* ========================================= */

/* 댓글 버튼 공통 스타일 */
.btn-comment-action {
    background: transparent;
    border: none;
    color: var(--text-muted); /* 기본: 차분한 회색 */
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none !important; /* 밑줄 제거 */
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    cursor: pointer;
}

/* 마우스 올렸을 때 (호버) 효과 */
.btn-comment-action:hover {
    background-color: rgba(255, 255, 255, 0.08); /* 살짝 밝은 배경 */
    color: var(--text-color); /* 글자 흰색 */
}

/* 기능별 포인트 컬러 (호버 시에만 적용) */
.btn-comment-action.reply:hover { color: var(--primary-blue); }    /* 답글: 파랑 */
.btn-comment-action.edit:hover { color: #fff; }                    /* 수정: 흰색 */
.btn-comment-action.delete:hover { color: #ff6b6b; }               /* 삭제: 빨강 */
.btn-comment-action.report:hover { color: #ffca28; }               /* 신고: 노랑 */

/* 모바일 날짜/수정됨 텍스트 정렬 보정 */
.comment-meta-mobile {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 4px;
    display: block;
}

/* ========================================= */
/* [추가] 게시글 관리 버튼 디자인 (게시글 수정/삭제) */
/* ========================================= */
.btn-post-action {
    background-color: rgba(255, 255, 255, 0.05); /* 투명한 유리 배경 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px; /* 둥근 모서리 */
    transition: all 0.2s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    cursor: pointer;
}

/* 마우스 올렸을 때 */
.btn-post-action:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px); /* 살짝 떠오르는 효과 */
}

/* 삭제 버튼 전용 레드 컬러 */
.btn-post-action.delete:hover {
    background-color: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border-color: #ff6b6b;
}

/* [추가] 신고 모달 및 버튼 디자인 */

/* 게시글 신고 버튼 (노란색/경고색 포인트) */
.btn-post-action.report {
    color: var(--text-muted);
}
.btn-post-action.report:hover {
    background-color: rgba(255, 202, 40, 0.15); /* 노란색 배경 */
    color: #ffca28; /* 노란 글씨 */
    border-color: #ffca28;
}

/* 신고 사유 선택 라디오 박스 디자인 */
.report-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}
.report-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-blue);
}
.report-option input[type="radio"] {
    margin-right: 10px;
    accent-color: #ff6b6b; /* 체크시 빨간색 */
}
.report-option span {
    font-size: 0.95rem;
    font-weight: 500;
}

/* [style.css 맨 아래에 추가] */

/* 1. 댓글 카운트 버튼 (유리 스타일 적용) */
.btn-post-action.comment-count {
    border-radius: 20px; /* 둥근 캡슐 모양 */
    padding: 6px 12px;
    font-size: 13px;
}

/* 2. 인라인 답글 입력창 (댓글 바로 아래 뜨는 창) */
.inline-reply-form {
    margin-top: 10px;
    margin-left: 10px;
    margin-right: 10px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 답글 입력창 내부 텍스트에어리어 */
.inline-reply-form textarea {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    font-size: 0.9rem;
}
.inline-reply-form textarea:focus {
    border-color: var(--primary-blue) !important;
}

/* [style.css 맨 아래 추가] 로그인/회원가입 인풋 디자인 */

/* 1. 비밀번호 감싸는 박스 (눈알 아이콘 위치 잡기용) */
.password-wrapper {
    position: relative;
    width: 100%;
}

/* 2. 눈알 아이콘 버튼 */
.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted); /* 회색 */
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle-password:hover {
    color: var(--text-color); /* 마우스 올리면 밝게 */
}

/* 3. 입력창 공통 스타일 (다크 테마 최적화) */
.form-control.dark-input {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    padding: 12px 15px; /* 내부 여백 넉넉하게 */
    padding-right: 40px; /* 눈알 아이콘 자리 확보 */
}

.form-control.dark-input:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-blue);
    box-shadow: none; /* 부트스트랩 파란 그림자 제거 */
    color: #fff;
}

/* placeholder 색상 (회색으로 깔끔하게) */
.form-control.dark-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}