/* 갤러리 특화 스타일 */

/* 갤러리 헤더 */
.gallery-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 100px 0 80px;
    text-align: center;
    margin-top: 70px;
}

.gallery-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.gallery-header p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.gallery-header .btn {
    font-size: 1.1rem;
    padding: 12px 30px;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.gallery-header .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* 갤러리 메인 */
.gallery-main {
    padding: 60px 0;
    background: #f8f9fa;
    min-height: 100vh;
}

/* 필터 버튼 */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: none;
    background: white;
    color: #666;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: #2c3e50;
    color: white;
}

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

/* 갤러리 아이템 */
.gallery-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.gallery-item-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
}

.gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-item-image img {
    transform: scale(1.1);
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-overlay i {
    color: white;
    font-size: 2rem;
}

.gallery-item-info {
    padding: 20px;
}

.gallery-item-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
}

.gallery-item-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #999;
}

.gallery-item-author {
    font-weight: 500;
    color: #3498db;
}

/* 빈 상태 */
.no-images {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.no-images i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-images p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* 로딩 */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 15px;
}

/* 모달 기본 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #e74c3c;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.modal-body {
    margin: 20px 0;
}

.modal-body p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* 모달 확장 스타일 */
.image-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

.image-display {
    position: relative;
    text-align: center;
    background: #000;
    margin: -20px -30px 20px -30px;
}

.image-display img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 15px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    pointer-events: all;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.image-info h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.image-info p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.image-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.image-meta span {
    color: #666;
    font-size: 0.9rem;
}

.image-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 파일 업로드 영역 */
.file-upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: #f8f9fa;
}

.file-upload-area:hover {
    border-color: #3498db;
    background: #e3f2fd;
}

.file-upload-area.dragover {
    border-color: #2196f3;
    background: #bbdefb;
    transform: scale(1.02);
}

.file-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-text i {
    font-size: 3rem;
    color: #3498db;
    margin-bottom: 15px;
}

.upload-text p {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 8px;
}

.upload-text span {
    font-size: 0.9rem;
    color: #999;
}

/* 이미지 미리보기 */
.preview-container {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.preview-container h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.preview-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.preview-remove:hover {
    background: rgba(231, 76, 60, 1);
}

/* Toast 알림 */
.toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

.toast.warning {
    background: #f39c12;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.2rem;
}

/* 작은 모달 */
.small-modal {
    max-width: 400px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .gallery-header {
        padding: 80px 0 60px;
        margin-top: 60px;
    }
    
    .gallery-header h1 {
        font-size: 2.2rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .filter-buttons {
        margin-bottom: 30px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
        width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
    }
    
    .image-modal-content {
        margin: 20px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
    
    .image-display {
        margin: -15px -20px 15px -20px;
    }
    
    .image-display img {
        max-height: 50vh;
    }
    
    .image-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .preview-images {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .preview-item img {
        height: 100px;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-header h1 {
        font-size: 1.8rem;
    }
    
    .gallery-header p {
        font-size: 1rem;
    }
    
    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-btn {
        width: 200px;
    }
    
    .image-actions {
        flex-direction: column;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: fadeInUp 0.6s ease forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

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

.comments-section h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.comment-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid #007bff;
}

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

.comment-author {
    font-weight: 600;
    color: #007bff;
    font-size: 14px;
}

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

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

.comment-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

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

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

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.comment-form textarea {
    resize: vertical;
    min-height: 80px;
}

.comment-form button {
    width: 100%;
    padding: 10px;
    font-size: 14px;
}

.no-comments {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}
