/* ========================================
   커뮤니티 페이지 스타일
   ======================================== */

/* 헤더 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo svg {
    width: 36px;
    height: 36px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #5d4037;
}

.logo-text span {
    color: #8d6e63;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 사용자 메뉴 */
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: #faf8f5;
    border-radius: 24px;
    cursor: pointer;
    position: relative;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-email {
    font-size: 13px;
    color: #5d4037;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    color: #8d6e63;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    min-width: 160px;
    z-index: 100;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.user-dropdown a:hover {
    background-color: #faf8f5;
}

/* 메인 컨텐츠 */
.community-main {
    min-height: calc(100vh - 200px);
    background-color: #faf8f5;
    padding: 40px 20px;
}

.community-container {
    max-width: 800px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #5d4037;
    margin: 0 0 8px 0;
}

.page-subtitle {
    color: #8d6e63;
    font-size: 15px;
    margin: 0;
}

/* 글쓰기 폼 */
.post-form {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.post-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #5d4037;
    font-weight: 500;
}

.post-form-header:hover {
    background-color: #faf8f5;
}

.post-form-header svg {
    color: #8d6e63;
    transition: transform 0.2s;
}

.post-form.open .post-form-header svg {
    transform: rotate(45deg);
}

.post-form-body {
    padding: 0 20px 20px;
    border-top: 1px solid #eee;
}

.post-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
    box-sizing: border-box;
}

.post-input:focus {
    outline: none;
    border-color: #8d6e63;
}

.post-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    box-sizing: border-box;
}

.post-textarea:focus {
    outline: none;
    border-color: #8d6e63;
}

.post-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

/* 이미지 삽입 도구 */
.post-image-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.image-insert-btn {
    padding: 6px 12px;
    border: 1px solid #d7ccc8;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #5d4037;
    transition: background 0.2s;
}

.image-insert-btn:hover {
    background: #efebe9;
}

.image-hint {
    font-size: 11px;
    color: #999;
}

/* 이미지 미리보기 */
.post-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.preview-image-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.preview-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

.preview-image-remove:hover {
    background: rgba(0,0,0,0.8);
}

/* 게시글 본문 이미지 */
.post-content-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
}

.post-content-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
    display: block;
}

