/*----------------------------------------*/
/*  Gallery Styles
/*----------------------------------------*/

/* Gallery Filter Section */
.gallery-filter-section {
    padding: 20px 0;
    border-bottom: 1px solid var(--pbmit-border-color);
}

.gallery-filter-section .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
}

.pbmit-sortable-list {
    flex-shrink: 0;
}

.gallery-search-wrapper {
    margin-top: 0;
    flex: 1;
    max-width: 400px;
    margin-left: auto;
}

/* Responsive adjustments for gallery filter */
@media (max-width: 768px) {
    .gallery-filter-section .container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .gallery-search-wrapper {
        max-width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-filter-section .container {
        gap: 10px;
    }

    .gallery-search-wrapper {
        margin-top: 15px;
    }
}

.gallery-search-form {
    max-width: 400px;
    margin: 0 auto;
}

.gallery-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.gallery-search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: 2px solid var(--pbmit-border-color);
    border-radius: 25px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.gallery-search-input:focus {
    outline: none;
    border-color: var(--pbmit-global-color);
}

.gallery-search-btn {
    position: absolute;
    right: 5px;
    background: var(--pbmit-global-color);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.gallery-search-btn:hover {
    background: var(--pbmit-global-color-dark);
}

/* Galleries Grid */
.galleries-section {
    padding: 0 0 40px 0;
}

.galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

/* Gallery Cards */
.gallery-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--pbmit-white-color);
}

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

.gallery-card-link {
    display: block;
    position: relative;
    height: 250px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    text-decoration: none;
    overflow: hidden;
}

.gallery-card-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 100%);
    transition: opacity 0.3s ease;
}

.gallery-card:hover .gallery-card-link::before {
    opacity: 0.8;
}

.gallery-type-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

.gallery-count-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--pbmit-global-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

.gallery-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 2;
}

.gallery-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.gallery-card-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
    padding: 20px;
    text-align: center;
}

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

.gallery-card-arrow {
    margin-bottom: 15px;
}

.gallery-card-info {
    text-align: center;
}

.gallery-type-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.gallery-card-title-hover {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: white;
}

.gallery-card-description-hover {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 15px 0;
    line-height: 1.4;
}

.gallery-media-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.gallery-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.6);
    z-index: 1;
}

.gallery-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.gallery-placeholder span {
    font-size: 14px;
    font-weight: 500;
}

/* Gallery Info Section */
.gallery-info-section {
    padding: 40px 0;
    background: var(--pbmit-white-color);
    border-bottom: 1px solid var(--pbmit-border-color);
}

.gallery-info-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.gallery-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.gallery-type-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--pbmit-global-color);
}

.gallery-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.gallery-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--pbmit-heading-color);
}

.gallery-description {
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    color: var(--pbmit-text-color);
}

/* Media Grid */
.gallery-media-section {
    padding: 60px 0;
}

.gallery-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

/* Media Items */
.media-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--pbmit-white-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.media-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.media-item:focus {
    outline: 2px solid var(--pbmit-global-color);
    outline-offset: 2px;
}

