/* ************************************
 *   Media Gallery Styles (Collapsible)  *
 * ************************************/

.media-gallery {
    margin: 15px 20px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Expand Button */
.gallery-expand-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 10px;
    background-color: #5e7260;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.gallery-expand-btn:hover {
    background-color: #4a5a4a;
}

.gallery-expand-btn:active {
    transform: scale(0.98);
}

/* Gallery Container */
.gallery-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    display: none;
}

.gallery-container.show {
    display: block;
}

/* Main Gallery Display */
.gallery-main {
    position: relative;
    width: 100%;
    background-color: #333;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 350px;
    aspect-ratio: 16 / 9;
}

.gallery-main-media {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Loading State */
.gallery-loading {
    color: #999;
    font-size: 14px;
    font-style: italic;
}

.gallery-no-media {
    color: #999;
    font-size: 14px;
    font-style: italic;
}

/* Controls Container */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
}

/* Preview Thumbnails */
.gallery-previews {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
}

.gallery-preview {
    flex: 1;
    height: 48px;
    background-color: #222;
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
    opacity: 0.9;
}

.gallery-preview.disabled {
    opacity: 0.35;
}

.gallery-preview-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Navigation Arrows - Fixed & Always Visible */
.gallery-arrow {
    flex: 1;
    padding: 10px 15px;
    background-color: #5e7260;
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-weight: bold;
}

.gallery-arrow:hover:not(:disabled) {
    background-color: #4a5a4a;
    transform: scale(1.05);
}

.gallery-arrow:active:not(:disabled) {
    transform: scale(0.95);
}

.gallery-arrow:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Gallery Counter */
.gallery-counter {
    flex: 0 0 auto;
    min-width: 70px;
    font-size: 14px;
    color: #333;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 3px;
    text-align: center;
    border: 1px solid #ddd;
}

/* Collapsed State */
.media-gallery.gallery-collapsed {
    padding: 0;
    border: 1px solid #ddd;
    background-color: transparent;
}

.media-gallery.gallery-collapsed .gallery-expand-btn {
    margin: 0;
    border-radius: 0;
}

.media-gallery.no-media {
    display: none;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gallery-main-media {
    animation: fadeIn 0.3s ease-in;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .media-gallery {
        margin: 10px 0;
        padding: 8px;
    }

    .gallery-main {
        min-height: 150px;
        max-height: 250px;
    }

    .gallery-arrow {
        padding: 8px 12px;
        font-size: 16px;
    }

    .gallery-controls {
        gap: 5px;
    }

    .gallery-counter {
        font-size: 12px;
        min-width: 60px;
        padding: 6px 10px;
    }

    .gallery-expand-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .gallery-main {
        min-height: 120px;
        max-height: 180px;
    }

    .gallery-arrow {
        padding: 6px 10px;
        font-size: 14px;
    }

    .gallery-counter {
        font-size: 11px;
        min-width: 50px;
        padding: 5px 8px;
    }
}