/* Single Product Page Styles */
.single-product-container {
    padding: 40px 0;
}

.product-summary-wrapper {
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

/* ===== PRODUCT GALLERY IMAGE FIXES ===== */
.product-gallery-wrapper {
    position: relative;
}

/* Main product image container */
.woocommerce-product-gallery {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.woocommerce-product-gallery__wrapper {
    margin: 0;
}

/* Main product image */
.woocommerce-product-gallery__image {
    width: 100%;
    height: auto;
    margin-bottom: 15px;
}

.woocommerce-product-gallery__image img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    max-height: 600px;
}

/* Flex slider container */
.flex-viewport {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.flex-viewport img {
    width: 100% !important;
    height: auto !important;
    max-height: 500px;
    object-fit: contain;
}

/* Thumbnail gallery */
.flex-control-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0 0 0;
    padding: 0;
    list-style: none;
}

.flex-control-thumbs li {
    flex: 0 0 calc(25% - 10px);
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.flex-control-thumbs li:hover,
.flex-control-thumbs li.flex-active {
    border-color: #007bff;
}

.flex-control-thumbs li img {
    width: 100% !important;
    height: 80px !important;
    object-fit: cover;
    display: block;
}

/* Make sure all WooCommerce images fit properly */
.woocommerce img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Product Gallery Zoom fix */
.zoomImg {
    cursor: zoom-in;
    max-width: none !important;
}

/* Product Badge */
.product-badge {
    display: inline-block;
    background: #ff4444;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* Product Title */
.product_title {
    font-size: 28px;
    margin-bottom: 15px;
    color: #333;
    font-weight: 700;
}

/* Price */
.price {
    font-size: 24px;
    color: #d32f2f;
    margin: 15px 0;
    font-weight: 700;
}

.price del {
    color: #999;
    font-size: 18px;
    margin-right: 10px;
}

.price ins {
    text-decoration: none;
}

/* Rating */
.woocommerce-product-rating {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.star-rating {
    color: #ffc107;
    font-size: 16px;
}

/* Custom Add to Cart Section */
.custom-add-to-cart-section {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.quantity-section {
    margin-bottom: 15px;
}

.quantity-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* Quantity input fix */
.quantity .qty,
.custom-qty-input {
    width: 120px !important;
    height: 46px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    padding: 0 10px;
}

/* Variation form fixes */
.variations_form {
    margin: 20px 0;
}

.variations {
    width: 100%;
    margin-bottom: 20px;
}

.variations tr {
    display: block;
    margin-bottom: 15px;
}

.variations td {
    display: block;
    padding: 0;
}

.variations td.label {
    margin-bottom: 5px;
    font-weight: 600;
}

.variations select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
}

/* Add to Cart Button */
.add-to-cart-btn {
    padding: 12px 35px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-radius: 6px;
    border: none;
    margin-right: 10px;
    min-width: 160px;
}

.add-to-cart-btn.btn-secondary {
    background: #6c757d;
    color: white;
}

.add-to-cart-btn.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.add-to-cart-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.add-to-cart-btn .btn-text {
    display: inline;
}

.add-to-cart-btn .loading-spinner {
    display: none;
}

.add-to-cart-btn.loading .btn-text {
    display: none;
}

.add-to-cart-btn.loading .loading-spinner {
    display: inline;
}

/* Buy Now Button */
.buy-now-btn {
    padding: 12px 35px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-radius: 6px;
    background: #007bff;
    color: white;
    border: none;
}

.buy-now-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Stock Status */
.custom-stock-status {
    margin: 15px 0;
}

.stock {
    padding: 8px 15px;
    border-radius: 6px;
    margin: 5px 0;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stock.in-stock {
    background: #e8f5e8;
    color: #2e7d32;
}

.stock.low-stock {
    background: #fff3e0;
    color: #f57c00;
}

.stock.out-of-stock {
    background: #ffebee;
    color: #c62828;
}

/* Product Meta */
.product_meta {
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* Share Section */
.product-share-section {
    margin: 25px 0;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.share-label {
    font-weight: 600;
    color: #666;
    margin-right: 15px;
}

.product-share-section a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.product-share-section a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.share-facebook { background: #3b5998; }
.share-twitter { background: #1da1f2; }
.share-email { background: #666; }

/* Trust Badges */
.trust-badges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 25px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #eee;
}

.trust-badge {
    text-align: center;
}

.trust-badge i {
    font-size: 28px;
    color: #007bff;
    margin-bottom: 8px;
    display: block;
}

.trust-badge span {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Product Video */
.product-video-section {
    margin: 40px 0;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
}

.product-video-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.product-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.product-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Frequently Bought Together */
.frequently-bought-together {
    padding: 30px;
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
}

.frequently-bought-together h3 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.products-grid .product-item {
    text-align: center;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 100%;
}

.products-grid .product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* Fix images in related products */
.products-grid .product-item img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
}

.products-grid .product-item h4 {
    margin: 15px 0 10px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    height: 45px;
    overflow: hidden;
}

.products-grid .product-item .price {
    color: #d32f2f;
    font-weight: 600;
    font-size: 18px;
    display: block;
    margin-bottom: 15px;
}

.add-to-cart-related {
    width: 100%;
    padding: 8px;
    font-size: 14px;
}

/* Fix related products images */
.related.products ul.products li.product img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.related.products ul.products {
    list-style: none;
    padding-left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.related.products ul.products li.product {
    list-style: none;
    padding-left: 0;
    background-image: none;
}

/* Product Tabs */
.woocommerce-tabs {
    margin: 40px 0;
}

.woocommerce-tabs ul.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    padding: 0;
    margin: 0 0 20px;
}

.woocommerce-tabs ul.tabs li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 15px 25px;
    color: #666;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.woocommerce-tabs ul.tabs li.active a {
    color: #d32f2f;
    border-bottom-color: #d32f2f;
}

.woocommerce-tabs .panel {
    padding: 30px !important;
    background: white;
    border-radius: 0 8px 8px 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Toast Notifications */
#ajax-toast .toast-body {
    font-weight: 500;
}

#ajax-toast.success .toast-body {
    color: #155724;
    background: #d4edda;
}

#ajax-toast.error .toast-body {
    color: #721c24;
    background: #f8d7da;
}

/* Responsive Design */
@media (max-width: 992px) {
    .trust-badges {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .related.products ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .single-product-wrapper {
        flex-direction: column;
    }
    
    .product-summary-wrapper {
        margin-top: 20px;
    }
    
    .custom-add-to-cart-section {
        text-align: center;
    }
    
    .add-to-cart-btn, .buy-now-btn {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .trust-badges {
        grid-template-columns: 1fr;
    }
    
    .products-grid .col-md-4 {
        margin-bottom: 20px;
    }
    
    .related.products ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product_title {
        font-size: 24px;
    }
    
    .price {
        font-size: 20px;
    }
    
    /* Fix gallery on mobile */
    .flex-control-thumbs li {
        flex: 0 0 calc(33.333% - 10px);
    }
    
    .flex-control-thumbs li img {
        height: 60px;
    }
}

@media (max-width: 576px) {
    .product-summary-wrapper {
        padding: 20px;
    }
    
    .frequently-bought-together {
        padding: 20px;
    }
    
    .related.products ul.products {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .flex-control-thumbs li {
        flex: 0 0 calc(25% - 10px);
    }
    
    .flex-control-thumbs li img {
        height: 50px;
    }
    
    .woocommerce-tabs ul.tabs {
        flex-wrap: wrap;
    }
    
    .woocommerce-tabs ul.tabs li {
        flex: 0 0 100%;
    }
    
    .woocommerce-tabs ul.tabs li a {
        text-align: center;
        border-bottom: 1px solid #eee;
    }
}

/* ===== FREQUENTLY BOUGHT TOGETHER STYLING ===== */

/* Product image container */
.product-item .product-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.product-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.product-item:hover img {
    transform: scale(1.05);
}

/* Product title */
.product-item h4 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    height: 45px;
    overflow: hidden;
    color: #333;
}

.product-item h4 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-item h4 a:hover {
    color: #007bff;
}

/* Price styling */
.product-item .price {
    color: #d32f2f;
    font-weight: 700;
    font-size: 18px;
    display: block;
    margin-bottom: 20px;
}

.product-item .price del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.product-item .price ins {
    text-decoration: none;
}

/* Add to Cart button */
.add-to-cart-related {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid #6c757d;
    background: transparent;
    color: #6c757d;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.add-to-cart-related:hover:not(:disabled) {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.add-to-cart-related:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-to-cart-related.loading {
    background: #6c757d;
    color: white;
}

/* ===== RELATED PRODUCTS - MATCH FREQUENTLY BOUGHT TOGETHER ===== */
.related.products {
    margin: 40px 0;
    padding: 30px;
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
}

.related.products h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

.related.products h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: #007bff;
}

/* Grid layout for related products */
.related.products ul.products {
    list-style: none;
    padding-left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin: 0;
}

.related.products ul.products li.product {
    list-style: none;
    padding-left: 0;
    background-image: none;
    text-align: center;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 10px;
    transition: all 0.3s ease;
    height: 100%;
    background: white;
    position: relative;
    overflow: hidden;
    margin: 0;
}

.related.products ul.products li.product:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-color: #007bff;
}

/* Image container for related products */
.related.products li.product .woocommerce-loop-product__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.related.products li.product img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 20px;
    transition: transform 0.5s ease;
    border-radius: 8px;
    background: #f8f9fa;
    padding: 10px;
}

.related.products li.product:hover img {
    transform: scale(1.05);
}

/* Product title in related */
.related.products li.product h2.woocommerce-loop-product__title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 10px;
    color: #333;
    height: 45px;
    overflow: hidden;
}

/* Price in related */
.related.products li.product .price {
    color: #d32f2f;
    font-weight: 700;
    font-size: 18px;
    display: block;
    margin-bottom: 15px;
}

.related.products li.product .price del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.related.products li.product .price ins {
    text-decoration: none;
}

/* Star rating */
.related.products li.product .star-rating {
    margin: 0 auto 10px;
    color: #ffc107;
    font-size: 14px;
}

/* Add to cart button for related */
.related.products li.product .button,
.related.products li.product .add_to_cart_button {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid #6c757d;
    background: transparent;
    color: #6c757d;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.related.products li.product .button:hover,
.related.products li.product .add_to_cart_button:hover:not(:disabled) {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-decoration: none;
}

.related.products li.product .button:disabled,
.related.products li.product .add_to_cart_button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sold out badge */
.related.products li.product .outofstock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

/* On sale badge */
.related.products li.product .onsale {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
    min-height: auto;
    line-height: 1;
}

/* ===== UPSEL PRODUCTS (You may also like) ===== */
.upsells.products {
    margin: 40px 0;
    padding: 30px;
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
}

.upsells.products h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

.upsells.products h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: #28a745;
}

.upsells.products ul.products {
    list-style: none;
    padding-left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin: 0;
}

.upsells.products ul.products li.product {
    @extend .related.products ul.products li.product;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .related.products ul.products,
    .upsells.products ul.products,
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .trust-badges {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .related.products ul.products,
    .upsells.products ul.products,
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .products-grid .product-item,
    .related.products ul.products li.product {
        padding: 15px;
    }
    
    .product-item .product-image,
    .related.products li.product img {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .single-product-wrapper {
        flex-direction: column;
    }
    
    .product-summary-wrapper {
        margin-top: 20px;
    }
    
    .custom-add-to-cart-section {
        text-align: center;
    }
    
    .add-to-cart-btn, .buy-now-btn {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .trust-badges {
        grid-template-columns: 1fr;
    }
    
    .products-grid .col-md-4 {
        margin-bottom: 20px;
    }
    
    .related.products,
    .upsells.products,
    .frequently-bought-together {
        padding: 20px;
    }
    
    .related.products h2,
    .upsells.products h2,
    .frequently-bought-together h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .product_item h4,
    .related.products li.product h2.woocommerce-loop-product__title {
        font-size: 15px;
        height: 40px;
    }
    
    .product-item .price,
    .related.products li.product .price {
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .product-summary-wrapper {
        padding: 20px;
    }
    
    .frequently-bought-together,
    .related.products,
    .upsells.products {
        padding: 15px;
    }
    
    .related.products ul.products,
    .upsells.products ul.products,
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .flex-control-thumbs li {
        flex: 0 0 calc(25% - 10px);
    }
    
    .flex-control-thumbs li img {
        height: 50px;
    }
    
    .woocommerce-tabs ul.tabs {
        flex-wrap: wrap;
    }
    
    .woocommerce-tabs ul.tabs li {
        flex: 0 0 100%;
    }
    
    .woocommerce-tabs ul.tabs li a {
        text-align: center;
        border-bottom: 1px solid #eee;
    }
    
    .product-item .product-image,
    .related.products li.product img {
        height: 160px;
    }
}


/* Remove buttons from related products */

/* Target WooCommerce related products specifically */
.woocommerce .related.products ul.products {
    list-style: none;
    margin: 0 0 1em;
    padding: 0;
}

.woocommerce .related.products ul.products li.product {
    list-style: none;
    position: relative;
    margin-bottom: 2em;
    padding-left: 0;
}

/* Remove any inherited list styling */
.woocommerce-page .related.products ul.products li.product {
    list-style: none !important;
    background: none !important;
}

/* If using theme that adds custom bullets */
.related.products li.product::marker {
    content: none;
}