.media-item-content {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

/* Media Previews */
.media-preview {
    position: relative;
    width: 100%;
    height: 100%;
}

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

.media-item:hover .image-preview img {
    transform: scale(1.05);
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-overlay,
.audio-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.media-item:hover .video-play-overlay,
.media-item:hover .audio-play-overlay {
    background: var(--pbmit-global-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.audio-preview {
    background: linear-gradient(135deg, var(--pbmit-global-color) 0%, var(--pbmit-global-color-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-visualizer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: rgba(255, 255, 255, 0.8);
}

.audio-bars {
    display: flex;
    align-items: end;
    gap: 3px;
    height: 40px;
}

.audio-bar {
    width: 3px;
    background: currentColor;
    border-radius: 2px;
    animation: audioWave 2s ease-in-out infinite;
}

.audio-bar:nth-child(1) { animation-delay: 0s; }
.audio-bar:nth-child(2) { animation-delay: 0.2s; }
.audio-bar:nth-child(3) { animation-delay: 0.4s; }
.audio-bar:nth-child(4) { animation-delay: 0.6s; }
.audio-bar:nth-child(5) { animation-delay: 0.8s; }

@keyframes audioWave {
    0%, 100% { height: 8px; opacity: 0.4; }
    50% { height: 30px; opacity: 1; }
}

.file-preview {
    background: var(--pbmit-light-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
}

.file-icon {
    color: var(--pbmit-global-color);
    opacity: 0.7;
}

.file-info {
    text-align: center;
}

.file-type {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--pbmit-heading-color);
    margin-bottom: 5px;
}

.file-size {
    display: block;
    font-size: 11px;
    color: var(--pbmit-text-color);
}

/* Media Info Overlay */
.media-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1;
}

.media-item:hover .media-info-overlay {
    transform: translateY(0);
}

.media-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
}

.media-title {
    margin-bottom: 8px;
}

.media-title h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: white;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.media-play-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    z-index: 2;
}

/* Media Actions */
.media-actions {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 3;
}

.media-item:hover .media-actions {
    opacity: 1;
    transform: translateY(0);
}

.media-action-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.media-action-btn:hover {
    background: var(--pbmit-global-color);
    transform: scale(1.1);
}

/* Load More */
.gallery-load-more-wrapper {
    text-align: center;
    margin-top: 40px;
}

/* Empty States */
.empty-state,
.empty-gallery-state {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.empty-state svg,
.empty-gallery-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3,
.empty-gallery-state h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--pbmit-heading-color);
    margin: 0 0 10px 0;
}

.empty-state p,
.empty-gallery-state p {
    font-size: 16px;
    color: var(--pbmit-text-color);
    margin: 0 0 30px 0;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .galleries-grid,
    .gallery-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .gallery-filter-section {
        padding: 30px 0;
    }

    .gallery-search-wrapper {
        margin-top: 20px;
    }

    .gallery-search-form {
        max-width: 100%;
    }

    .galleries-section,
    .gallery-media-section {
        padding: 40px 0;
    }

    .galleries-grid,
    .gallery-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .gallery-card {
        margin-bottom: 20px;
    }

    .gallery-card-link {
        height: 200px;
    }

    .gallery-card-title {
        font-size: 16px;
    }

    .gallery-meta {
        flex-direction: column;
        gap: 20px;
    }

    .gallery-type-indicator,
    .gallery-stats {
        text-align: center;
    }

    .gallery-count {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .galleries-grid,
    .gallery-media-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .gallery-card-link {
        height: 180px;
    }

    .gallery-card-content {
        padding: 15px;
    }

    .gallery-card-title {
        font-size: 15px;
    }

    .gallery-card-overlay {
        padding: 15px;
    }

    .gallery-card-title-hover {
        font-size: 18px;
    }

    .media-item-content {
        aspect-ratio: 16/10;
    }

    .media-info-overlay {
        padding: 12px;
    }

    .media-title h4 {
        font-size: 13px;
    }
}

/*----------------------------------------*/
/*  Media Viewer Modal
/*----------------------------------------*/

.media-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.media-viewer-modal.active {
    opacity: 1;
    visibility: visible;
}

.media-viewer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.media-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.media-viewer-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.media-viewer-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.media-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.media-nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.media-nav-prev {
    left: 1rem;
}

.media-nav-next {
    right: 1rem;
}

.media-viewer-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.media-viewer-image img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.media-viewer-video video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.media-viewer-audio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    min-width: 400px;
}

.audio-visualizer {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.7;
}

.audio-bars {
    display: flex;
    align-items: end;
    gap: 4px;
    height: 60px;
}

.audio-bar {
    width: 4px;
    background: currentColor;
    border-radius: 2px;
    animation: audioWave 1.5s ease-in-out infinite;
}

.audio-bar:nth-child(1) { animation-delay: 0s; }
.audio-bar:nth-child(2) { animation-delay: 0.2s; }
.audio-bar:nth-child(3) { animation-delay: 0.4s; }
.audio-bar:nth-child(4) { animation-delay: 0.6s; }
.audio-bar:nth-child(5) { animation-delay: 0.8s; }

@keyframes audioWave {
    0%, 100% { height: 10px; }
    50% { height: 40px; }
}

.media-viewer-audio audio {
    width: 100%;
    max-width: 300px;
}

.media-viewer-info {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.media-viewer-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.media-viewer-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    opacity: 0.8;
}

.media-viewer-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.media-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.media-download-btn:hover {
    background: #0056b3;
}

.media-viewer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: white;
}

.loading-spinner {
    display: flex;
    gap: 8px;
}

.spinner-ring {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(1) { animation-delay: 0s; }
.spinner-ring:nth-child(2) { animation-delay: 0.2s; }
.spinner-ring:nth-child(3) { animation-delay: 0.4s; }
.spinner-ring:nth-child(4) { animation-delay: 0.6s; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design for Media Viewer */
@media (max-width: 768px) {
    .media-viewer-container {
        padding: 1rem;
    }

    .media-nav-btn {
        width: 40px;
        height: 40px;
    }

    .media-nav-prev {
        left: 0.5rem;
    }

    .media-nav-next {
        right: 0.5rem;
    }

    .media-viewer-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 35px;
        height: 35px;
    }

    .media-viewer-image img,
    .media-viewer-video video {
        max-height: 70vh;
    }

    .media-viewer-audio {
        min-width: 300px;
        padding: 1.5rem;
    }

    .media-viewer-info {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .media-viewer-container {
        padding: 0.5rem;
    }

    .media-nav-btn {
        display: none; /* Hide navigation on very small screens */
    }

    .media-viewer-audio {
        min-width: 250px;
        padding: 1rem;
    }

    .audio-visualizer svg {
        width: 80px;
        height: 80px;
    }

    .audio-bars {
        height: 40px;
    }
}
