:root {
    --vsg-purple: #9b30ff;
    --vsg-dark: #1a1a1a;
    --vsg-bg: #ffffff;
}

.vsg-container,
.vsg-modal,
.vsg-container *,
.vsg-modal * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    line-height: normal;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-align: left;
    max-width: none;
}

.vsg-container {
    margin: 30px auto;
    background: transparent;
    overflow: hidden;
    /* Changed back to hidden to prevent loading jump */
    position: relative;
    width: 100%;
    clear: both;
    padding: 10px 4px;
    /* Sufficient padding for borders */
}

/* Grid style for loading state (before Swiper starts) */
.vsg-container:not(.swiper-initialized) .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    /* Prevent stacking/wrapping */
    gap: 10px;
}

.vsg-container:not(.swiper-initialized) .vsg-slide {
    flex: 0 0 calc(25% - 7.5px);
    max-width: calc(25% - 7.5px);
    height: auto;
    flex-shrink: 0;
}

/* Static Grid Layout */
.vsg-static-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--vsg-grid-cols, 4), 1fr) !important;
    gap: 20px !important;
    padding: 10px !important;
}

@media (max-width: 1024px) {
    .vsg-static-grid {
        grid-template-columns: repeat(min(var(--vsg-grid-cols, 4), 3), 1fr) !important;
    }
}

@media (max-width: 768px) {
    .vsg-static-grid {
        grid-template-columns: repeat(min(var(--vsg-grid-cols, 4), 2), 1fr) !important;
    }
}

@media (max-width: 480px) {
    .vsg-static-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Ensure Swiper uses full width when active */
.vsg-container.swiper-initialized {
    overflow: hidden;
    /* Hide overflow only when playing as a slider */
}

.vsg-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--vsg-s1-bg, #fff);
    border-radius: var(--vsg-s1-radius, 12px);
}

.vsg-video-section {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16 !important;
    height: auto !important;
    border: var(--vsg-s1-border-width, 3px) var(--vsg-s1-border-style, solid) var(--vsg-s1-border-color, var(--vsg-purple));
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-sizing: border-box;
}

.vsg-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.vsg-video,
.vsg-iframe-container {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

.vsg-iframe-container iframe,
.vsg-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transform: scale(1) !important;
    /* Force natural size */
    transform-origin: center !important;
    border: none;
    outline: none;
    background: transparent !important;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Explicitly NO scale transition */
}

.vsg-iframe-container.vsg-loaded iframe {
    opacity: 1;
}

.vsg-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s ease;
}

.vsg-play-overlay:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(1.1);
}

.vsg-play-overlay svg {
    width: 34px;
    height: 34px;
    color: #fff;
    margin-left: 2px;
}

.vsg-info-section {
    display: flex;
    align-items: center;
    padding: 10px;
    /* Slightly reduced padding */
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    gap: 8px;
    /* Slightly reduced gap */
    width: 100%;
    overflow: hidden;
}

.vsg-thumb {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
}

.vsg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 1300px) {
    .vsg-container {
        padding: 30px 0;
        overflow: hidden;
    }
}

.vsg-details {
    flex-grow: 1;
    min-width: 0;
    /* Crucial for truncation in flexbox */
    overflow: hidden;
}

