/**
 * SPT Main Styles
 * Professional, Scoped, and Responsive
 */

/* =========================================
   1. Global Container & Resets
   ========================================= */

/* Main Container */
.spt-product-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 40px; /* Increased gap for better breathing room */
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.spt-product-container.spt-product-type-ghs .spt-gallery-column,
.spt-product-container.spt-product-type-glm .spt-gallery-column {
    padding-top: 30px;
}

.spt-product-container.spt-product-type-glm .spt-gallery-column {
    padding-top: 150px;
}

/* Ensure all elements inside use border-box */
.spt-product-container *,
.spt-product-container *::before,
.spt-product-container *::after {
    box-sizing: border-box;
}

/* Base Columns */
.spt-gallery-column,
.spt-info-column {
    width: 100%;
    min-width: 0; /* Critical for Flexbox text wrapping */
}

/* Bulletproof Images/Iframes inside Info Column */
.spt-info-column img,
.spt-info-column iframe,
.spt-info-column video {
    max-width: 100%;
    height: auto;
}

/* Helper Class */
.spt-hidden {
    display: none !important;
}

/* =========================================
   2. Swiper Gallery Styles
   ========================================= */
.spt-swiper-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 8px; /* Modern rounded corners */
    background-color: #fff;
}

.spt-swiper-container .swiper-slide img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Navigation Buttons (Customized) */
.spt-swiper-container .swiper-button-next,
.spt-swiper-container .swiper-button-prev {
    color: #333;
    background: rgba(255, 255, 255, 0.8);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.spt-swiper-container .swiper-button-next:after,
.spt-swiper-container .swiper-button-prev:after {
    font-size: 18px;
    font-weight: bold;
}

/* Thumbnails */
.spt-gallery-thumbs {
    margin-top: 15px;
    padding: 2px 0;
}

.spt-gallery-thumbs .swiper-slide {
    width: 25%;
    opacity: 0.6;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
}

.spt-gallery-thumbs .swiper-slide:hover {
    opacity: 0.8;
}

.spt-gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #333; /* Active Border */
}

.spt-gallery-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    display: block;
}

/* =========================================
   3. External Content Wrapper
   ========================================= */
/* This is OUTSIDE the flex container to prevent layout issues */
.spt-full-width-content {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

/* =========================================
   4. Styles Implementation
   ========================================= */

/* --- Style 1: Classic (Balanced) --- */
.spt-style-1 .spt-gallery-column {
    flex: 1 1 50%;
    max-width: 50%;
}
.spt-style-1 .spt-info-column {
    flex: 1 1 45%;
    max-width: 45%;
}

/* --- Style 2: Full Width Gallery --- */
.spt-style-2 .spt-gallery-column {
    flex: 1 1 100%;
    margin-bottom: 40px;
}
.spt-style-2 .spt-swiper-container {
    background: #f8f9fa;
    max-height: 700px;
}
.spt-style-2 .swiper-slide {
    display: flex;
    justify-content: center;
    background: #f8f9fa;
}
.spt-style-2 .swiper-slide img {
    width: auto;
    max-width: 100%;
    max-height: 700px;
    object-fit: contain;
}
.spt-style-2 .spt-info-column {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}
/* Left align generic elements that look bad centered */
.spt-style-2 .spt-info-column ul, 
.spt-style-2 .spt-info-column ol,
.spt-style-2 .spt-info-column form.cart {
    text-align: left;
    display: inline-block;
    width: 100%;
    max-width: 100%;
}

/* --- Style 3: Grid Layout --- */
.spt-style-3 .spt-gallery-column {
    flex: 1 1 58%;
    max-width: 58%;
}
.spt-style-3 .spt-info-column {
    flex: 1 1 38%;
    max-width: 38%;
    position: sticky;
    top: 40px;
    align-self: start;
}

/* --- Style 4: Sticky Info Box --- */
.spt-style-4 .spt-gallery-column {
    flex: 1 1 58%;
    max-width: 58%;
}
.spt-style-4 .spt-info-column {
    flex: 1 1 38%;
    max-width: 38%;
    position: sticky;
    top: 40px;
    align-self: start;
    
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.03);
}

/* --- Style 5: Minimal --- */
.spt-style-5 .spt-gallery-column {
    flex: 1 1 100%;
    margin-bottom: 50px;
}
.spt-style-5 .spt-swiper-container {
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.05);
}
.spt-style-5 .spt-info-column {
    max-width: 800px;
    margin: 0 auto;
}

