/**
 * Toolkit - Single Product Theme CSS
 * Blocksy theme customizations for single product page
 */

/* ===========================================
   BREADCRUMBS
   =========================================== */
[data-prefix="product"] .hero-section[data-type="type-1"] {
    margin-top: 30px;
}
@media screen and (max-width: 768px) {
    [data-prefix="product"] .hero-section[data-type="type-1"] {
        margin-top: 18px;
        margin-bottom: 18px;
    }
}

/* ===========================================
   PRODUCT BADGES
   =========================================== */
.product-page-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 10;
}

.product-page-badges .badge {
    display: flex;
    padding: 4px 8px;
    font-size: 0.77rem;
    font-weight: 600;
    border-radius: var(--tk-radius-sm);
    color: #fff;
    gap: 7px;
    background: rgba(0, 0, 0, 0.8);
}

.product-page-badges .badge svg,
.product-page-badges .badge .icon {
    width: 17px;
    height: 17px;
}

@media (max-width: 1024px) {
    .product-page-badges .badge {
        font-size: 0.7rem;
        gap: 5px;
    }
    
    .product-page-badges .badge svg,
    .product-page-badges .badge .icon {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .product-page-badges {
        top: 6px;
        left: 6px;
    }
    .product-page-badges .badge {
        font-size: 0.7rem;
        gap: 5px;
    }
}

/* ===========================================
   GALLERY
   =========================================== */
.ct-media-container {
    filter: brightness(.98);
}

@media (min-width: 1024px) {
    .single .woocommerce-product-gallery .ct-media-container:nth-child(3n+1) {
        grid-column: auto / span 2 !important;
    }
}

@media (max-width: 999.98px) {
    div.woocommerce-product-gallery {
        margin-bottom: 2em;
    }
}

/* ===========================================
   WPGENS POINTS MOBILE
   =========================================== */
.wpgens-product-single-earning-notice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--theme-palette-color-6);
    border-radius: 4px;
    padding: 8px;
    margin: 10px 0;
    font-size: 14px;
}

.wpgens-product-single-earning-notice svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .wpgens-product-single-earning-notice {
        font-size: 13px;
    }
}


/* ===========================================
   VARIATIONS & SWATCHES
   =========================================== */
table.variations .reset_variations {
    display: none !important;
}

form.variations_form table.variations label {
    font-size: 12px;
}

.single-product .ct-variation-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.woocommerce-variation-price {
    padding-bottom: 10px;
}

@media (max-width: 1024px) {
    .variations_form.cart [data-swatches-type="image"] {
        --swatch-size: 70px;
    }
}

@media (max-width: 768px) {
    .variations_form.cart [data-swatches-type="image"] {
        --swatch-size: 62px;
    }
}

@media (max-width: 480px) {
    .single-product .ct-variation-swatches {
        gap: 8px;
    }
}

/* ===========================================
   STOCK INDICATOR
   =========================================== */
.woocommerce-variation-availability p.stock {
    font-size: 12px;
}

p.stock {
    position: relative !important;
    padding-left: 22px !important;
    display: inline-block;
}

