/* ギャラリーページ専用のスタイル */
.gallery-grid {
    margin-top: 2rem;
}

.gallery-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.gallery-image {
    width: 100%;
    object-fit: contain;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: transform 0.3s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gallery-image:hover {
    transform: scale(1.05);
}


.no-drawings {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
    font-size: 1.1rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .gallery-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
}

@media (max-width: 480px) {
    .gallery-grid {
        margin-top: 1rem;
    }
}

@media (max-width: 350px) {
    .gallery-items {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* モーダル表示のスタイル */
.modal {
    position: fixed;
    z-index: 1002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 0;
    border-radius: 10px;
    width: 95%;
    max-width: 1200px;
    height: 80vh;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 10px;
    z-index: 1003;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

.modal-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
}

.modal-image-container {
    width: 60%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: #f5f5f5;
    padding: 1.5rem;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
    flex: 1;
    min-height: 0;
}

.modal-info {
    padding: 1.5rem;
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.modal-image-container h3 {
    margin: 1rem 0 0.5rem 0;
    font-size: 1.3rem;
    color: #333;
    text-align: center;
    line-height: 1.3;
}

.modal-image-container .modal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    width: 100%;
}

.modal-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    color: #333;
}

.modal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #666;
}

/* コメントセクションのスタイル（m-drawingページから移植） */
.comments-section {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    border-top: none;
}

.comments-section h5 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    min-height: 0;
}

.comment-item {
    background: #f9f9f9;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

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

.comment-author {
    font-weight: bold;
    color: #333;
    font-size: 0.9rem;
}

.comment-date {
    color: #666;
    font-size: 0.8rem;
}

.comment-text {
    color: #555;
    line-height: 1.4;
    font-size: 0.9rem;
}

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

.comment-toggle-section {
    margin-bottom: 1rem;
    margin-top: auto;
}

.comment-toggle-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.comment-toggle-btn:hover {
    background: #5a6fd8;
}

.comment-form {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-group textarea {
    height: 60px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.comment-cancel-btn,
.comment-submit-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
}

.comment-cancel-btn {
    background: #ccc;
    color: #333;
}

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

.comment-cancel-btn:hover {
    background: #bbb;
}

.comment-submit-btn:hover {
    background: #5a6fd8;
}

/* レスポンシブデザイン */
@media (max-width: 1000px) {
    .modal-content {
        width: 95%;
        margin: 10px;
        height: 90vh;
        max-height: 90vh;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .modal-image-container {
        width: 100%;
        height: auto;
        max-height: 50vh;
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        min-height: 0;
    }
    
    .modal-image-container h3 {
        font-size: 1rem;
        margin: 0.5rem 0 0.3rem 0;
        line-height: 1.2;
    }
    
    .modal-image-container .modal-meta {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        gap: 0.2rem;
    }
    
    .modal-image-container img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        flex: 1;
        min-height: 0;
        object-fit: contain;
        -webkit-tap-highlight-color: transparent;
    }
    
    .modal-info {
        width: 100%;
        height: auto;
        padding: 0.5rem;
        flex: 1;
    }
    
    .comments-section h5 {
        font-size: 0.9rem;
        margin: 0 0 0.5rem 0;
    }
    
    .comment-item {
        padding: 0.5rem;
        margin-bottom: 0.3rem;
    }
    
    .comment-author {
        font-size: 0.8rem;
    }
    
    .comment-date {
        font-size: 0.7rem;
    }
    
    .comment-text {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .comment-form {
        padding: 0.5rem;
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    .comment-cancel-btn,
    .comment-submit-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .modal-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}

/* フルサイズ画像表示用モーダル */
.full-size-modal {
    position: fixed;
    z-index: 2002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
}

.full-size-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.full-size-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.full-size-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2003;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    -webkit-tap-highlight-color: transparent;
}

.full-size-close:hover {
    color: #ccc;
}

/* フルサイズモーダルのレスポンシブ */
@media (max-width: 768px) {
    .full-size-modal-content {
        max-width: 98%;
        max-height: 98%;
        padding: 10px;
    }
    
    .full-size-close {
        top: -30px;
        font-size: 30px;
    }
}
