/* ============================================================
   Adrin Gallery — Frontend Styles
   Gallery Widget + Lightbox + Read More Widget
============================================================ */

/* ── Gallery Wrapper ───────────────────────────────────── */
.adrin-gallery-wrapper {
    width: 100%;
    font-family: inherit;
}

/* ── Main Viewer ───────────────────────────────────────── */
.adrin-gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f3f4f6;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.adrin-gallery-main-inner {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Slides */
.adrin-gallery-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease;
    background: #f3f4f6;
}

.adrin-gallery-slide.active {
    opacity: 1;
    pointer-events: all;
}

.adrin-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Video inside main */
.adrin-gallery-slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Shortcode (360°) */
.adrin-gallery-slide.type-shortcode {
    overflow: auto;
}

.adrin-gallery-slide.type-shortcode .adrin-sc-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ── Overlay Buttons on Main ───────────────────────────── */
.adrin-gallery-overlay-btns {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.adrin-gallery-overlay-btns button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,.5);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    backdrop-filter: blur(4px);
}

.adrin-gallery-overlay-btns button:hover {
    background: rgba(0,0,0,.8);
}

.adrin-gallery-overlay-btns svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* Type badge (top-left) */
.adrin-gallery-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: rgba(0,0,0,.55);
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    transition: opacity .2s;
}

.adrin-gallery-type-badge svg {
    width: 14px;
    height: 14px;
}

.adrin-gallery-type-badge span {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .04em;
}

.adrin-gallery-type-badge.hidden {
    display: none;
}

/* Caption */
.adrin-gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
    z-index: 5;
    min-height: 40px;
    display: flex;
    align-items: flex-end;
}

/* ── Thumbnails Strip ──────────────────────────────────── */
.adrin-gallery-thumbs-outer {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.adrin-gallery-thumbs-track {
    display: flex;
    gap: 8px;
    transition: transform .35s ease;
    will-change: transform;
}

.adrin-gallery-thumb {
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: .65;
    transition: opacity .25s, border-color .25s;
    position: relative;
    background: #e5e7eb;
    /* width set by JS/inline */
}

.adrin-gallery-thumb:hover {
    opacity: .85;
}

.adrin-gallery-thumb.active {
    opacity: 1;
    /* border-color set by widget color setting via inline style */
}

.adrin-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video thumb play icon */
.adrin-gallery-thumb.type-video .adrin-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.35);
    transition: background .2s;
}

.adrin-gallery-thumb.type-video:hover .adrin-thumb-play {
    background: rgba(0,0,0,.5);
}

.adrin-gallery-thumb.type-video .adrin-thumb-play svg {
    width: 32px;
    height: 32px;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
    opacity: .95;
}

/* Shortcode thumb */
.adrin-gallery-thumb.type-shortcode .adrin-thumb-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    background: #1e3a5f;
    color: #fff;
}

.adrin-gallery-thumb.type-shortcode .adrin-thumb-icon svg {
    width: 28px;
    height: 28px;
    opacity: .9;
}

.adrin-gallery-thumb.type-shortcode .adrin-thumb-icon span {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
    opacity: .8;
}

/* Arrow nav buttons */
.adrin-thumb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.9);
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.adrin-thumb-arrow:hover { background: #fff; }
.adrin-thumb-arrow.hidden { display: none; }
.adrin-thumb-arrow.prev { right: -15px; }
.adrin-thumb-arrow.next { left: -15px; }
.adrin-thumb-arrow svg { width: 16px; height: 16px; pointer-events: none; }

/* Overflow counter badge "+N" */
.adrin-thumb-more {
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ── Lightbox ──────────────────────────────────────────── */
.adrin-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    backdrop-filter: blur(6px);
}

.adrin-lightbox.open {
    opacity: 1;
    pointer-events: all;
}

.adrin-lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: adrin-lb-scale .3s ease;
}

@keyframes adrin-lb-scale {
    from { transform: scale(.9); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}

.adrin-lightbox-inner img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.adrin-lightbox-inner video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    background: #000;
}

.adrin-lightbox-inner iframe {
    width: 80vw;
    height: 45vw;
    max-height: 85vh;
    border: none;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.adrin-lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    z-index: 10;
}

.adrin-lightbox-close:hover { background: rgba(255,255,255,.3); }

.adrin-lightbox-caption {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.75);
    font-size: 13px;
    text-align: center;
    max-width: 600px;
    padding: 0 20px;
}

/* Lightbox nav */
.adrin-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    z-index: 10;
}

.adrin-lightbox-nav:hover { background: rgba(255,255,255,.3); }
.adrin-lightbox-nav.prev { left: 20px; }
.adrin-lightbox-nav.next { right: 20px; }
.adrin-lightbox-nav svg { width: 22px; height: 22px; pointer-events: none; }

/* ── Read More Widget ──────────────────────────────────── */
.adrin-readmore-wrapper {
    position: relative;
    font-family: inherit;
}

.adrin-readmore-content {
    overflow: hidden;
    transition: max-height .5s cubic-bezier(.4,0,.2,1);
    position: relative;
}

.adrin-readmore-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, var(--adrin-rm-fade, #fff), transparent);
    pointer-events: none;
}

.adrin-readmore-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    transition: opacity .2s;
}

.adrin-readmore-btn:hover { opacity: .75; }

.adrin-readmore-btn svg {
    width: 1em;
    height: 1em;
    transition: transform .3s;
}

.adrin-readmore-btn.expanded svg {
    transform: rotate(180deg);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
    .adrin-gallery-main {
        border-radius: 10px;
    }

    .adrin-lightbox-nav.prev { left: 10px; }
    .adrin-lightbox-nav.next { right: 10px; }

    .adrin-lightbox-inner img,
    .adrin-lightbox-inner video {
        border-radius: 4px;
    }

    .adrin-lightbox-inner iframe {
        width: 95vw;
        height: 54vw;
    }
}