.vsg-product-title {
    margin: 0;
    font-size: var(--vsg-s1-title-size, 13px);
    font-weight: 700;
    color: var(--vsg-s1-title-color, var(--vsg-dark));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vsg-product-price {
    font-size: var(--vsg-s1-price-size, 11px);
    font-weight: 600;
    color: var(--vsg-s1-price-color, #666);
    display: block;
}

.vsg-product-price ins {
    text-decoration: none;
    color: inherit;
    font-weight: 700;
}

.vsg-product-price del {
    color: #999;
    font-size: 0.9em;
    margin-right: 5px;
    text-decoration: line-through;
}

.vsg-product-price .woocommerce-Price-amount {
    color: inherit;
}

.vsg-buy-now,
.vsg-info-section .vsg-buy-now.button,
.vsg-info-section a.vsg-buy-now {
    background: var(--vsg-s1-btn-bg, #1a1a1a) !important;
    color: var(--vsg-s1-btn-color, #fff) !important;
    text-decoration: none !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    display: block !important;
    text-align: center !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
}

.vsg-buy-now:hover,
.vsg-info-section .vsg-buy-now.button:hover,
.vsg-info-section a.vsg-buy-now:hover {
    background: #000 !important;
    color: #fff !important;
    opacity: 0.9 !important;
}

.swiper-pagination {
    position: relative !important;
    bottom: 0 !important;
    margin-top: 25px;
}

.swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #ccc;
    opacity: 1;
    transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
    background: var(--vsg-purple) !important;
    width: 28px;
    border-radius: 5px;
}

/* Modal Premium Layout */
.vsg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999 !important;
    display: none;
    align-items: center;
    justify-content: center;
}

.vsg-modal.vsg-active {
    display: flex;
}

.vsg-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.vsg-modal-content {
    position: relative;
    width: 95%;
    max-width: 450px;
    height: auto !important;
    aspect-ratio: 9/16 !important;
    max-height: 90vh;
    background: transparent !important;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* Progress Bar */
.vsg-modal-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 30;
}

.vsg-modal-progress-inner {
    height: 100%;
    width: 0%;
    background: #fff;
    transition: width 0.1s linear;
}

/* Modal Header */
.vsg-modal-header {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 25;
}

.vsg-modal-header-left {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.25) !important;
    padding: 0 20px;
    height: 40px;
    border-radius: 40px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 65%;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.vsg-modal-top-info {
    display: flex;
    flex-direction: column;
}

.vsg-modal-p-title {
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.vsg-modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vsg-modal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vsg-nav-btn {
    width: 40px !important;
    height: 40px !important;
    background: rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.vsg-nav-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.1);
}

.vsg-nav-btn svg {
    width: 22px;
    height: 22px;
    fill: #fff !important;
}

.vsg-modal-close {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.vsg-modal-close:hover {
    background: rgba(255, 0, 0, 0.4) !important;
    transform: scale(1.1) rotate(90deg);
}

#vsg-modal-player-container {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #000 !important;
    z-index: 1;
}

#vsg-modal-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000 !important;
}

.vsg-slide-up {
    transform: translateY(-100%);
    opacity: 0;
}

.vsg-slide-down {
    transform: translateY(100%);
    opacity: 0;
}

.vsg-slide-reset {
    transform: translateY(0);
    opacity: 1;
}

.vsg-modal-click-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    cursor: pointer;
}

.vsg-modal-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 16;
    pointer-events: none;
}

.vsg-modal.vsg-paused .vsg-modal-play-overlay {
    display: flex;
}

.vsg-modal-play-overlay svg {
    width: 44px;
    height: 44px;
    color: #fff;
    margin-left: 4px;
}

#vsg-modal-player iframe,
#vsg-modal-player video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border: none;
    transform: scale(1) !important;
    transform-origin: center !important;
    background: transparent !important;
    position: absolute;
    top: 0;
    left: 0;
}

.vsg-modal-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    z-index: 20;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.vsg-modal-product-card {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    overflow: hidden;
}