.anonymous-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.anonymous-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 게시글 목록 */
.post-list {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.post-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item:hover {
    background-color: #faf8f5;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.post-category {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.post-category.general {
    background-color: #e3f2fd;
    color: #1976d2;
}

.post-category.bug {
    background-color: #ffebee;
    color: #c62828;
}

.post-category.suggestion {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.post-category.question {
    background-color: #fff3e0;
    color: #ef6c00;
}

.post-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.post-comments {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-comments svg {
    color: #bbb;
}

.post-empty,
.post-loading,
.post-error {
    padding: 60px 20px;
    text-align: center;
    color: #8d6e63;
}

.post-empty svg {
    margin-bottom: 16px;
    stroke: #d7ccc8;
}

.post-empty p {
    margin: 4px 0;
    font-size: 14px;
}

/* 더보기 버튼 */
.post-more {
    text-align: center;
    margin-top: 16px;
}

/* 게시글 상세 모달 */
.post-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.post-modal {
    background-color: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.post-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.post-modal-header .post-category {
    margin-bottom: 8px;
    display: inline-block;
}

.post-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding-right: 30px;
}

.post-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.post-modal-close:hover {
    background-color: #f5f5f5;
    color: #333;
}

.post-modal-meta {
    padding: 12px 20px;
    background-color: #faf8f5;
    font-size: 13px;
    color: #8d6e63;
    display: flex;
    gap: 16px;
}

.post-modal-content {
    padding: 20px;
    font-size: 15px;
    line-height: 1.7;
    color: #333;
    min-height: 100px;
    border-bottom: 1px solid #eee;
    white-space: pre-wrap;
}

.post-modal-comments {
    padding: 20px;
}

.post-modal-comments h4 {
    font-size: 14px;
    font-weight: 600;
    color: #5d4037;
    margin: 0 0 16px 0;
}

.comment-list {
    margin-bottom: 16px;
}

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-author {
    font-size: 13px;
    font-weight: 500;
    color: #5d4037;
}

.comment-author.admin {
    color: #e53935;
}

.comment-author.admin::after {
    content: "관리자";
    margin-left: 4px;
    padding: 1px 4px;
    background-color: #ffebee;
    border-radius: 3px;
    font-size: 10px;
}

.comment-time {
    font-size: 12px;
    color: #999;
}

.comment-delete {
    margin-left: auto;
    padding: 2px 6px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
}

.comment-delete:hover {
    color: #e53935;
}

.comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.comment-empty,
.comment-loading,
.comment-error {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.comment-form {
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    box-sizing: border-box;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #8d6e63;
}

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.post-modal-actions {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

/* 푸터 */
.footer {
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 30px 20px;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.footer-info {
    margin-bottom: 16px;
}

.footer-info p {
    margin: 4px 0;
    font-size: 12px;
    color: #999;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-links a {
    color: #5d4037;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-links a.active {
    color: #8d6e63;
}

.copyright {
    font-size: 12px;
    color: #bbb;
    margin: 0;
}

/* 버튼 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #5d4037;
    color: #fff;
}

.btn-primary:hover {
    background-color: #4e342e;
}

.btn-secondary {
    background-color: #efebe9;
    color: #5d4037;
}

.btn-secondary:hover {
    background-color: #d7ccc8;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========================================
   반응형 - 모바일 (768px 이하)
   ======================================== */
@media (max-width: 768px) {
    .header {
        padding: 10px 16px;
    }

    .logo-text {
        font-size: 18px;
    }

    .user-email {
        display: none;
    }

    .dropdown-arrow {
        display: none;
    }

    .community-main {
        padding: 24px 16px;
    }

    .page-header {
        margin-bottom: 24px;
    }

    .page-title {
        font-size: 22px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    /* 글쓰기 폼 */
    .post-form-header {
        padding: 14px 16px;
        font-size: 14px;
    }

    .post-form-body {
        padding: 0 16px 16px;
    }

    .post-input,
    .post-textarea {
        padding: 12px 14px;
        font-size: 16px;
    }

    .post-form-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .post-form-actions .btn {
        width: 100%;
        padding: 12px;
    }

    /* 게시글 목록 */
    .post-item {
        padding: 14px 16px;
    }

    .post-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .post-title {
        font-size: 14px;
        flex: 1 1 100%;
        order: 2;
    }

    .post-category {
        order: 1;
    }

    .post-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
    }

    /* 모달 */
    .post-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .post-modal {
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }

    .post-modal-header {
        padding: 16px;
    }

    .post-modal-header h3 {
        font-size: 16px;
    }

    .post-modal-meta {
        padding: 10px 16px;
        font-size: 12px;
        gap: 12px;
    }

    .post-modal-content {
        padding: 16px;
        font-size: 14px;
    }

    .post-modal-comments {
        padding: 16px;
    }

    .comment-form textarea {
        font-size: 16px;
    }

    .comment-form-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .comment-form-actions .btn {
        width: 100%;
    }

    /* 푸터 */
    .footer {
        padding: 24px 16px;
    }

    .footer-links {
        gap: 16px;
        flex-wrap: wrap;
    }

    .footer-info p {
        font-size: 11px;
    }
}

/* ========================================
   반응형 - 작은 모바일 (480px 이하)
   ======================================== */
@media (max-width: 480px) {
    .header {
        padding: 8px 12px;
    }

    .logo svg {
        width: 28px;
        height: 28px;
    }

    .logo-text {
        font-size: 16px;
    }

    .user-menu {
        padding: 4px 8px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .community-main {
        padding: 16px 12px;
    }

    .page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 12px;
    }

    /* 글쓰기 폼 */
    .post-form-header {
        padding: 12px 14px;
        font-size: 13px;
    }

    .post-form-body {
        padding: 0 14px 14px;
    }

    .post-input,
    .post-textarea {
        padding: 10px 12px;
        margin-top: 10px;
    }

    .anonymous-check {
        font-size: 12px;
    }

    /* 게시글 목록 */
    .post-item {
        padding: 12px 14px;
    }

    .post-category {
        padding: 2px 6px;
        font-size: 10px;
    }

    .post-title {
        font-size: 13px;
    }

    .post-meta {
        font-size: 10px;
    }

    .post-comments svg {
        width: 12px;
        height: 12px;
    }

    /* 모달 */
    .post-modal-header {
        padding: 14px;
    }

    .post-modal-header h3 {
        font-size: 15px;
    }

    .post-modal-close {
        width: 28px;
        height: 28px;
        font-size: 20px;
    }

    .post-modal-content {
        padding: 14px;
        font-size: 13px;
        min-height: 80px;
    }

    .post-modal-comments {
        padding: 14px;
    }

    .post-modal-comments h4 {
        font-size: 13px;
    }

    .comment-author {
        font-size: 12px;
    }

    .comment-time {
        font-size: 11px;
    }

    .comment-content {
        font-size: 13px;
    }

    .comment-form textarea {
        padding: 10px;
    }

    /* 푸터 */
    .footer {
        padding: 20px 12px;
    }

    .footer-links {
        gap: 12px;
    }

    .footer-links a {
        font-size: 13px;
    }

    .copyright {
        font-size: 11px;
    }
}

/* 고정 게시글 */
.post-item.pinned {
    background-color: #fef9e7;
    border-left: 3px solid #f0ad4e;
}

.post-pin-badge {
    font-size: 11px;
    font-weight: 600;
    color: #e67e22;
    margin-right: 4px;
    white-space: nowrap;
}

.post-pin-btn {
    padding: 6px 12px;
    border: 1px solid #f0ad4e;
    border-radius: 6px;
    background: #fef9e7;
    color: #e67e22;
    font-size: 13px;
    cursor: pointer;
    margin-right: 8px;
}

.post-pin-btn:hover {
    background: #fdebd0;
}
