/**
 * Photo Gallery Styling for News Posts
 * Responsive grid layout for multiple images
 */

/* Main cover image */
.post-cover-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Gallery container */
.post-gallery {
    margin-top: 30px;
    margin-bottom: 30px;
}

.post-gallery-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Gallery grid */
.post-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.post-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.post-gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-gallery-item:hover img {
    transform: scale(1.1);
}

/* Gallery overlay on hover */
.post-gallery-item::after {
    content: '\f002';
    /* Bootstrap icon search */
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.post-gallery-item:hover::after {
    opacity: 0.9;
}

.post-gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-gallery-item:hover::before {
    opacity: 1;
}

/* Lightbox for full-size images */
.gallery-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    padding: 20px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-lightbox.active {
    display: flex;
}

.gallery-lightbox img {
    max-width: 90%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.gallery-lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10000;
}

.gallery-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Admin gallery management */
.admin-gallery-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.admin-gallery-item {
    position: relative;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.admin-gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.admin-gallery-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.admin-gallery-item .delete-btn:hover {
    background: rgba(220, 53, 69, 1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .post-gallery-item img {
        height: 150px;
    }

    .post-cover-image {
        max-height: 300px;
    }

    .admin-gallery-preview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .admin-gallery-item img {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .post-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}