/* =========================================================
   Video Gallery — adaptive front-end styles
   ========================================================= */

.vg-container {
    box-sizing: border-box;
    margin: 0px 0px 20px 0 !important;
    font-family: inherit;
}

.vg-container *,
.vg-container *::before,
.vg-container *::after {
    box-sizing: border-box;
}

.vg-title {
    margin: 0 0 5px 0;
    font-size: 22px;
    font-weight: 600;
}

.vg-description {
    margin: 0 0 20px 0;
    color: #666;
    line-height: 1.6;
    font-size: 15px;
}

.vg-empty {
    color: #999;
    text-align: center;
    padding: 30px;
    font-style: italic;
}

/* ===== Play icon (center of every thumbnail) ===== */
.vg-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center center / 38px 38px no-repeat;
    border-radius: 50%;
    z-index: 5;
    transition: background 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.vg-thumb {
    position: relative;
    display: block;
    overflow: hidden;
    cursor: pointer;
    border-radius: 10px !important;
    background: #1a1a1a;
    line-height: 0;
}

.vg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.vg-thumb:hover img {
    transform: scale(1.05);
    opacity: 0.85;
}

.vg-thumb:hover .vg-play-icon {
    background-color: rgba(200, 40, 40, 0.85);
    transform: translate(-50%, -50%) scale(1.12);
}

.vg-thumb-placeholder {
    width: 100%;
    aspect-ratio: var(--vg-thumb-aspect, 16/9);
    background: #2a2a2a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center center / 48px no-repeat;
}

.vg-thumb-placeholder-sm {
    width: 100%;
    aspect-ratio: 16/9;
    background: #2a2a2a;
}

.vg-video-caption {
    text-align: center;
    font-size: 14px;
    padding: 8px 5px;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

/* =========================================================
   GRID MODE
   ========================================================= */
.vg-grid .vg-items-wrap {
    width: 100%;
}

.vg-grid .vg-items {
    display: grid;
    grid-template-columns: repeat(var(--vg-cols-desktop, 4), 1fr);
    gap: 18px;
    width: 100%;
}

.vg-grid .vg-grid-item {
    display: flex;
    flex-direction: column;
}

.vg-grid .vg-grid-item .vg-thumb {
    aspect-ratio: var(--vg-thumb-aspect, 16/9);
}

@media (max-width: 1199px) {
    .vg-grid .vg-items {
        grid-template-columns: repeat(var(--vg-cols-tablet992, 3), 1fr);
    }
}

@media (max-width: 991px) {
    .vg-grid .vg-items {
        grid-template-columns: repeat(var(--vg-cols-tablet768, 2), 1fr);
    }
}

@media (max-width: 767px) {
    .vg-grid .vg-items {
        grid-template-columns: repeat(var(--vg-cols-mobile, 1), 1fr);
        gap: 12px;
    }
}

/* ===== Pagination ===== */
.vg-pagination {
    text-align: center;
    margin-top: 25px;
}

.vg-pagination .pagination,
.vg-pagination .links,
.vg-pagination ul {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
}

.vg-pagination .pagination a,
.vg-pagination .pagination span,
.vg-pagination .links a,
.vg-pagination .links span,
.vg-pagination a,
.vg-pagination span {
    display: inline-block;
    padding: 7px 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: all 0.15s;
}

.vg-pagination a:hover {
    background: #f0f0f0;
    color: #c82828;
    border-color: #c82828;
}

.vg-pagination .active span,
.vg-pagination span.active,
.vg-pagination b {
    background: #c82828;
    color: #fff;
    border-color: #c82828;
}

/* =========================================================
   CAROUSEL MODE
   ========================================================= */
.vg-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.vg-carousel-track {
    display: flex;
    overflow: hidden;
    flex: 1;
    scroll-behavior: smooth;
    gap: 16px;
    padding: 2px;
}

.vg-carousel-item {
    display: flex;
    flex-direction: column;
}

.vg-carousel-item .vg-thumb {
    aspect-ratio: var(--vg-thumb-aspect, 16/9);
}

.vg-carousel-prev,
.vg-carousel-next {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 18px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vg-carousel-prev {
    margin-right: 8px;
}

.vg-carousel-next {
    margin-left: 8px;
}

.vg-carousel-prev:hover,
.vg-carousel-next:hover {
    background: rgba(200,40,40,0.85);
}

@media (max-width: 767px) {
    .vg-carousel-item {
        flex: 0 0 75% !important;
    }
}

/* =========================================================
   SLIDER MODE
   ========================================================= */
.vg-slider-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.vg-slider-main {
    position: relative;
    overflow: hidden;
}

.vg-main-item {
    display: none;
}

.vg-main-item.vg-active {
    display: block;
}

.vg-main-thumb {
    position: relative;
    cursor: pointer;
    line-height: 0;
}

.vg-main-thumb img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 70vh;
}

.vg-slider-prev,
.vg-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 22px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vg-slider-prev {
    left: 12px;
}

.vg-slider-next {
    right: 12px;
}

.vg-slider-prev:hover,
.vg-slider-next:hover {
    background: rgba(200,40,40,0.85);
}

/* ===== Slider thumbnail navigation strip ===== */
.vg-slider-nav {
    margin-top: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.vg-slider-nav-track {
    display: flex;
    gap: 10px;
    padding-bottom: 4px;
}

.vg-nav-thumb {
    flex: 0 0 auto;
    width: calc(100% / var(--vg-cols-desktop, 5) - 10px);
    min-width: 80px;
    cursor: pointer;
    opacity: 0.5;
    border: 3px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    transition: opacity 0.2s, border-color 0.2s;
    line-height: 0;
    position: relative;
}

.vg-nav-thumb img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.vg-nav-thumb:hover {
    opacity: 0.8;
}

.vg-nav-thumb.vg-active {
    opacity: 1;
    border-color: #c82828;
}

.vg-nav-title {
    display: block;
    font-size: 12px;
    color: #555;
    text-align: center;
    padding: 4px 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1199px) {
    .vg-nav-thumb {
        width: calc(100% / 4 - 10px);
    }
}

@media (max-width: 767px) {
    .vg-nav-thumb {
        width: calc(100% / 3 - 10px);
    }
}

/* =========================================================
   POPUP / MODAL VIDEO PLAYER
   ========================================================= */
.vg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vg-overlay.vg-open {
    display: flex;
}

.vg-modal {
    position: relative;
    width: 90%;
    max-width: 960px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

.vg-modal-inner {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
}

.vg-modal-inner.vg-vertical {
    padding-bottom: 0;
    height: auto;
}

.vg-modal video,
.vg-modal iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.vg-modal-inner.vg-vertical video,
.vg-modal-inner.vg-vertical iframe {
    position: relative;
    max-height: 80vh;
    margin: 0 auto;
}

.vg-close-btn {
    position: absolute;
   /* top: -40px; */
    top: 0px;
    right: 0;
    width: 37px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.vg-close-btn:hover {
    background: rgba(200,40,40,0.9);
}

@media (max-width: 767px) {
    .vg-modal {
        width: 96%;
    }
    .vg-close-btn {
        top: 0px;
		right: 40px !important;
    }
    .vg-play-icon {
        width: 50px;
        height: 50px;
        background-size: 30px 30px;
    }
}

/* ===== Loading animation ===== */
.vg-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vg-spin 0.8s linear infinite;
}

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