/* --- Style 6: Modern Split --- */
.spt-style-6.spt-product-container {
    max-width: 100%;
    padding: 30px 0 0;
    margin: 0;
    gap: 0;
}
.spt-style-6 .spt-gallery-column {
    flex: 1 1 58%;
    max-width: 58%;
}
.spt-style-6 .spt-info-column {
    flex: 1 1 38%;
    max-width: 38%;
    position: sticky;
    top: 40px;
    align-self: start;
}

.spt-grid-gallery {
    display: grid;
    gap: 12px;
}

.spt-grid-item {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: #f3f4f6;
}

.spt-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.spt-style-3 .spt-grid-gallery {
    grid-template-columns: repeat(3, 1fr);
}

.spt-style-6 .spt-grid-gallery {
    grid-template-columns: repeat(2, 1fr);
}

.spt-style-7 .spt-gallery-column {
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 20px);
}

.spt-style-7 .spt-info-column {
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 20px);
    position: sticky;
    top: 40px;
    align-self: start;
}

.spt-style-7 .spt-grid-gallery {
    grid-template-columns: repeat(4, 1fr);
}

/* --- Style 8: Full Width Grid (6 Columns) + Info Below --- */
.spt-style-8 .spt-gallery-column {
    flex: 1 1 100%;
    max-width: 100%;
}

.spt-style-8 .spt-info-column {
    flex: 1 1 100%;
    max-width: 900px;
    margin: 0 auto;
}

