/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f5f5f5;
    color: #333;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* 헤더 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header h1 a {
    color: white;
}

header p {
    opacity: 0.9;
    margin-bottom: 20px;
}

/* 네비게이션 인증 */
.nav-auth {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-auth a {
    color: white;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.nav-auth a:hover {
    opacity: 1;
    text-decoration: underline;
}

.nav-auth span {
    opacity: 0.9;
}

header .container {
    position: relative;
}

/* 버튼 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* 메인 콘텐츠 */
main {
    padding: 40px 0;
}

/* 갤러리 그리드 */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* 카드 */
.card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-body h3 {
    margin-bottom: 8px;
    color: #333;
}

.card-body .location {
    color: #667eea;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.card-body .rating {
    color: #ffc107;
    margin-bottom: 5px;
}

.card-body .rating span {
    color: #666;
    font-size: 0.85rem;
}

.card-body .comment-count {
    color: #666;
    font-size: 0.85rem;
}

.card-body .card-stats {
    display: flex;
    gap: 15px;
    color: #666;
    font-size: 0.85rem;
}

.no-posts {
    text-align: center;
    padding: 60px;
    color: #666;
    grid-column: 1 / -1;
}

/* 인증 폼 (로그인/회원가입) */
.auth-form {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-form h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-link a {
    color: #667eea;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

.login-notice {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
    color: #666;
    margin-bottom: 20px;
}

.login-notice a {
    color: #667eea;
    font-weight: 500;
}

.login-notice a:hover {
    text-decoration: underline;
}

/* 업로드 폼 */
.upload-form {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.upload-form h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group select {
    cursor: pointer;
    background: white;
}

.form-group input[type="file"] {
    padding: 10px 0;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

/* 폼 행 (2열 레이아웃) */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group.half {
    flex: 1;
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* 메시지 */
.message {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 댓글 섹션 */
.comment-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.comment-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.comment-form {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.comment-form .form-group {
    margin-bottom: 15px;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

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

.comment-header strong {
    color: #333;
}

.comment-header span {
    color: #888;
    font-size: 0.85rem;
}

.comment-delete-form {
    margin-left: auto;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 8px;
}

.comment-delete-btn:hover {
    text-decoration: underline;
}

.comment p {
    color: #555;
}

.no-comments {
    text-align: center;
    color: #888;
    padding: 20px;
}

.back-link {
    margin-top: 20px;
}

/* 게시물 액션 버튼 */
.post-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 삭제 확인 페이지 */
.delete-confirm {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.delete-confirm h2 {
    margin-bottom: 20px;
    color: #dc3545;
}

.delete-confirm .delete-title {
    font-size: 1.2rem;
    color: #333;
    margin: 20px 0;
}

.delete-confirm .warning {
    color: #dc3545;
    margin-bottom: 30px;
}

/* 마이페이지 */
.mypage-header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.mypage-header h2 {
    margin-bottom: 20px;
    color: #333;
}

.user-info p {
    margin-bottom: 10px;
    color: #555;
}

.my-posts h3 {
    margin-bottom: 20px;
    color: #333;
}

/* 카드 액션 버튼 */
.card-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.85rem;
    background: #667eea;
    color: white;
    border-radius: 3px;
    text-decoration: none;
}

.btn-small:hover {
    background: #5a6fd6;
}

.btn-danger-small {
    background: #dc3545;
}

.btn-danger-small:hover {
    background: #c82333;
}

/* 검색 */
.search-bar {
    margin-bottom: 30px;
}

.search-form-inline {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.search-form-inline input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.search-form-inline input:focus {
    outline: none;
    border-color: #667eea;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.search-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.search-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.search-results h3 {
    margin-bottom: 20px;
    color: #333;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 40px;
}

.page-link {
    padding: 10px 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-link.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 푸터 */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* readonly 입력 */
input[readonly] {
    background: #e9ecef;
    cursor: not-allowed;
}

/* 정렬 폼 */
.sort-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    align-items: center;
}

.sort-form label {
    color: #666;
}

.sort-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* 블로그 에디터 */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.content-editor {
    min-height: 400px;
    border: 1px solid #ddd;
    padding: 15px;
    font-size: 16px;
    line-height: 1.8;
    background: white;
    border-radius: 5px;
}

.content-editor:focus {
    outline: none;
    border-color: #667eea;
}

.content-editor img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 8px;
}

.image-panel {
    border: 1px solid #ddd;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.image-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.upload-zone {
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 15px;
    border-radius: 5px;
    color: #666;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: #667eea;
    background: #f0f7ff;
    color: #667eea;
}

.uploaded-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.uploaded-images .img-item {
    width: 80px;
    height: 80px;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.uploaded-images .img-item:hover {
    border-color: #667eea;
}

.uploaded-images .img-item.selected {
    border-color: #667eea;
    border-width: 3px;
}

.uploaded-images .img-item .thumbnail-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #667eea;
    color: white;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 1;
    font-weight: bold;
}

.uploaded-images .img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 이미지 아이템 액션 버튼 */
.uploaded-images .img-item .img-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: rgba(0,0,0,0.8);
}

.uploaded-images .img-item .img-actions span {
    flex: 1;
    padding: 4px 2px;
    text-align: center;
    color: white;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.uploaded-images .img-item .img-actions .insert-btn:hover {
    background: #667eea;
}

.uploaded-images .img-item .img-actions .delete-btn {
    background: rgba(220, 53, 69, 0.8);
}

.uploaded-images .img-item .img-actions .delete-btn:hover {
    background: #dc3545;
}

.uploaded-images .img-item .img-actions .thumbnail-btn {
    background: rgba(255, 193, 7, 0.8);
    color: #333;
}

.uploaded-images .img-item .img-actions .thumbnail-btn:hover {
    background: #ffc107;
}

/* 업로드 로딩 표시 */
.upload-zone .loading {
    color: #667eea;
    font-weight: 500;
}

.upload-zone:has(.loading) {
    border-color: #667eea;
    background: #f0f7ff;
}

.current-thumbnail {
    margin-bottom: 15px;
}

.current-thumbnail img {
    max-width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

.current-thumbnail p {
    margin-bottom: 5px;
    color: #666;
}

/* 별점 입력 (큰 버전) */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 5px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    font-size: 30px;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #ffc107;
}

/* 블로그 상세 페이지 */
.post-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

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

.post-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: #333;
}

.post-meta {
    color: #666;
    font-size: 14px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.post-meta .location {
    color: #667eea;
}

.post-meta .author {
    font-weight: bold;
}

.post-meta .rating {
    color: #ffc107;
}

.post-body {
    font-size: 17px;
    line-height: 1.9;
    color: #333;
}

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

.post-body p {
    margin-bottom: 1.5em;
}

.post-thumbnail {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* 블로그 에디터용 업로드 폼 확장 */
.upload-form {
    max-width: 1000px;
}

/* 반응형 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .nav-auth {
        position: static;
        justify-content: center;
        margin-bottom: 15px;
    }

    .gallery {
        grid-template-columns: 1fr;
    }

    .upload-form,
    .auth-form {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .search-form-inline,
    .search-form {
        flex-direction: column;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .post-actions {
        flex-direction: column;
    }

    .editor-container {
        grid-template-columns: 1fr;
    }

    .sort-form {
        flex-direction: column;
    }
}
