/* JMPGSB - Unified Stylesheet */

/* ==========================================================================
   Product Tabs
   ========================================================================== */
.jmpgsb-product-tabs .woocommerce-tabs ul.tabs { 
    display: flex !important; 
    list-style: none !important; 
    margin: 0 0 20px 0 !important; 
    padding: 0 !important; 
    border-bottom: 1px solid #eee; 
}
.jmpgsb-product-tabs .woocommerce-tabs ul.tabs li { 
    margin: 0 20px 0 0 !important; 
    padding: 10px 0 !important; 
    position: relative; 
    background: none !important; 
    border: none !important; 
}
.jmpgsb-product-tabs .woocommerce-tabs ul.tabs li.active { 
    border-bottom: 2px solid #000; 
}
.jmpgsb-product-tabs .woocommerce-tabs ul.tabs li a { 
    text-decoration: none !important; 
    font-weight: 600; 
}

/* ==========================================================================
   Product Gallery & Zoom Button
   ========================================================================== */
.jmpgsb-product-gallery { 
    position: relative; 
    width: 100%; 
}

/* Selo de Promoção (Sale Label) */
.jmpgsb-product-gallery span.onsale { 
    position: absolute !important; 
    top: 15px !important; 
    left: 15px !important; 
    z-index: 98 !important; 
}

/* Botão da Lupa Nativo */
.jmpgsb-product-gallery .woocommerce-product-gallery__trigger { 
    position: absolute !important; 
    top: 15px !important; 
    right: 15px !important; 
    z-index: 99 !important; 
    border-radius: 50%; 
    background: #fff;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    overflow: hidden !important;
}

/* Oculta o Emoji/Imagem Padrão do WooCommerce */
.jmpgsb-product-gallery .woocommerce-product-gallery__trigger img,
.jmpgsb-product-gallery .woocommerce-product-gallery__trigger .emoji,
.jmpgsb-product-gallery .woocommerce-product-gallery__trigger::before {
    display: none !important;
    content: none !important;
}

/* Exibe e Centraliza o Ícone Customizado do Elementor */
.jmpgsb-product-gallery .jmpgsb-custom-zoom-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

.jmpgsb-product-gallery .jmpgsb-custom-zoom-icon i {
    font-size: 16px;
    line-height: 1 !important;
}

.jmpgsb-product-gallery .jmpgsb-custom-zoom-icon svg {
    width: 1em !important;
    height: auto !important;
    fill: currentColor !important;
}

/* Gallery Placeholder (Editor) */
.jmpgsb-placeholder-main { 
    background: #f5f5f5; 
    height: 450px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 0; 
    font-weight: bold; 
    color: #ccc; 
    border: 1px solid #eee; 
}

/* Related Products Mock (Editor) */
.jmpgsb-mock-grid { 
    display: grid; 
    gap: 20px; 
}

/* ==========================================================================
   Product Variations Fix (Correção do Selector Dropdown)
   ========================================================================== */

/* Mantém a tabela com layout de bloco limpo sem estragar os elementos internos */
.jmpgsb-variations-wrapper table.variations {
    width: 100% !important;
    border: none !important;
    background: transparent !important;
    margin-bottom: 15px !important;
    border-collapse: collapse !important;
}

.jmpgsb-variations-wrapper table.variations tbody,
.jmpgsb-variations-wrapper table.variations tr {
    display: block !important;
    width: 100% !important;
    margin-bottom: 15px !important;
}

.jmpgsb-variations-wrapper table.variations th.label {
    display: block !important;
    width: 100% !important;
    padding: 0 0 8px 0 !important;
    text-align: left !important;
    background: transparent !important;
}

.jmpgsb-variations-wrapper table.variations th.label label {
    font-size: 12px !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    display: block !important;
}

.jmpgsb-variations-wrapper table.variations td.value {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    background: transparent !important;
    position: relative !important;
}

