/*************************************************
  UGC GALLERY — SCOPED, THEME-SAFE (khớp PHP cũ)
**************************************************/

/* GRID */
.ugc-grid-wrap {
    --ugc-gap: 16px;
}

.ugc-grid {
    display: grid;
    gap: var(--ugc-gap);
}

.ugc-grid-wrap[data-cols="2"] .ugc-grid {
    grid-template-columns: repeat(2, 1fr);
}

.ugc-grid-wrap[data-cols="3"] .ugc-grid {
    grid-template-columns: repeat(3, 1fr);
}

.ugc-grid-wrap[data-cols="4"] .ugc-grid {
    grid-template-columns: repeat(4, 1fr);
}

.ugc-grid-wrap[data-cols="5"] .ugc-grid {
    grid-template-columns: repeat(5, 1fr);
}

.ugc-grid-wrap[data-cols="6"] .ugc-grid {
    grid-template-columns: repeat(6, 1fr);
}

.ugc-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f6f6f6;
    aspect-ratio: 1/1;
    cursor: pointer;
}

.ugc-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.ugc-card:hover img {
    transform: scale(1.05);
}

.ugc-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    transition: opacity .2s;
}

.ugc-cta {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -40%);
    padding: .6rem 1.2rem;
    border: 0;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all .2s;
}

.ugc-card:hover::after {
    opacity: 1;
}

.ugc-card:hover .ugc-cta {
    opacity: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

/* MODAL */
.ugc-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}

.ugc-modal.is-open {
    display: block;
}

.ugc-no-scroll {
    overflow: hidden;
}

.ugc-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .65);
}

.ugc-modal__dialog {
    position: relative;
    width: min(1200px, 94vw);
    height: min(88vh, 880px);
    margin: 5vh auto;
    background: #fff;
    color: #111;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}

.ugc-modal__close {
    position: absolute;
    right: 12px;
    top: 10px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    font-size: 28px;
    color: #555;
    cursor: pointer;
}

.ugc-modal__close:hover {
    color: #000;
}

/* BODY: 2 cột */
.ugc-modal__body {
    display: grid;
    height: 100%;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
}

/* LEFT: main (fill) + thumbs (96px) xếp dọc */
.ugc-modal__left {
    grid-template-rows: 1fr 96px;
    min-width: 0;
    min-height: 0;
    background: #fff;
}

/* MAIN slider (ACF slides) */
.ugc-swiper-main {
    position: relative;
    width: 100%;
    height: 100% !important;
}

.ugc-swiper-main .swiper-wrapper {
    height: 100% !important;
}

.ugc-swiper-main .swiper-slide {
    height: 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.ugc-swiper-main .swiper-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ép hiện nav kể cả ít slide */
.ugc-swiper-main .swiper-button-lock {
    display: flex !important;
}

.ugc-swiper-main .swiper-button-prev,
.ugc-swiper-main .swiper-button-next {
    color: #111;
    width: 36px;
    height: 36px;
    z-index: 5;
    background: rgba(255, 255, 255, .9);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

.ugc-swiper-main .swiper-button-prev::after,
.ugc-swiper-main .swiper-button-next::after {
    font-size: 16px;
    font-weight: 700;
}

/* THUMBS slider (Woo gallery) */
.ugc-swiper-thumbs {
    width: 100%;
    height: 96px;
    padding: 10px 12px;
    border-top: 1px solid #f1f1f1;
    background: #fff;
    box-sizing: border-box;
}

.ugc-swiper-thumbs .swiper-slide {
    width: 96px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
}

.ugc-swiper-thumbs .swiper-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* RIGHT panel (Woo fields) */
.ugc-modal__right {
    padding: 24px;
    overflow: auto;
    background: #fff;
}

.ugc-prod__head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.ugc-prod__thumb {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
}

.ugc-prod__title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
}

.ugc-prod__rating {
    line-height: 1;
    margin-bottom: 6px;
}

.ugc-prod__price {
    font-size: 20px;
    font-weight: 700;
    margin: 12px 0;
}

.woocommerce-Price-amount {
    font-weight: 700;
}

.ugc-prod__cart .button,
.ugc-prod__cart button[type="submit"] {
    background: #111;
    color: #fff;
    border-radius: 999px;
    padding: .7rem 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 12px;
}

.ugc-prod__author {
    margin-top: 10px;
    color: #444;
    font-size: 14px;
    font-style: italic;
}

.ugc-prod__caption {
    margin-top: 6px;
    color: #666;
    font-size: 15px;
}

.ugc-prod__link {
    display: inline-block;
    margin-top: 14px;
    font-size: 14px;
    color: #0066cc;
    text-decoration: underline;
}

/* Responsive */
@media (max-width:1024px) {
    .ugc-modal__dialog {
        height: auto;
    }

    .ugc-modal__body {
        grid-template-columns: 1fr;
    }

    .ugc-modal__left {
        height: 60vh;
    }
}

@media (max-width:767px) {
    .ugc-grid-wrap[data-cols] .ugc-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ugc-prod__title {
        font-size: 18px;
    }

    .ugc-prod__price {
        font-size: 18px;
    }
}