/* NNGX Mobile Woo – lưới ảnh xem trước trong mô tả sản phẩm */
.nmw-desc-gallery { margin: 24px 0 8px; clear: both; }
.nmw-desc-gallery .nmw-g-note {
    font-size: 14px; line-height: 1.55; color: #444; margin-bottom: 18px;
}
.nmw-desc-gallery .nmw-g-note strong { color: #222; }
.nmw-desc-gallery .nmw-g-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    max-width: 720px;
}
.nmw-desc-gallery .nmw-g-item {
    display: block;
    aspect-ratio: 3 / 4;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .10);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    cursor: zoom-in;
}
.nmw-desc-gallery .nmw-g-item:hover,
.nmw-desc-gallery .nmw-g-item:focus-visible {
    transform: translateY(-2px);
    border-color: #1e73be;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
    outline: none;
}
.nmw-desc-gallery .nmw-g-item img {
    display: block; width: 100%; height: 100%;
    object-fit: contain; margin: 0; padding: 0;
    border: 0; border-radius: 0; box-shadow: none; max-width: none;
}
@media (max-width: 600px) {
    .nmw-desc-gallery .nmw-g-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 360px) {
    .nmw-desc-gallery .nmw-g-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Đang tải: lớp phủ TRẮNG che toàn bộ bản xem trước, tải xong mới hiện ── */
.nmw-desc-gallery { position: relative; }
.nmw-desc-gallery .nmw-g-note,
.nmw-desc-gallery .nmw-g-grid { transition: opacity .5s ease; }
/* Ẩn nội dung thật trong lúc tải (2 lớp: class sớm ở <head> + class do gallery.js gắn) */
.nmw-gjs .nmw-desc-gallery:not(.is-ready) .nmw-g-note,
.nmw-gjs .nmw-desc-gallery:not(.is-ready) .nmw-g-grid,
.nmw-desc-gallery.is-loading .nmw-g-note,
.nmw-desc-gallery.is-loading .nmw-g-grid { opacity: 0 !important; visibility: hidden !important; }
.nmw-desc-gallery .nmw-g-loader {
    position: absolute; inset: -10px; z-index: 5;
    background: #fff;
    border: 1px solid #eceeef; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
    overflow: hidden; pointer-events: auto; cursor: progress;
    transition: opacity .5s ease;
}
.nmw-desc-gallery.is-ready .nmw-g-loader { opacity: 0; pointer-events: none; }
.nmw-desc-gallery .nmw-g-sk {
    position: absolute; margin: 10px 0 0 10px; /* bù inset -10px */
    border-radius: 6px; border: 1px solid #eef0f1;
    background: linear-gradient(100deg, #f3f4f5 30%, #fafbfb 50%, #f3f4f5 70%) 0 0 / 300% 100%;
    animation: nmwShimmer 1.4s linear infinite;
}
.nmw-desc-gallery .nmw-g-top {
    position: absolute; left: 10px; right: 10px; top: 10px; z-index: 2;
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; background: #fff; border: 1px solid #eef0f1; border-radius: 6px;
    font-size: 13px; color: #555; font-weight: 600;
}
.nmw-desc-gallery .nmw-g-top .nmw-g-ltxt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nmw-desc-gallery .nmw-g-pct { color: #1e73be; font-variant-numeric: tabular-nums; flex: none; }
.nmw-desc-gallery .nmw-g-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; overflow: hidden; border-radius: 0 0 6px 6px; }
.nmw-desc-gallery .nmw-g-bar i { display: block; height: 100%; width: 0; background: #1e73be; transition: width .15s linear; }
.nmw-desc-gallery .nmw-g-spin {
    position: absolute; left: 50%; top: 55%; z-index: 2; margin: -18px 0 0 -18px;
    width: 36px; height: 36px; border-radius: 50%;
    border: 3.5px solid rgba(0, 0, 0, .08); border-top-color: #1e73be;
    animation: nmwSpin .8s linear infinite;
}
@keyframes nmwSpin { to { transform: rotate(360deg); } }
@keyframes nmwShimmer { to { background-position: -300% 0; } }

/* ── Chưa có bản xem trước: 5 ô trắng ── */
.nmw-desc-gallery.nmw-g-empty .nmw-g-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nmw-desc-gallery .nmw-g-na {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 12px; text-align: center; cursor: default;
}
.nmw-desc-gallery .nmw-g-na:hover { transform: none; border-color: #e3e3e3; box-shadow: 0 2px 8px rgba(0, 0, 0, .10); }
.nmw-desc-gallery .nmw-g-na-ic svg { width: 30px; height: 30px; color: #c3c3c3; display: block; }
.nmw-desc-gallery .nmw-g-na-t { font-size: 12.5px; line-height: 1.4; color: #888; }
@media (max-width: 600px) {
    .nmw-desc-gallery.nmw-g-empty .nmw-g-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .nmw-desc-gallery .nmw-g-na-t { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
    .nmw-desc-gallery .nmw-g-spin, .nmw-desc-gallery .nmw-g-sk { animation-duration: 2s; }
}

/* Lightbox */
.nmw-lb {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(0, 0, 0, .9);
    display: flex; align-items: center; justify-content: center;
    touch-action: pan-y;
}
.nmw-lb[hidden] { display: none; }
.nmw-lb img { max-width: 94vw; max-height: 86vh; object-fit: contain; background: #fff; border-radius: 4px; }
.nmw-lb button {
    position: absolute; background: rgba(255, 255, 255, .15); color: #fff;
    border: 0; border-radius: 50%; width: 44px; height: 44px;
    font-size: 22px; line-height: 44px; text-align: center; cursor: pointer; padding: 0;
}
.nmw-lb button:hover { background: rgba(255, 255, 255, .3); }
.nmw-lb .nmw-lb-close { top: 14px; right: 14px; }
.nmw-lb .nmw-lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.nmw-lb .nmw-lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.nmw-lb .nmw-lb-count { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 14px; }