/* Força o elemento SELECT a ser um menu Dropdown clicável */
.jmpgsb-variations-wrapper table.variations select {
    display: block !important;
    width: 100% !important;
    height: 48px !important;
    line-height: 48px !important;
    background-color: #2b2b2b !important;
    color: #ffffff !important;
    border: 1px solid #444444 !important;
    border-radius: 6px !important;
    padding: 0 15px !important;
    font-size: 14px !important;
    appearance: select !important;
    -webkit-appearance: menulist !important; /* Restaura a seta e o comportamento nativo de dropdown */
    -moz-appearance: menulist !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

/* Estilo das Opções dentro do Select */
.jmpgsb-variations-wrapper table.variations select option {
    background-color: #2b2b2b !important;
    color: #ffffff !important;
    padding: 10px !important;
}

/* Botão Limpar Seleção */
.jmpgsb-variations-wrapper .reset_variations {
    display: inline-block !important;
    margin-top: 8px !important;
    color: #ff4757 !important;
    font-size: 12px !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   Add to Cart & Variation Alignment Fix (Comprar + Quantidade)
   ========================================================================== */
.jmpgsb-add-to-cart form.cart,
.jmpgsb-add-to-cart .woocommerce-variation-add-to-cart,
.single_variation_wrap .woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    gap: 15px !important;
    margin-top: 15px !important;
    width: 100% !important;
}

/* Garante a visibilidade do bloco de variação no WooCommerce */
.jmpgsb-variations-wrapper .single_variation_wrap,
.jmpgsb-add-to-cart .single_variation_wrap {
    width: 100% !important;
    display: block !important;
}

/* Exibição da Quantidade */
.jmpgsb-add-to-cart .quantity,
.single_variation_wrap .quantity {
    display: inline-block !important;
}

.jmpgsb-add-to-cart .quantity input.qty,
.single_variation_wrap .quantity input.qty {
    text-align: center;
    background-color: #2b2b2b !important;
    color: #ffffff !important;
    border: 1px solid #444444 !important;
    box-sizing: border-box !important;
}

.jmpgsb-add-to-cart button.button,
.single_variation_wrap button.button,
.jmpgsb-variations-wrapper button.button {
    height: 48px !important;
    font-weight: bold;
    flex-grow: 1;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Esconde o campo de quantidade se a opção "Mostrar Quantidade" estiver desativada */
.jmpgsb-add-to-cart.jmpgsb-hide-quantity .quantity {
    display: none !important;
}

/* Ocultar seletores duplicados se os dois widgets estiverem colocados na mesma página */
.jmpgsb-add-to-cart form.variations_form .variations {
    display: none !important;
}

/* ==========================================================================
   Cart Table & Totals
   ========================================================================== */
.jmpgsb-cart-table-container .shop_table thead th.product-remove { font-size: 0 !important; }
.jmpgsb-cart-table-container .shop_table thead th.product-remove::before { content: "Remover"; font-size: initial; }
.jmpgsb-cart-table-container .shop_table, .jmpgsb-cart-table-container .shop_table td { text-align: center; border: none !important; background: transparent !important; }
.jmpgsb-cart-table-container .product-remove a.remove { display: inline-flex !important; align-items: center; justify-content: center; width: 100%; text-decoration: none !important; }

.jmpgsb-totals-container { background: #fff; padding: 20px; border-radius: 8px; }
.jmpgsb-total-row { display: flex; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid #eee; align-items: center; }
.jmpgsb-totals-container .button { width: 100%; padding: 12px; font-weight: 600; cursor: pointer; }
.jmpgsb-coupon-form { display: flex; gap: 8px; margin-bottom: 10px; }
.jmpgsb-coupon-form input { flex: 1; height: 45px; padding: 0 15px; border: 1px solid #ddd; }

.jmpgsb-cart-totals-widget-button {
    margin-top: 5px;
    opacity: 0.85;
}

/* ==========================================================================
   Filters, Search & Archive Grid
   ========================================================================== */
.jmpgsb-filters-container { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; }
.jmpgsb-search-form { position: relative; display: flex; align-items: center; }
.jmpgsb-common-field { height: 45px; padding: 10px 15px; border: 1px solid #ddd; border-radius: 5px; }
.jmpgsb-search-submit {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1;
    z-index: 2;
    color: inherit;
}
.jmpgsb-search-submit svg {
    width: 1em;
    height: auto;
    fill: currentColor;
}

.jmpgsb-products-grid { display: grid; gap: 20px; }
.jmpgsb-pagination-wrapper { margin-top: 30px; display: flex; justify-content: center; }
.jmpgsb-pagination-wrapper ul { display: flex; list-style: none; gap: 10px; }

/* ==========================================================================
   Checkout Billing & Shipping Fields
   ========================================================================== */
.jmpgsb-checkout-billing-wrapper .woocommerce-billing-fields__field-wrapper,
.jmpgsb-checkout-billing-wrapper .woocommerce-shipping-fields__field-wrapper,
.jmpgsb-checkout-billing-wrapper .woocommerce-additional-fields__field-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    align-items: flex-start !important;
}

.jmpgsb-checkout-billing-wrapper .form-row {
    display: block !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.jmpgsb-checkout-billing-wrapper .form-row label {
    display: inline-block !important;
    position: relative !important;
    margin-bottom: 8px;
}

.jmpgsb-checkout-billing-wrapper .input-text, 
.jmpgsb-checkout-billing-wrapper textarea, 
.jmpgsb-checkout-billing-wrapper .select2-container .select2-selection--single {
    width: 100% !important; 
    height: 50px !important; 
    padding: 0 15px !important;
    border: 1px solid #e2e2e2 !important; 
    background-color: #fcfcfc !important;
    border-radius: 5px !important; 
    box-sizing: border-box !important;
    display: flex !important; 
    align-items: center !important;
}

@media (min-width: 768px) {
    .jmpgsb-checkout-billing-wrapper .form-row.form-row-first { width: 48% !important; float: left !important; margin-right: 4% !important; }
    .jmpgsb-checkout-billing-wrapper .form-row.form-row-last { width: 48% !important; float: left !important; clear: none !important; }
}

/* Product Categories widget */
.jmpgsb-stock-status { display: block; }
.jmpgsb-stock-notify { margin-top: 10px; }
.jmpgsb-stock-notify summary,
.jmpgsb-stock-notify button { border: 1px solid transparent; }
.jmpgsb-stock-notify summary { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; list-style: none; }
.jmpgsb-stock-notify summary::-webkit-details-marker { display: none; }
.jmpgsb-stock-notify form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.jmpgsb-stock-notify input[type="email"] { min-width: 0; flex: 1 1 180px; }
.jmpgsb-stock-notice-success { margin-top: 8px; }
.jmpgsb-product-countdown { display: block; }
.jmpgsb-countdown-title { margin-bottom: 12px; }
.jmpgsb-countdown-items { display: flex; flex-wrap: wrap; gap: 12px; }
.jmpgsb-countdown-item { display: flex; min-width: 64px; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; border: 1px solid #ddd; padding: 10px; text-align: center; }
.jmpgsb-countdown-value { display: block; line-height: 1.1; }
.jmpgsb-countdown-label { display: block; margin-top: 4px; font-size: .75em; line-height: 1.2; }
.jmpgsb-countdown-expired[hidden],
.jmpgsb-countdown-items[hidden] { display: none !important; }

.jmpgsb-category-node { display: flex; flex: 0 0 auto; flex-direction: column; min-width: 0; box-sizing: border-box; }
.jmpgsb-category-children { display: flex; flex: 0 0 auto; flex-direction: column; align-items: stretch; gap: 10px; width: calc(100% - 20px); box-sizing: border-box; margin: 10px 0 0 20px; padding-left: 14px; border-left: 1px solid rgba(127, 127, 127, 0.35); }
.jmpgsb-categories-container.is-hierarchical:not(.is-carousel) { flex-direction: column !important; align-items: stretch; }
.jmpgsb-categories-container.is-hierarchical:not(.is-carousel) > .jmpgsb-category-node { width: 100%; flex: 0 0 auto; }
.jmpgsb-categories-carousel { display: flex; flex: 0 0 100%; align-items: center; gap: 8px; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.elementor-widget-jmpgsb_product_categories:has(.jmpgsb-categories-carousel) { width: 100% !important; max-width: 100% !important; flex: 0 0 100%; }
.jmpgsb-categories-container.is-carousel { flex: 1 1 0%; width: 0; flex-wrap: nowrap !important; overflow: hidden; scroll-behavior: smooth; min-width: 0; box-sizing: border-box; }
.jmpgsb-categories-container.is-carousel > .jmpgsb-category-node { flex: 0 0 calc(100% / var(--jmpgsb-carousel-items, 4)); }
.jmpgsb-categories-carousel-arrow { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; padding: 8px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; line-height: 1; }
.jmpgsb-categories-carousel-arrow i { display: block; font-size: inherit; }
