/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    min-height: 100vh;
}

/* 헤더 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* 섹션 제목 */
h2 {
    color: #34495e;
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* 게시글 작성 폼 */
.post-form-section {
    margin-bottom: 40px;
}

.post-form {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.submit-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-btn:hover {
    background-color: #0056b3;
}

.submit-btn:active {
    background-color: #004085;
}

/* 게시글 목록 */
.posts-section {
    margin-top: 40px;
}

.posts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.post-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
}

.post-title.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.post-title.clickable:hover {
    color: #007bff;
}

.comment-count {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: normal;
    margin-left: 8px;
}

.post-content {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #6c757d;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-btn:hover {
    background-color: #c82333;
}

.delete-btn:active {
    background-color: #bd2130;
}

/* 빈 상태 메시지 */
.empty-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .post-form {
        padding: 20px;
    }

    .post-card {
        padding: 15px;
    }

    .post-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .submit-btn {
        width: 100%;
    }
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-in-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
    flex: 1;
}

.close-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #000;
}

.modal-body {
    padding: 25px;
}

/* 게시글 상세 내용 */
.post-detail {
    margin-bottom: 30px;
}

.post-meta-info {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.post-full-content {
    color: #333;
    line-height: 1.8;
    font-size: 1rem;
    white-space: pre-wrap;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

/* 댓글 섹션 */
.comments-section h3 {
    color: #34495e;
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* 댓글 작성 폼 */
.comment-form {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.comment-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-input-group input[type="text"] {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.comment-input-group textarea {
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.comment-input-group input:focus,
.comment-input-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.comment-submit-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    align-self: flex-start;
}

.comment-submit-btn:hover {
    background-color: #218838;
}

.comment-submit-btn:active {
    background-color: #1e7e34;
}

/* 댓글 목록 */
.comments-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comment-item {
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: bold;
    color: #495057;
    font-size: 0.9rem;
}

.comment-date {
    color: #6c757d;
    font-size: 0.8rem;
}

.comment-content {
    color: #333;
    line-height: 1.6;
    white-space: pre-wrap;
}

.comment-delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 10px;
}

.comment-delete-btn:hover {
    background-color: #c82333;
}

/* 빈 댓글 메시지 */
.empty-comments {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .modal-content {
        margin: 2% auto;
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .post-full-content {
        padding: 15px;
    }

    .comment-form {
        padding: 15px;
    }

    .comment-input-group {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .modal-header h2 {
        font-size: 1.2rem;
    }

    .comments-section h3 {
        font-size: 1.1rem;
    }

    .comment-submit-btn {
        width: 100%;
        align-self: stretch;
    }
}