/* ============================================================
   IMH Video Gallery Widget — gallery.css
   ============================================================ */

/* Grid */
.imh-vg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

/* Card */
.imh-vg-card {
    position: relative;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.imh-vg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

/* Thumbnail */
.imh-vg-thumb-wrap {
    position: relative;
    width: 100%;
    /* 16:9 aspect ratio */
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.imh-vg-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease, filter 0.35s ease;
}

.imh-vg-card:hover .imh-vg-thumb {
    transform: scale(1.04);
    filter: brightness(0.75);
}

/* Overlay */
.imh-vg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.imh-vg-card:hover .imh-vg-overlay {
    opacity: 1;
}

/* Play Button */
.imh-vg-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ff0000;
    border: none;
    cursor: pointer;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imh-vg-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

.imh-vg-card:hover .imh-vg-play-btn {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Card: enforce 16:9 */
.imh-vg-card {
    aspect-ratio: 16 / 9;
}

/* Inline iframe (replace thumbnail on click or hover preview) */
.imh-vg-thumb-wrap iframe.imh-vg-inline-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 10;
}

/* Hover preview: fade in smoothly */
.imh-vg-thumb-wrap iframe.imh-vg-hover-frame {
    animation: imhFadeIn 0.4s ease;
    pointer-events: none;
}

/* Title bar — πάνω στο overlay, κάτω μέρος thumbnail */
.imh-vg-title-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 12px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

.imh-vg-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Info (μόνο description αν ενεργό) */
.imh-vg-info {
    padding: 8px 12px 10px;
}

.imh-vg-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Empty state */
.imh-vg-empty {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* ── Skeleton loading ── */
@keyframes imhShimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.imh-vg-card.imh-vg-loading .imh-vg-thumb-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0)    0%,
        rgba(255,255,255,0.08) 40%,
        rgba(255,255,255,0.18) 50%,
        rgba(255,255,255,0.08) 60%,
        rgba(255,255,255,0)    100%
    );
    background-size: 600px 100%;
    animation: imhShimmer 1.4s infinite linear;
    border-radius: inherit;
}

.imh-vg-card.imh-vg-loading .imh-vg-thumb {
    filter: brightness(0.25);
}

/* ── Lightbox ── */
.imh-vg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    animation: imhFadeIn 0.2s ease;
}

.imh-vg-lightbox.is-open {
    display: flex;
}

@keyframes imhFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.imh-vg-lightbox-inner {
    position: relative;
    width: 90vw;
    max-width: 1100px;
    animation: imhSlideUp 0.25s ease;
}

@keyframes imhSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.imh-vg-lightbox-iframe-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7);
}

.imh-vg-lightbox-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.imh-vg-lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s;
    padding: 0;
}

.imh-vg-lightbox-close:hover {
    opacity: 1;
}

/* ── Lightbox nav wrap (prev/iframe/next) ── */
.imh-vg-lb-nav-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.imh-vg-lb-nav-wrap .imh-vg-lightbox-iframe-wrap {
    flex: 1 1 auto;
}

.imh-vg-lb-prev,
.imh-vg-lb-next {
    flex: 0 0 auto;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 48px;
    line-height: 1;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    padding: 0 0 4px 0;
}

.imh-vg-lb-prev:hover,
.imh-vg-lb-next:hover {
    background: rgba(255,255,255,0.22);
    transform: scale(1.08);
}

.imh-vg-lb-prev:disabled,
.imh-vg-lb-next:disabled {
    opacity: 0.25;
    cursor: default;
    transform: none;
}

/* ── Related videos strip ── */
.imh-vg-lb-related {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.imh-vg-lb-related::-webkit-scrollbar {
    height: 4px;
}
.imh-vg-lb-related::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.imh-vg-lb-related-item {
    flex: 0 0 auto;
    width: 140px;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    background: #000;
}

.imh-vg-lb-related-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.4);
}

.imh-vg-lb-related-item.is-active {
    border-color: #ff0000;
}

.imh-vg-lb-related-item img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.imh-vg-lb-related-item span {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.75);
    padding: 4px 6px 5px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Responsive fallbacks (editor columns handle the grid via Elementor selectors) ── */
@media (max-width: 767px) {
    .imh-vg-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .imh-vg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
