/* CSS for smooth transitions on slider rebuild */
.tf-product-media-main .swiper-wrapper {
    transition: opacity 0.3s ease-in-out;
}

/* Hide slides that are not part of the current view to prevent FOUC */
.swiper-container-rebuilding .swiper-slide {
    opacity: 0;
}


/* Add a bit of style for out-of-stock variants if we add that logic later */
.variant-picker-values label.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    /* Make it unclickable */
    background-color: #f5f5f5;
}

/* Ensure variant labels update smoothly */
#current-color-text,
#current-size-text {
    display: inline-block;
    min-width: 20px;
    /* Prevent layout shift */
    transition: all 0.2s;
}

/* Thumbnail Slider Fix - Override default sizing */
.tf-product-media-wrap.thumbs-bottom {
    position: sticky !important;
    top: 20px !important;
}

.tf-product-media-wrap.thumbs-bottom .thumbs-slider {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-main {
    width: 100% !important;
    border-radius: 10px !important;
    order: 0 !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs {
    width: 100% !important;
    max-height: none !important;
    order: 1 !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .swiper-slide {
    width: 119px !important;
    height: auto !important;
    flex-shrink: 0 !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .item {
    position: relative !important;
    width: 119px !important;
    height: auto !important;
    overflow: hidden !important;
    border-radius: 5px !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .item img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 5px !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .item::after {
    position: absolute !important;
    content: "" !important;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    border-radius: 5px !important;
}

/* Active thumbnail styling - using ::after pseudo-element for overlay effect */
.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .swiper-slide-thumb-active .item::after {
    border: 2px solid #e43131 !important;
}

/* Backup styling using data-force-active attribute */
.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .swiper-slide[data-force-active="true"] .item::after {
    border: 2px solid #e43131 !important;
}

/* Force override any conflicting styles */
.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs {
    max-width: none !important;
    min-width: auto !important;
    flex: none !important;
}

/* Product Variant Selector Styles */
.tf-product-info-variant-picker {
    margin-bottom: 24px;
}

.variant-picker-item {
    margin-bottom: 20px;
}

.variant-picker-label {
    margin-bottom: 12px;
}

.variant-picker-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Color Swatch Styles */
.style-image.color-btn .image img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    /* width: 100%;
    height: 100%;
    object-fit: cover; */
}

/* Selected state */
.style-image.color-btn.selected {
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Out of stock state */
.style-image.color-btn.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.style-image.color-btn.out-of-stock::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 70%;
    background-color: #e74c3c;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 2;
}

.style-image.color-btn.out-of-stock::after {
    content: 'Out of Stock';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.style-image.color-btn.out-of-stock:hover::after {
    opacity: 1;
}

/* Hidden state */
.style-image.color-btn.hidden {
    display: none !important;
}

/* Size Button Styles */
.style-text.size-btn {
    border: 1px solid #000000 !important;
    border-radius: 6px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    min-width: 50px;
    text-align: center;
}

.style-text.size-btn p {
    margin: 0;
    font-weight: 500;
    color: #333;
}

.style-text.size-btn:hover {
    border-color: #ccc;
}

/* Selected state */
.style-text.size-btn.selected {
    border-color: #000;
    background-color: #000;
    color: white;
}

.style-text.size-btn.selected p {
    color: white;
}

/* Out of stock state */
.style-text.size-btn.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
    background-color: #f5f5f5;
}

.style-text.size-btn.out-of-stock::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 80%;
    background-color: #e74c3c;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 2;
}

/* Hidden state */
.style-text.size-btn.hidden {
    display: none !important;
}

/* Quick Order Form Styles */
.tf-product-info-quick-order {
    background: #f8f9fa;
    border: 1px solid #e43131;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.tf-quick-order-product-info {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.selected-product-image {
    position: relative;
    width: 80px;
    height: auto !important;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.selected-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    background: #fff;
}

.selected-product-details h6 {
    color: #333;
    margin-bottom: 10px;
}

.variant-info {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.variant-label {
    min-width: 80px;
    color: #666;
    font-size: 14px;
}

.variant-value {
    color: #333;
    font-size: 14px;
}

.tf-quick-order-form .form-control {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.tf-quick-order-form .form-control:focus {
    border-color: #e43131;
    box-shadow: 0 0 0 0.2rem rgba(228, 49, 49, 0.25);
    outline: none;
}

.tf-quick-order-form .form-control::placeholder {
    color: #999;
    opacity: 1;
}

.tf-quick-order-form textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.tf-quick-order-buttons .btn-danger {
    background-color: #e43131;
    border-color: #e43131;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.tf-quick-order-buttons .btn-danger:hover {
    background-color: #d42c2c;
    border-color: #d42c2c;
    transform: translateY(-1px);
}

.tf-quick-order-buttons .btn-danger:focus {
    box-shadow: 0 0 0 0.2rem rgba(228, 49, 49, 0.25);
}

/* Sticky Summary Styles */
.tf-product-sticky-summary {
    position: sticky;
    top: 120px;
    z-index: 10;
}

.tf-sticky-summary-wrap {
    background: #ffffff;
    border: 1px solid #e9ecef;
    /* border-radius: 10px; */
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.tf-sticky-summary-wrap:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.tf-sticky-summary-image img {
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.tf-sticky-summary-image img:hover {
    transform: scale(1.05);
}

.tf-sticky-summary-info h6 {
    color: #333;
    font-size: 16px;
    line-height: 1.4;
}

.tf-sticky-summary-variants {
    background: #f8f9fa;
    padding: 6px 12px;
    /* border-radius: 6px; */
    display: inline-block;
}

.tf-sticky-summary-price .price-on-sale {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tf-sticky-summary-price .compare-at-price {
    font-size: 20px;
    color: #999;
}

.tf-sticky-summary-price .badges-on-sale {
    background-color: rgb(252, 87, 50);
    color: #fff;
    border-radius: 28px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    align-self: center;
    margin-top: -7px;
}

#btn-sticky-quick-order {
    background: linear-gradient(135deg, #e43131, #d42c2c);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    padding: 10px 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(228, 49, 49, 0.3);
}

#btn-sticky-quick-order:hover {
    background: linear-gradient(135deg, #d42c2c, #c12a2a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(228, 49, 49, 0.4);
}

#btn-sticky-quick-order:active {
    transform: translateY(0);
}

#btn-sticky-quick-order i {
    font-size: 18px;
}

/* Loading states */
.variant-picker-loading {
    opacity: 0.7;
    pointer-events: none;
}

.variant-picker-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Disable stagger animation on product thumbnails */
/* .tf-product-media-thumbs .stagger-item {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
} */

.variant-picker-item .variant-picker-values label.style-image .image img {
    height: auto !important;
}

.variant-picker-item .variant-picker-values label.style-image {
    /* border: 2px solid #e43131 !important; */
    padding: 0px !important;
    border-radius: 2px !important;
}

.style-image.color-btn.selected {
    border: 2px solid #e43131 !important;
}

.tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .item img {
    height: 100% !important;
}

/* Narrow container for product details */
.narrow-container {
    max-width: 1200px !important;
    margin: 0 auto;
}

.tf-product-info-title h5 {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
}


.tf-sticky-summary-info {
    min-width: 0 !important;
    overflow: hidden !important;
}

.tf-sticky-summary-info h6 {
    /* Don't force display here so Bootstrap's d-lg-none can hide on desktop */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: column;
    margin-top: -10px;
}

.line-bottom {
    border-bottom: 1px solid #f2f2f2;
    margin-top: -15px;
}


.tf-product-info-price .price-on-sale {
    font-size: 25px !important;
}

.tf-product-info-price .compare-at-price {
    font-size: 27px !important;
    font-weight: 300 !important;
    margin-bottom: 2px !important;

}

.flat-spacing-10 {
    padding-top: 0px !important;
}

h4 {
    font-size: 30px;
}

.flat-title .title {
    font-size: 35px;
}

/* Responsive Design */
@media (max-width: 991px) {
    .tf-product-sticky-summary {
        position: static;
        margin-top: 30px;
    }

    .tf-sticky-summary-wrap {
        padding: 20px;
    }
}

@media (max-width: 768px) {

    /* Tên sản phẩm */
    h4 {
        margin-top: 10px;
        font-size: 22px;
    }

    /* Có thể bạn cũng thích */
    .flat-title .title {
        font-size: 25px;
    }

    .tf-breadcrumb {
        display: none !important;
    }

    /*
    .tf-product-info-list {
        margin-top: -20px !important;
    } */

    .tf-product-info-title h5 {
        font-size: 19px !important;
    }

    .product-meta {
        margin-top: -15px;
    }


    .tf-product-info-price .price-on-sale {
        font-size: 21px !important;
    }

    .tf-product-info-price .compare-at-price {
        font-size: 22px !important;
        font-weight: 300 !important;
        margin-bottom: 2px !important;

    }

    /* Mobile 2 columns layout for delivery info */
    .tf-product-info-delivery-return .col-xl-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .tf-product-delivery {
        padding: 12px !important;
        margin-bottom: 15px !important;
    }

    .tf-product-delivery .icon {
        margin-bottom: 8px !important;
    }

    .tf-product-delivery p {
        font-size: 13px !important;
        line-height: 1.4 !important;
        margin-bottom: 0 !important;
    }

    .tf-product-delivery .fw-7 {
        font-size: 13px !important;
        font-weight: 600 !important;
    }

    /* End Mobile 2 columns layout for delivery info */

    .tf-product-sticky-summary {
        position: static;
        margin-top: 20px;
    }

    .style-text.size-btn {
        padding: 10px 12px;
        min-width: 45px;
    }

    .variant-picker-values {
        gap: 6px;
    }

    /* Mobile thumbnail fixes for horizontal layout */
    .tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .swiper-slide {
        width: 80px !important;
        height: auto !important;
        flex-shrink: 0 !important;
    }

    .tf-product-media-wrap.thumbs-bottom .tf-product-media-thumbs .item {
        width: 80px !important;
        height: auto !important;
    }

    /* Slick slider mobile adjustments for horizontal layout */
    .thumbnail-slider .slick-track {
        display: flex !important;
        flex-direction: column !important;
    }

    .thumbnail-slider .slick-slide {
        width: 100% !important;
        margin-bottom: 4px !important;
    }

    .thumbnail-slider .px-1 {
        width: 100% !important;
    }

    .selected-product-image {
        position: relative;
        width: 80px;
        aspect-ratio: 3 / 4;
        overflow: hidden;
        border-radius: 4px;
        border: 1px solid #e9ecef;
    }

    .tf-sticky-summary-wrap {
        padding: 16px;
    }

    .tf-sticky-summary-price .price-on-sale {
        font-size: 20px;
    }

    #btn-sticky-quick-order {
        font-size: 14px;
        padding: 10px 20px;
    }

    /* Reduce color swatch size on mobile */
    .style-image.color-btn {
        width: 60px !important;
        height: 60px !important;
        margin-right: 4px !important;
    }

    .style-image.color-btn .image {
        width: 100% !important;
        height: 100% !important;
    }

    .style-image.color-btn .image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* Adjust gap between swatches */
    .variant-picker-values {
        gap: 6px !important;
    }

    #goTop {
        display: none !important;
    }
}

/* Hide tooltips on color swatches */
.hover-tooltip .tooltip,
.style-image.color-btn .tooltip {
    display: none !important;
}

/* Style star icons in product meta to match review section */
.product-meta .list-star .icon {
    color: var(--yellow) !important;
    margin-right: 4px;
}

/* Buy Buttons Styles */
.tf-product-info-buy-button #btn-quick-order {
    background-color: #e43131 !important;
    border-color: #e43131 !important;
    color: white !important;
    min-height: 40px !important;
    padding: 14px 20px !important;
}

.tf-product-info-buy-button .btn-add-to-cart {
    min-height: 40px !important;
    padding: 14px 20px !important;
}

/* Product Video Styling */
.product-video-container {
    width: 300px !important;
    max-width: 100% !important;
    margin: 20px auto !important;
    aspect-ratio: 9 / 16 !important;
    overflow: hidden !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    background: #000 !important;
}

.product-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    background: #000 !important;
}

.product-video::-webkit-media-controls {
    display: none !important;
}

.product-video::-webkit-media-controls-panel {
    display: none !important;
}

/* Mobile responsive for product video */
@media (max-width: 768px) {
    .product-video-container {
        width: 100% !important;
        margin: 15px 0 !important;
    }
}