.vsg-modal-card-img {
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.vsg-modal-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vsg-modal-card-details {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.vsg-modal-card-details h4 {
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vsg-modal-p-price {
    display: block;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}

.vsg-modal-card-action {
    flex-shrink: 0;
}

.vsg-modal-buy-btn,
.vsg-modal-card-action .vsg-modal-buy-btn.button,
.vsg-modal-card-action a.vsg-modal-buy-btn {
    background: #1a1a1a !important;
    color: #fff !important;
    text-decoration: none !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    white-space: nowrap !important;
    display: inline-block !important;
    line-height: normal !important;
}

.vsg-modal-buy-btn:hover,
.vsg-modal-card-action .vsg-modal-buy-btn.button:hover,
.vsg-modal-card-action a.vsg-modal-buy-btn:hover {
    background: #000 !important;
    color: #fff !important;
    opacity: 0.9 !important;
}

/* Style 2 - Modern eCommerce Layout */
.vsg-style2 .vsg-slide {
    padding: 0 5px;
}

.vsg-card-s2 {
    background: var(--vsg-s2-bg, #fff);
    border-radius: var(--vsg-s2-radius, 16px);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: var(--vsg-s2-border-width, 1px) var(--vsg-s2-border-style, none) var(--vsg-s2-border-color, #e2e8f0);
}

.vsg-video-section-s2 {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16 !important;
    background: #000;
    overflow: hidden;
}

.vsg-style2 .vsg-play-overlay {
    width: 50px;
    height: 50px;
}

.vsg-style2 .vsg-play-overlay svg {
    width: 28px;
    height: 28px;
}

/* Style 2 Overlays */
.vsg-views-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 10;
}

.vsg-views-text {
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.vsg-actions-overlay {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.vsg-action-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.vsg-action-icon:hover {
    transform: scale(1.1);
}

.vsg-action-icon svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Style 2 Info Section */
.vsg-info-section-s2 {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vsg-main-info-s2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vsg-p-thumb-s2 {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.vsg-p-thumb-s2 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vsg-p-details-s2 {
    flex-grow: 1;
    overflow: hidden;
}

.vsg-p-title-s2 {
    font-size: var(--vsg-s2-title-size, 13px);
    font-weight: 600;
    color: var(--vsg-s2-title-color, #333);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vsg-p-price-s2 {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.vsg-p-price-s2 ins {
    text-decoration: none;
    color: var(--vsg-s2-price-color, #f64d4d);
    font-weight: 700;
    font-size: var(--vsg-s2-price-size, 13px);
}

.vsg-p-price-s2 del {
    color: #999;
    font-size: 0.85em;
    font-weight: 400;
    text-decoration: line-through;
}

.vsg-p-price-s2 .woocommerce-Price-amount {
    color: inherit;
    font-weight: inherit;
}

/* Style 2 Buy Button */
.vsg-buy-btn-s2,
.vsg-info-section-s2 .vsg-buy-btn-s2.button,
.vsg-info-section-s2 a.vsg-buy-btn-s2 {
    background: var(--vsg-s2-btn-bg, #f9a85d) !important;
    color: var(--vsg-s2-btn-color, #fff) !important;
    text-align: center !important;
    text-decoration: none !important;
    padding: 10px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    display: block !important;
    width: 100% !important;
    transition: background 0.3s ease !important;
    box-shadow: 0 4px 6px rgba(249, 168, 93, 0.2) !important;
    border: none !important;
    line-height: 1.4 !important;
}

.vsg-buy-btn-s2:hover,
.vsg-info-section-s2 .vsg-buy-btn-s2.button:hover,
.vsg-info-section-s2 a.vsg-buy-btn-s2:hover {
    background: #e0924a !important;
}

/* Ensure Swiper works well with Style 2 spacing */
.vsg-style2 {
    padding-left: 10px;
    padding-right: 10px;
}

@media (max-width: 640px) {
    .vsg-p-title-s2 {
        font-size: 11px;
    }

    .vsg-p-price-s2 {
        font-size: 11px;
    }

    .vsg-buy-btn-s2 {
        padding: 8px;
        font-size: 12px;
    }
}

/* Pagination Styling */
.vsg-container .swiper-pagination {
    position: relative !important;
    bottom: 0 !important;
    margin-top: 25px !important;
    text-align: center !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
}

.vsg-container .swiper-pagination-bullet {
    width: 8px !important;
    height: 8px !important;
    background: #ccc !important;
    opacity: 0.5 !important;
    margin: 0 !important;
    transition: all 0.3s ease !important;
    border-radius: 50% !important;
}

.vsg-container .swiper-pagination-bullet-active {
    width: 24px !important;
    height: 8px !important;
    background: var(--vsg-purple, #9b30ff) !important;
    opacity: 1 !important;
    border-radius: 10px !important;
}