p.stock::before,
p.stock::after {
    content: '' !important;
    position: absolute;
    left: 0;
    top: calc(50% - 5px);
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

p.stock::before {
    z-index: 2;
}

p.stock::after {
    z-index: 1;
}

/* In stock */
.woocommerce-variation-availability p.stock.in-stock,
.stock.in-stock a,
.stock.shipping-later a {
    color: var(--tk-stock-green) !important;
}

p.stock.in-stock::before,
p.stock.shipping-later::before {
    background: var(--tk-stock-green);
}

p.stock.in-stock::after,
p.stock.shipping-later::after {
    background: var(--tk-stock-green);
    animation: tk-pulse-ring 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Out of stock */
.woocommerce-variation-availability p.stock.out-of-stock {
    color: var(--tk-stock-red);
}

p.stock.out-of-stock::before {
    background: var(--tk-stock-red);
}

p.stock.out-of-stock::after {
    background: var(--tk-stock-red);
    animation: tk-pulse-ring 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes tk-pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

p.stock:hover::after {
    will-change: transform, opacity;
}

/* ===========================================
   SCARCITY & STOCK DISPLAY
   =========================================== */
.ct-product-stock-scarcity,
[class*=ct-shipping-progress] {
    font-size: 15px;
}

.ct-stock-quantity {
    color: #ff0000;
}

.ct-progress-bar {
    display: none;
}

body.single-product .ct-message {
    display: inline-block;
    background-color: var(--tk-color-bg-light);
    border-radius: var(--tk-radius-lg);
    padding: 14px;
    font-weight: 500;
    line-height: 1;
    font-size: 15px;
}

@media (max-width: 768px) {
    body.single-product .ct-message {
        padding: 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body.single-product .ct-message {
        border-radius: var(--tk-radius-lg);
    }
}

/* ===========================================
   CART ACTIONS
   =========================================== */
.ct-cart-actions .quantity,
.ct-cart-actions .added_to_cart {
    display: none !important;
}

.ct-cart-actions button {
    box-shadow: 2px 5px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 689.98px) {
    .ct-floating-bar-actions :is(.product_type_variable.button, .single_add_to_cart_button:not(.loading))::after {
        content: "";
    }
    .ct-floating-bar-actions :is(.added_to_cart, .single_add_to_cart_button, .product_type_variable.button) {
        min-width: 140px;
        max-width: 140px;
        font-size: inherit !important;
        padding: 5px 10px;
    }
    .ct-cart-actions {
        --theme-button-min-height: 57px;
    }
}

/* ===========================================
   PRODUCT META
   =========================================== */
.summary .product_meta > span {
    letter-spacing: unset !important;
    display: flex !important;
    gap: 10px;
    padding: 1px;
    font-size: 11px !important;
}

/* ===========================================
   STICKY ADD TO CART
   =========================================== */
body .ct-floating-bar :is(.added_to_cart, .single_add_to_cart_button, .product_type_variable.button) {
    background-color: #181818;
    font-size: 17px;
    color: #fff;
}

/* Hover state */
body .ct-floating-bar :is(.added_to_cart, .single_add_to_cart_button, .product_type_variable.button):hover {
    background-color: var(--theme-palette-color-4);
}

/* UNIQUEMENT PRODUITS VARIABLES sur mobile */
@media (max-width: 689.98px) {
    
    /* MASQUER image, titre, prix pour produits VARIABLES uniquement */
    body .ct-floating-bar:has(.product_type_variable.button) .ct-media-container,
    body .ct-floating-bar:has(.product_type_variable.button) .ct-floating-bar-item-title,
    body .ct-floating-bar:has(.product_type_variable.button) .ct-floating-bar-content {
        display: none;
    }
    
    /* Container en flex pour produits variables */
    body .ct-floating-bar:has(.product_type_variable.button) .ct-container {
        display: flex;
        grid-template-columns: unset;
        justify-content: stretch ;
        padding: 10px 15px;
        gap: 0;
    }
    
    body .ct-floating-bar:has(.product_type_variable.button) section {
        width: 100%;
        flex: 1;
    }
    
    body .ct-floating-bar:has(.product_type_variable.button) .ct-floating-bar-actions {
        flex: 1;
        display: flex;
    }
    
    body .ct-floating-bar:has(.product_type_variable.button) form.cart {
        flex: 1;
        display: flex;
    }
    
    /* Bouton pleine largeur avec texte 18px pour produits variables */
    body .ct-floating-bar:has(.product_type_variable.button) .product_type_variable.button {
        width: 100%;
        max-width: 100%;
        min-width: auto;
        font-size: 18px!important;
        flex: 1;
        padding: 14px 20px;
    }

    /* Supprimer l'icône + et afficher le texte pour produits variables */
    body .ct-floating-bar:has(.product_type_variable.button) .product_type_variable.button::after {
        content: "";
        display: none;
    }
    
    /* PRODUITS SIMPLES : Bouton avec espaces et texte 16px */
    body .ct-floating-bar:has(.single_add_to_cart_button) .single_add_to_cart_button {
        font-size: 0 !important;
        min-width: 120px;
        max-width: none;
        padding: 12px 24px;
        margin: 0 15px;
    }
    
    body .ct-floating-bar:has(.single_add_to_cart_button) .single_add_to_cart_button::after {
        content: "カートに入れる";
        font-size: 16px;
        font-family: inherit;
        margin: 0;
    }
}

