/* ============================================================
   EV Media Gallery v1.1 – Frontend Styles
   ============================================================ */

/* ---- Layout ---- */
.evmg-wrapper {
    display: flex;
    gap: 0;
    max-width: 1100px;
    margin: 0 auto;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Sidebar ---- */
.evmg-sidebar {
    display: flex;
    flex-direction: column;
    width: 190px;
    min-width: 160px;
    background: #1a1a1a;
    order: 1; /* desktop: left side */
}

.evmg-tab-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;      /* centre content vertically */
    padding: 0 0 0 0;
    border: none;
    background: #2a2a2a;
    cursor: pointer;
    transition: background 0.2s;
    overflow: hidden;
    height: 115px;
    border-bottom: 2px solid #111;
    text-align: center;
    flex: 1 1 auto;
}

.evmg-tab-btn:last-child { border-bottom: none; }

.evmg-tab-btn img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: opacity 0.25s;
}

/* Label — sits in the vertical centre of the button */
.evmg-tab-label {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    padding: 6px 6px;
    background: rgba(0, 0, 0, 0.52);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1.2;
}

/* Count badge — pinned to the very bottom of the button */
.evmg-tab-count {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: block;
    width: 100%;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.4;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.evmg-tab-btn:hover img  { opacity: 0.85; }
.evmg-tab-btn.active img { opacity: 1; }

.evmg-tab-btn.active .evmg-tab-label {
    background: rgba(0, 120, 200, 0.85);
}

.evmg-tab-btn.active .evmg-tab-count {
    background: rgba(0, 90, 170, 0.88);
    border-top-color: rgba(255,255,255,0.2);
}

/* ---- Responsive: tabs move BELOW the content on mobile ---- */
@media ( max-width: 768px ) {
    .evmg-wrapper {
        flex-direction: column;
    }

    /* Content area comes first (top), sidebar tabs come second (bottom) */
    .evmg-content { order: 1; }
    .evmg-sidebar  { order: 2; }

    .evmg-sidebar {
        flex-direction: row;
        width: 100%;
        min-width: unset;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .evmg-tab-btn {
        flex: 1 0 80px;
        height: 80px;
        border-bottom: none;
        border-right: 2px solid #111;
        border-top: 2px solid #111;
    }
    .evmg-tab-btn:last-child { border-right: none; }

    .evmg-tab-label {
        font-size: 11px;
        padding: 5px 2px;
    }

    .evmg-tab-count {
        font-size: 10px;
        padding: 3px 4px;
    }

    .evmg-carousel,
    .evmg-video-wrap { height: 240px; }
}

/* ---- Content area (desktop: right side) ---- */
.evmg-content {
    flex: 1;
    min-width: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    order: 2;
}

.evmg-panel {
    display: none;
    flex: 1;
    flex-direction: column;
}
.evmg-panel.active {
    display: flex;
}

.evmg-empty {
    color: #666;
    padding: 40px 20px;
    text-align: center;
    margin: auto;
}

/* ---- Carousel ---- */
.evmg-carousel {
    position: relative;
    overflow: hidden;
    /* Fixed height: sidebar has 4 × 115px + 3 × 2px border = 466px */
    height: 466px;
    background: #000;
    flex: 1;
}

.evmg-carousel--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.evmg-carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.evmg-slide {
    flex: 0 0 100%;
    height: 100%;
    overflow: hidden;
    cursor: zoom-in;
}

.evmg-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.evmg-slide img:hover { transform: scale(1.02); }

/* Arrows */
.evmg-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.2);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.evmg-arrow:hover {
    background: rgba(0, 0, 0, 0.82);
    border-color: rgba(255,255,255,0.55);
}
.evmg-prev { left: 14px; }
.evmg-next { right: 14px; }

/* Dots */
.evmg-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 7px;
    z-index: 10;
}
.evmg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.38);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.evmg-dot.active {
    background: #fff;
    transform: scale(1.35);
}

/* Expand / fullscreen hint button */
.evmg-expand-btn {
    position: absolute;
    bottom: 14px;
    right: 14px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 6px;
    color: #fff;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 11;
    transition: background 0.2s;
    padding: 0;
    line-height: 0;
}
.evmg-expand-btn:hover { background: rgba(0,0,0,0.85); }
.evmg-expand-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

/* ---- Video panel (same height as carousel) ---- */
.evmg-video-wrap {
    height: 466px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.evmg-video-wrap iframe,
.evmg-video-wrap video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* YouTube facade / click-to-play */
.evmg-yt-facade {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background: #000;
    overflow: hidden;
}
.evmg-yt-facade img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}
.evmg-yt-facade:hover img { opacity: 0.85; }

.evmg-yt-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 68px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
    transition: transform 0.15s, filter 0.15s;
}
.evmg-yt-play:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.75));
}
.evmg-yt-play svg { width: 68px; height: 48px; }

/* Loaded iframe inside facade */
.evmg-yt-facade iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.evmg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.evmg-lightbox[hidden] { display: none; }

.evmg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: zoom-out;
}

.evmg-lightbox__stage {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
}

.evmg-lightbox__img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 40px);
}

.evmg-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7);
    transition: opacity 0.2s;
}
.evmg-lightbox__img.is-loading { opacity: 0; }

/* Spinner while image loads */
.evmg-lightbox__spinner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: evmg-spin 0.7s linear infinite;
    display: none;
}
.evmg-lightbox__spinner.active { display: block; }

@keyframes evmg-spin {
    to { transform: rotate(360deg); }
}

/* Counter  e.g.  3 / 12 */
.evmg-lightbox__counter {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Close button */
.evmg-lightbox__close {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 26px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    line-height: 1;
    transition: background 0.2s;
}
.evmg-lightbox__close:hover { background: rgba(200,0,0,0.75); }

/* Nav arrows */
.evmg-lightbox__prev,
.evmg-lightbox__next {
    background: rgba(0,0,0,0.45);
    border: 2px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.evmg-lightbox__prev:hover,
.evmg-lightbox__next:hover {
    background: rgba(0,0,0,0.82);
    border-color: rgba(255,255,255,0.55);
}
.evmg-lightbox__prev { order: 1; }
.evmg-lightbox__img-wrap { order: 2; }
.evmg-lightbox__next { order: 3; }

/* ---- Lightbox mobile tweaks ---- */
@media ( max-width: 768px ) {
    .evmg-lightbox__prev,
    .evmg-lightbox__next { display: none; }

    .evmg-lightbox__img-wrap {
        max-width: calc(100vw - 20px);
    }
}
