* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px 0;
    z-index: 100;
}

@media (min-width: 768px) {
    header {
        position: sticky;
        top: 0;
    }
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-area {
    display: flex;
    align-items: center;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    color: #666;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

.nav-item:hover {
    background: #f0f0f0;
    color: #111;
}

.nav-item.active {
    background: #111;
    color: white;
}

.search-area {
    display: flex;
    align-items: center;
}

.search-form {
    width: 100%;
}

.search-group {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 25px;
    overflow: hidden;
    background: white;
}

.search-group input {
    flex: 1;
    padding: 10px 20px;
    border: none;
    outline: none;
    font-size: 14px;
    min-width: 200px;
}

.search-group button {
    padding: 10px 25px;
    background: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.search-group button:hover {
    background: #2980b9;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0 15px;
    }
    
    .logo-area {
        text-align: center;
    }
    
    .logo-area h1 {
        font-size: 16px;
    }
    
    .logo-prefix {
        font-size: 14px;
    }
    
    .logo-main {
        font-size: 16px;
    }
    
    .search-area {
        width: 100%;
    }
    
    .search-group input {
        min-width: 0;
        font-size: 14px;
    }
    
    .search-group button {
        padding: 10px 20px;
    }
}

main {
    max-width: 1200px;
    margin: 15px auto 30px;
    padding: 0 20px;
}

.content-controls {
    margin-bottom: 10px;
    text-align: right;
}

.sort-buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.sort-buttons a {
    color: #7f8c8d;
    text-decoration: none;
    font-size: 14px;
    margin-right: 15px;
    transition: color 0.2s;
}

.sort-buttons a:hover {
    color: #3498db;
    text-decoration: underline;
}

.sort-buttons a.active {
    color: #3498db;
    font-weight: 600;
}

.last-update {
    margin-left: 15px;
    color: #7f8c8d;
    font-size: 14px;
}

.content-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.content-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.content-item img, .no-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecf0f1;
    color: #95a5a6;
}

.content-info {
    padding: 0 15px 10px;
    font-size: 12px;
    color: #95a5a6;
}

.content-item h2 {
    padding: 15px 15px 10px;
    font-size: 18px;
    line-height: 1.4;
}

.content-item h2 strong {
    background: yellow;
}

.content-preview {
    padding: 0 15px 15px;
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.5;
}

.content-preview strong {
    background: yellow;
    color: #7f8c8d;
}

.pagination {
    text-align: center;
    margin: 40px 0;
}

.pagination a {
    padding: 8px 12px;
    margin: 0 5px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.pagination a.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.content-detail {
    background: white;
    padding: 40px;
    border-radius: 8px;
}

.content-detail h1 {
    font-size: 32px;
    margin-bottom: 20px;
    line-height: 1.3;
}

.content-meta {
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 30px;
    color: #7f8c8d;
}

.content-meta span {
    margin-right: 20px;
}

.content-body {
    line-height: 1.8;
    font-size: 16px;
}

.content-body h2 {
    margin: 30px 0 15px;
    font-size: 24px;
    color: #2c3e50;
}

.content-body p {
    margin-bottom: 20px;
}

.content-body img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 4px;
}

.content-body .image-source {
    font-size: 12px;
    color: #95a5a6;
    margin-top: -15px;
    margin-bottom: 20px;
}

.content-summary {
    background: #ecf0f1;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 30px;
    font-style: italic;
}

.content-navigation {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
}

.content-navigation a {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.content-navigation a:hover {
    background: #2980b9;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 60px;
}

footer a {
    color: #3498db;
}

.admin-login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.logout-btn {
    padding: 8px 20px;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-search {
    display: inline-block;
}

.admin-search input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 300px;
}

.admin-actions {
    display: inline-block;
}

.btn-update {
    padding: 10px 25px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-update:hover {
    background: #229954;
}

.btn-update:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.admin-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th {
    background: #34495e;
    color: white;
    padding: 12px;
    text-align: left;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.btn-edit {
    padding: 5px 15px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 10px;
}

.btn-delete {
    padding: 5px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.admin-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    margin-top: 30px;
}

.btn-save {
    padding: 10px 30px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
}

.btn-list {
    padding: 10px 30px;
    background: #95a5a6;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.error {
    color: #e74c3c;
    margin-top: 10px;
}

/* 댓글 섹션 스타일 */
.comment-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

.comment-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}

.comment-count {
    color: #ff0000;
    font-weight: normal;
}

/* 댓글 작성 폼 */
.comment-form {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.comment-user-info {
    margin-bottom: 10px;
}

.user-nickname {
    font-weight: bold;
    color: #495057;
}

.comment-input-group {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-input-group textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.comment-submit-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.comment-submit-btn:hover {
    background: #0056b3;
}

/* 베스트 댓글 */
.best-comments {
    background: #fff9e6;
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.best-comments-title {
    font-size: 16px;
    color: #ff6600;
    margin-bottom: 15px;
}

.best-comment-item {
    background: white;
    border: 1px solid #ffd700;
    margin-bottom: 10px;
}

/* 정렬 옵션 */
.comment-sort {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sort-link {
    color: #666;
    text-decoration: none;
    padding: 5px 10px;
    transition: color 0.3s;
}

.sort-link:hover {
    color: #007bff;
    text-decoration: underline;
}

.sort-link.active {
    color: #007bff;
    font-weight: bold;
    text-decoration: none;
}

.sort-divider {
    color: #ccc;
    margin: 0 5px;
}

/* 댓글 목록 */
.comments-list {
    margin-top: 20px;
}

.comment-item {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: white;
}

.comment-header {
    margin-bottom: 10px;
}

.comment-author {
    font-weight: bold;
    color: #495057;
    margin-right: 10px;
}

.comment-text {
    color: #333;
    line-height: 1.5;
}

.comment-delete {
    float: right;
    padding: 2px 8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.comment-delete:hover {
    background: #c82333;
}

.comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

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

.comment-actions {
    display: flex;
    gap: 10px;
}

.vote-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.like-btn:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.like-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.dislike-btn:hover {
    border-color: #dc3545;
    background: #fff5f5;
}

.dislike-btn.active {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.vote-count {
    font-size: 14px;
}

.no-comments {
    text-align: center;
    color: #999;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .comment-input-group {
        flex-direction: column;
    }
    
    .comment-submit-btn {
        width: 100%;
    }
    
    .comment-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* 관리자 댓글 섹션 */
.admin-comments-section {
    margin-top: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.admin-comments-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.recent-comments-list {
    overflow-x: auto;
}

.recent-comments-list .admin-table {
    width: 100%;
    min-width: 800px;
}