/* ==========================================================================
   WPDM Image Gallery
   ========================================================================== */

.w3eden .wpdm-gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.w3eden .wpdm-gallery__grid--1 { grid-template-columns: 1fr; }
.w3eden .wpdm-gallery__grid--2 { grid-template-columns: repeat(2, 1fr); }
.w3eden .wpdm-gallery__grid--3 { grid-template-columns: repeat(3, 1fr); }
.w3eden .wpdm-gallery__grid--4 { grid-template-columns: repeat(4, 1fr); }
.w3eden .wpdm-gallery__grid--6 { grid-template-columns: repeat(6, 1fr); }

.w3eden .wpdm-gallery__item {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.w3eden .wpdm-gallery__item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

/* Preview area */
.w3eden .wpdm-gallery__preview {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-secondary);
}

.w3eden .wpdm-gallery__preview > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.w3eden .wpdm-gallery__item:hover .wpdm-gallery__preview > img {
    transform: scale(1.04);
}

/* Icon fallback (non-image files) */
.w3eden .wpdm-gallery__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.w3eden .wpdm-gallery__icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

/* Download overlay */
.w3eden .wpdm-gallery__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.w3eden .wpdm-gallery__item:hover .wpdm-gallery__overlay {
    opacity: 1;
}

.w3eden .wpdm-gallery__overlay .btn {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Info bar */
.w3eden .wpdm-gallery__info {
    padding: 0.75rem 1rem;
}

.w3eden .wpdm-gallery__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.w3eden .wpdm-gallery__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.w3eden .wpdm-gallery__meta span:not(:last-child)::after {
    content: '\00B7';
    margin-left: 0.5rem;
    color: var(--border-color);
}

/* Search compat */
.w3eden .wpdm-gallery__item.wpdm-filelist-hidden {
    display: none;
}

/* Responsive: Tablet */
@media (max-width: 768px) {
    .w3eden .wpdm-gallery__grid--3,
    .w3eden .wpdm-gallery__grid--4,
    .w3eden .wpdm-gallery__grid--6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: Mobile */
@media (max-width: 575px) {
    .w3eden .wpdm-gallery__grid,
    .w3eden .wpdm-gallery__grid--2,
    .w3eden .wpdm-gallery__grid--3,
    .w3eden .wpdm-gallery__grid--4,
    .w3eden .wpdm-gallery__grid--6 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .w3eden .wpdm-gallery__overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.35);
    }
}

/* Dark mode */
.w3eden.dark-mode .wpdm-gallery__preview {
    background: var(--dm-bg-tertiary, #334155);
}
