/* =============================================
   G-Drive Media Gallery – Frontend Styles
   ============================================= */

/* ── Gallery Grid ──────────────────────────── */
.gdmg-gallery-wrap { width: 100%; }

.gdmg-gallery-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

/* Column variants */
.gdmg-col-1 { grid-template-columns: repeat(1, 1fr); }
.gdmg-col-2 { grid-template-columns: repeat(2, 1fr); }
.gdmg-col-3 { grid-template-columns: repeat(3, 1fr); }
.gdmg-col-4 { grid-template-columns: repeat(4, 1fr); }
.gdmg-col-5 { grid-template-columns: repeat(5, 1fr); }
.gdmg-col-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 900px) {
    .gdmg-col-4, .gdmg-col-5, .gdmg-col-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .gdmg-col-3, .gdmg-col-4, .gdmg-col-5, .gdmg-col-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
    .gdmg-gallery-grid { grid-template-columns: repeat(1, 1fr); }
}

/* ── Gallery Item ──────────────────────────── */
.gdmg-gallery-item {
    margin: 0;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    background: #f0f0f0;
    transition: transform .2s, box-shadow .2s;
}
.gdmg-gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.gdmg-gallery-thumb {
    position: relative;
    padding-bottom: 66.67%; /* 3:2 ratio */
    overflow: hidden;
}
.gdmg-gallery-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.gdmg-gallery-item:hover .gdmg-gallery-thumb img { transform: scale(1.05); }

.gdmg-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.gdmg-gallery-item:hover .gdmg-gallery-overlay { opacity: 1; }
.gdmg-zoom-icon { font-size: 28px; color: #fff; }

.gdmg-gallery-caption {
    padding: 8px 10px;
    font-size: 13px;
    color: #555;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Pagination ────────────────────────────── */
.gdmg-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 20px 0 32px;
}
.gdmg-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
}
.gdmg-page-link:hover { background: #f5f5f5; border-color: #999; }
.gdmg-page-link--active {
    background: #4353ff;
    border-color: #4353ff;
    color: #fff;
    pointer-events: none;
}

/* ── Empty ─────────────────────────────────── */
.gdmg-empty { color: #888; font-style: italic; text-align: center; padding: 40px; }

/* ── Lightbox ──────────────────────────────── */
.gdmg-lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 99998;
}
.gdmg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gdmg-lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 100000;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background .15s;
}
.gdmg-lightbox-close:hover { background: rgba(255,255,255,.15); }

.gdmg-lightbox-swiper {
    width: min(90vw, 1200px);
    height: min(85vh, 900px);
}

.gdmg-lightbox-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}
.gdmg-lightbox-img {
    max-width: 100%;
    max-height: calc(85vh - 60px);
    object-fit: contain;
    border-radius: 4px;
}
.gdmg-lightbox-caption {
    color: #ccc;
    font-size: 13px;
    text-align: center;
    max-width: 600px;
}

/* Override Swiper colors in lightbox */
.gdmg-lightbox-swiper .swiper-button-next,
.gdmg-lightbox-swiper .swiper-button-prev { color: #fff; }
.gdmg-lightbox-swiper .swiper-pagination-bullet { background: #fff; opacity: .5; }
.gdmg-lightbox-swiper .swiper-pagination-bullet-active { opacity: 1; }

/* ── Album Slider ──────────────────────────── */
.gdmg-slider-wrap { margin: 20px 0; }

.gdmg-album-swiper {
    width: 100%;
    height: auto;
    min-height: 200px;
    border-radius: 10px;
    overflow: hidden;
}

.gdmg-slider-slide {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.gdmg-slider-img {
    width: 100%;
    height: 500px;
    object-fit: cover;
    display: block;
}

@media (max-width: 640px) { .gdmg-slider-img { height: 220px; } }

.gdmg-slider-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: #fff;
    padding: 20px 20px 14px;
    font-size: 14px;
    font-weight: 500;
}

/* ── Albums Grid ───────────────────────────── */
.gdmg-albums-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.gdmg-album-card {
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    transition: transform .2s, box-shadow .2s;
}
.gdmg-album-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.gdmg-album-card__link { display: block; text-decoration: none; color: inherit; }

.gdmg-album-card__thumb {
    position: relative;
    padding-bottom: 60%;
    overflow: hidden;
    background: #e8e8e8;
}
.gdmg-album-card__thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.gdmg-album-card:hover .gdmg-album-card__thumb img { transform: scale(1.06); }

.gdmg-album-card__overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,.6);
    color: #fff;
    padding: 4px 10px;
    font-size: 12px;
    border-top-left-radius: 6px;
}

.gdmg-album-card__info { padding: 14px 16px; }
.gdmg-album-card__name {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}
.gdmg-album-card__desc {
    margin: 0;
    font-size: 13px;
    color: #777;
    line-height: 1.5;
}

/* ── Blocks Editor Placeholder ─────────────── */
.gdmg-block-placeholder {
    border: 2px dashed #4353ff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    color: #4353ff;
    background: #f0f3ff;
}
.gdmg-block-placeholder .dashicons { font-size: 32px; display: block; margin-bottom: 8px; }