.spt-style-8 .spt-grid-gallery {
    grid-template-columns: repeat(6, 1fr);
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================
   5. Typography & Elements Polish
   ========================================= */
.spt-info-column h1.product_title {
    font-size: 2rem;
    margin-bottom: 15px;
    line-height: 1.3;
}

.spt-info-column .price {
    font-size: 1.0rem !important;
    color: #333;
    font-weight: 600;
    margin-bottom: 25px;
    display: block;
}

.spt-info-column .woocommerce-product-details__short-description {
    margin-bottom: 30px;
    line-height: 1.6;
    color: #666;
}

.spt-info-column form.cart {
    margin-bottom: 30px;
}

/* =========================================
   6. Responsive Design
   ========================================= */
@media (max-width: 991px) {
    /* Stack Columns */
    .spt-style-1 .spt-gallery-column, .spt-style-1 .spt-info-column,
    .spt-style-3 .spt-gallery-column, .spt-style-3 .spt-info-column,
    .spt-style-4 .spt-gallery-column, .spt-style-4 .spt-info-column,
    .spt-style-6 .spt-gallery-column, .spt-style-6 .spt-info-column,
    .spt-style-7 .spt-gallery-column, .spt-style-7 .spt-info-column {
        flex: 1 1 100%;
        max-width: 100%;
    }

    /* Style 3 Mobile Reset */
    .spt-style-3 .spt-gallery-column {
        display: block;
    }
    .spt-style-3 .spt-swiper-container,
    .spt-style-3 .spt-swiper-container .swiper-wrapper {
        display: flex;
    }
    .spt-style-3 .swiper-slide:first-child {
        grid-column: auto;
    }
    .spt-style-3 .spt-gallery-thumbs {
        display: block !important;
    }

    /* Style 4 Mobile Reset */
    .spt-style-4 .spt-info-column {
        position: static;
        padding: 0;
        box-shadow: none;
        border: none;
    }

    /* Style 6 Mobile Reset */
    .spt-style-6 .spt-gallery-column {
        height: auto;
        min-height: 300px;
    }
    .spt-style-6 .spt-swiper-container {
        height: auto;
        position: static;
    }
    .spt-style-6 .swiper-slide {
        height: auto;
        min-height: 300px;
    }
    .spt-style-6 .swiper-slide img {
        height: auto;
        min-height: 300px;
        position: static;
    }
    .spt-style-6 .spt-info-column {
        padding: 40px 20px;
        min-height: auto;
    }

    .spt-style-8 .spt-grid-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 575px) {
    .spt-style-8 .spt-grid-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   7. Fixes & Overrides
   ========================================= */

/* 1. Aggressively Hide Default WooCommerce Gallery 
   (In case theme forces it or hooks don't remove it) */
.woocommerce-product-gallery,
.images .flex-control-thumbs,
div.images, 
.thumbnails {
    display: none !important;
}

/* BUT ensure OUR gallery is visible (in case we used standard classes, though we used custom ones) */
.spt-gallery-column .spt-swiper-container,
.spt-gallery-column .spt-gallery-thumbs {
    display: block !important;
}

/* 2. Fix External Content Overflow (Tables, Plugins) */
.spt-full-width-content {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent page-level horizontal scroll */
    -webkit-overflow-scrolling: touch; /* Smooth scroll on mobile */
}

.spt-full-width-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}

/* Local horizontal scroll wrapper for wide tables (added by JS) */
.spt-full-width-content .spt-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.spt-full-width-content .spt-table-scroll table {
    width: 100%;
    border-collapse: collapse;
}

/* Golden Hosting Services (external plugin) overflow compatibility */
.spt-full-width-content .ghs-subscription-options-modern,
.spt-full-width-content .ghs-subscription-options,
.spt-full-width-content .ghs-client-dashboard {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
}

/* This plugin uses negative horizontal margins to go full-bleed; neutralize inside our constrained container */
.spt-full-width-content .ghs-features-highlight {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.spt-full-width-content .ghs-plans-grid {
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    justify-items: stretch;
}

.spt-full-width-content .ghs-plan-card,
.spt-full-width-content .ghs-plan-card label {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.spt-full-width-content .ghs-plan-card {
    overflow: hidden;
}

/* Force WooCommerce price smaller even if theme overrides */
.spt-product-container .spt-info-column .price,
.spt-product-container .spt-info-column .price * ,
.spt-product-container .spt-info-column .price ins,
.spt-product-container .spt-info-column .price del,
.spt-product-container .spt-info-column .price .woocommerce-Price-amount,
.spt-product-container .spt-info-column .price .woocommerce-Price-amount bdi {
    font-size: 1.3rem !important;
    line-height: 1.3 !important;
    color: #e11d48 !important;
}

/* Golden Hosting Services: keep cards readable and prevent text clipping inside our constrained content area */
.spt-full-width-content .ghs-plan-card label {
    min-height: 0 !important;
    height: auto !important;
}

.spt-full-width-content .ghs-price-main {
    font-size: 22px !important;
    line-height: 1.25 !important;
    white-space: nowrap;
}

.spt-full-width-content .ghs-plan-header h4 {
    font-size: 16px !important;
    line-height: 1.3 !important;
}

.spt-full-width-content .ghs-plan-select,
.spt-full-width-content .ghs-price-monthly,
.spt-full-width-content .ghs-plan-savings {
    font-size: 12px !important;
    line-height: 1.3 !important;
}

.spt-full-width-content .ghs-plan-card * {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Keep external plugin price amounts on one line */
.spt-full-width-content .ghs-price-main .woocommerce-Price-amount,
.spt-full-width-content .ghs-price-display .woocommerce-Price-amount,
.spt-full-width-content .ghs-price-main .woocommerce-Price-amount bdi,
.spt-full-width-content .ghs-price-display .woocommerce-Price-amount bdi {
    white-space: nowrap !important;
}

/* But keep monthly + renewal info separated and readable */
.spt-full-width-content .ghs-price-monthly,
.spt-full-width-content .ghs-renewal-price-info,
.spt-full-width-content .ghs-renewal-price-info small {
    display: block !important;
    white-space: normal !important;
    margin-top: 4px;
}

/* If the plugin uses a flex row wrapper for prices, force it to stack */
.spt-full-width-content .ghs-plan-price {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.spt-full-width-content .ghs-plan-price > * {
    width: 100% !important;
}

/* Golden License Manager (external plugin) layout compatibility inside SPT */
.spt-full-width-content .glm-pricing-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 30px !important;
    margin-bottom: 30px !important;
    padding-top: 20px !important;
    padding-bottom: 20px !important;
    overflow-x: hidden;
}

.spt-full-width-content .glm-pricing-content {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.spt-full-width-content .glm-pricing-table {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 20px !important;
    justify-items: stretch;
}

.spt-full-width-content .glm-pricing-plan {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.spt-full-width-content img,
.spt-full-width-content iframe,
.spt-full-width-content video,
.spt-full-width-content object,
.spt-full-width-content embed {
    max-width: 100% !important;
    height: auto !important;
}

/* Fix specific common pricing table issues */
.spt-full-width-content .pricing-table,
.spt-full-width-content .price_table {
    width: 100% !important;
    /* table-layout: fixed; REMOVED - let it breathe */
}
