/* =========================================================================
   LD Product Table — Stylesheet
   this.functional Lda. | v1.9.0
   ========================================================================= */

/* Wrapper */
.ld-product-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table */
.ld-product-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.4;
    background: #fff;
}

/* -------------------------------------------------------------------------
   Head — !important to override Goodlayers
   ------------------------------------------------------------------------- */
.ld-product-table thead tr,
.ld-product-table thead tr:hover {
    background: #17287c !important;
    color: #fff !important;
}

.ld-product-table thead th,
.ld-product-table thead th a,
.ld-product-table thead th span {
    padding: 12px 14px;
    text-align: center !important;
    font-weight: 600 !important;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: none !important;
    color: #fff !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Body rows */
.ld-product-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.15s ease;
}

.ld-product-table tbody tr:last-child { border-bottom: none; }
.ld-product-table tbody tr:hover { background: #f5f8ff; }

.ld-product-table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    color: #333;
    text-align: center;
}

/* Left-align text columns */
.ld-product-table .ld-pt-col-sku,
.ld-product-table .ld-pt-col-name,
.ld-product-table .ld-pt-col-compressor { text-align: left; }

/* Column widths */
.ld-product-table .ld-pt-col-sku          { white-space: nowrap; width: 110px; font-family: monospace; font-size: 0.8rem; color: #666; }
.ld-product-table .ld-pt-col-name         { min-width: 140px; }
.ld-product-table .ld-pt-col-aplicacao    { width: 90px; }
.ld-product-table .ld-pt-col-compressor   { min-width: 130px; }
.ld-product-table .ld-pt-col-deposito-liquido { width: 110px; }
.ld-product-table .ld-pt-col-a-mm,
.ld-product-table .ld-pt-col-b-mm,
.ld-product-table .ld-pt-col-c-mm        { width: 70px; }
.ld-product-table .ld-pt-col-quantity    { width: 120px; }
.ld-product-table .ld-pt-col-add-to-cart { width: 170px; text-align: right; }

/* Product name link */
.ld-pt-name { color: #1a1a2e; text-decoration: none; font-weight: 500; }
.ld-pt-name:hover { color: #17287c; text-decoration: underline; }

/* -------------------------------------------------------------------------
   Quantity control
   ------------------------------------------------------------------------- */
.ld-pt-qty-wrap {
    display: inline-flex;
    align-items: center;
}

.ld-pt-qty-btn {
    width: 28px;
    height: 32px;
    border: 1px solid #d0d0d0;
    background: #f4f4f4;
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.ld-pt-qty-btn:hover { background: #e0e0e0; }
.ld-pt-qty-minus { border-radius: 4px 0 0 4px; border-right: none; }
.ld-pt-qty-plus  { border-radius: 0 4px 4px 0; border-left: none; }

.ld-pt-qty-input {
    width: 44px;
    height: 32px;
    border: 1px solid #d0d0d0;
    text-align: center;
    font-size: 0.875rem;
    padding: 0 4px;
    -moz-appearance: textfield;
    border-radius: 0;
    box-shadow: none;
}

.ld-pt-qty-input::-webkit-outer-spin-button,
.ld-pt-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* -------------------------------------------------------------------------
   Add to cart button — override Goodlayers
   ------------------------------------------------------------------------- */
.ld-product-table-wrap .ld-pt-atc,
.ld-product-table-wrap .ld-pt-atc:visited,
.ld-product-table-wrap button.ld-pt-atc {
    background-color: #17287c !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
    transition: background-color 0.2s !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    line-height: 1 !important;
}

.ld-product-table-wrap .ld-pt-atc:hover,
.ld-product-table-wrap button.ld-pt-atc:hover {
    background-color: #0f1d5c !important;
    color: #fff !important;
}

.ld-product-table-wrap .ld-pt-atc:disabled { opacity: 0.6 !important; cursor: not-allowed !important; }
.ld-product-table-wrap .ld-pt-atc.ld-pt-atc--added { background-color: #2e7d32 !important; }

/* -------------------------------------------------------------------------
   Notice
   ------------------------------------------------------------------------- */
.ld-pt-notice {
    margin-top: 10px;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 0.875rem;
    display: none;
}

.ld-pt-notice--success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; display: block; }
.ld-pt-notice--error   { background: #fdecea; color: #c62828; border-left: 4px solid #c62828; display: block; }
.ld-pt-notice a { color: inherit; font-weight: 600; }
.ld-pt-empty { color: #666; font-style: italic; padding: 20px 0; }

/* -------------------------------------------------------------------------
   Cart icon — above table, right-aligned, same style as ATC button
   ------------------------------------------------------------------------- */
.ld-cart-icon-wrap {
    display: none;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ld-cart-icon-wrap.has-items { display: flex; }

.ld-cart-icon-btn,
.ld-cart-icon-btn:visited {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background-color: #17287c !important;
    color: #fff !important;
    text-decoration: none !important;
    padding: 8px 18px !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    transition: background-color 0.2s !important;
    position: relative !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.ld-cart-icon-btn:hover { background-color: #0f1d5c !important; color: #fff !important; }
.ld-cart-icon-btn svg { flex-shrink: 0; }

.ld-cart-icon-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e53935;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* -------------------------------------------------------------------------
   WooCommerce Blocks checkout — hide prices / totals
   ------------------------------------------------------------------------- */

/* Item prices in order summary */
.wc-block-components-order-summary-item__individual-prices,
.wc-block-components-order-summary-item__full-price,
.wc-block-components-order-summary-item__price,
.wc-block-components-order-summary-item__regular-price,
.wc-block-components-order-summary-item__total-price {
    display: none !important;
}

/* Subtotal / Total rows */
.wc-block-components-totals-item.wc-block-components-totals-subtotal,
.wc-block-components-totals-item.wc-block-components-totals-taxes,
.wp-block-woocommerce-checkout-order-summary-subtotal-block,
.wp-block-woocommerce-checkout-order-summary-taxes-block,
.wc-block-components-totals-coupon {
    display: none !important;
}

/* Total footer row — hide value, keep label */
.wc-block-components-totals-footer-item .wc-block-formatted-money-amount,
.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    display: none !important;
}

/* Classic shortcode checkout */
.woocommerce-checkout .cart-subtotal,
.woocommerce-checkout .order-total,
.woocommerce-checkout .woocommerce-Price-amount.amount {
    display: none !important;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .ld-product-table thead { display: none; }

    .ld-product-table tbody tr {
        display: block;
        padding: 12px 0;
        border-bottom: 2px solid #e8e8e8;
    }

    .ld-product-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 12px;
        font-size: 0.85rem;
        text-align: left;
    }

    .ld-product-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        flex-shrink: 0;
        margin-right: 10px;
    }

    .ld-cart-icon-wrap { margin-bottom: 8px; }
}

/* -------------------------------------------------------------------------
   Cart icon — animação de entrada
   ------------------------------------------------------------------------- */
@keyframes ld-cart-appear {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ld-cart-icon-wrap.is-appearing {
    animation: ld-cart-appear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* =========================================================================
   Thank you page — order confirmation
   ========================================================================= */

/* "Número de encomenda" → esconder label, manter valor */
.woocommerce-order .woocommerce-order-overview__order.order strong::before {
    content: "Número do pedido: ";
}

/* Ocultar coluna Total da tabela de produtos */
.woocommerce-order-details .woocommerce-table--order-details thead th:last-child,
.woocommerce-order-details .woocommerce-table--order-details tbody td:last-child,
.woocommerce-order-details .woocommerce-table--order-details tfoot {
    display: none !important;
}

/* Ocultar "Total:" no cabeçalho da order overview */
.woocommerce-order .woocommerce-order-overview__total.total {
    display: none !important;
}

/* Ocultar subtotal e total no rodapé da tabela */
.woocommerce-order-details .woocommerce-table--order-details tfoot tr {
    display: none !important;
}

/* Ocultar "Total" no overview topo */
.woocommerce-order-overview li.total {
    display: none !important;
}

/* Remover coluna "Total" do header */
.wc-block-order-confirmation-totals-wrapper,
.wc-block-order-confirmation-summary-list-item--total {
    display: none !important;
}

/* -------------------------------------------------------------------------
   Thank you page — strings handled via JS (see enqueue_blocks_overrides)
   ------------------------------------------------------------------------- */

/* Detalhes da encomenda → Detalhes do pedido */
.woocommerce-order-details__title {
    visibility: hidden !important;
    position: relative !important;
}
.woocommerce-order-details__title::after {
    content: "Detalhes do pedido" !important;
    visibility: visible !important;
    position: absolute !important;
    left: 0 !important;
}

/* -------------------------------------------------------------------------
   Thank you page — remover ::before injectado por CSS anterior
   ------------------------------------------------------------------------- */
.woocommerce-order .woocommerce-order-overview__order.order strong::before {
    content: none !important;
    display: none !important;
}

/* -------------------------------------------------------------------------
   Coluna imagem
   ------------------------------------------------------------------------- */
.ld-product-table .ld-pt-col-image {
    width: 70px;
    text-align: center !important;
    padding: 6px 10px !important;
}

.ld-pt-img-link {
    display: inline-block;
    line-height: 0;
    cursor: zoom-in;
}

.ld-pt-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #e8e8e8;
    background: #fafafa;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ld-pt-img-link:hover .ld-pt-img {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Coluna Modelo a bold e sem quebra de linha */
.ld-product-table .ld-pt-col-name a,
.ld-product-table .ld-pt-col-name .ld-pt-name {
    font-weight: 700 !important;
    white-space: nowrap !important;
}

/* =========================================================================
   Lightbox nativo
   ========================================================================= */
#ld-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#ld-lightbox.is-open {
    display: flex;
}

#ld-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    animation: ld-lb-fade-in 0.2s ease;
}

#ld-lightbox-inner {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    animation: ld-lb-zoom-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ld-lightbox-img {
    display: block;
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

#ld-lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    color: #333;
    border: none;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: background 0.15s;
    z-index: 2;
}

#ld-lightbox-close:hover {
    background: #f0f0f0;
}

body.ld-lightbox-open {
    overflow: hidden;
}

@keyframes ld-lb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ld-lb-zoom-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* =========================================================================
   Checkout clássico — ocultar totais + cores do tema
   ========================================================================= */

/* Ocultar coluna Subtotal (header + células) — selectores exactos do HTML */
#order_review table.woocommerce-checkout-review-order-table thead th.product-total,
#order_review table.woocommerce-checkout-review-order-table tbody td.product-total {
    display: none !important;
}

/* Ocultar linhas de totais no tfoot — selectores exactos do HTML */
#order_review table.woocommerce-checkout-review-order-table tfoot tr.cart-subtotal,
#order_review table.woocommerce-checkout-review-order-table tfoot tr.order-total,
#order_review table.woocommerce-checkout-review-order-table tfoot tr.tax-rate {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    line-height: 0 !important;
    overflow: hidden !important;
}

/* Forçar campo Nome da Empresa visível — o tema pode estar a escondê-lo */
#billing_company_field {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

/* Cores do checkout geridas pelo tema — sem overrides aqui */

/* =========================================================================
   Category archive — hero image, subcategories, brands
   ========================================================================= */

/* Category featured image */
.ld-cat-hero {
    text-align: center;
    margin-bottom: 36px;
}

.ld-cat-hero-img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 6px;
}

/* Subcategory section */
.ld-subcat-section {
    margin-bottom: 48px;
}

.ld-subcat-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #17287c;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #17287c;
}

/* Brand section */
.ld-brand-section {
    margin-bottom: 36px;
}

.ld-brand-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.ld-brand-logo {
    /*max-height: 60px;*/
    /*max-width: 180px;*/
    object-fit: contain;
}

.ld-brand-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* =========================================================================
   Fixes v3.0.3
   ========================================================================= */

/* 1. Category hero image — centred */
.ld-cat-hero {
    text-align: center;
    margin-bottom: 36px;
}

/* 2. Remove horizontal scroll — let table compress naturally */
.ld-product-table-wrap {
    overflow-x: visible;
}

.ld-product-table {
    table-layout: auto;
    min-width: 0;
}

/* Remove fixed widths that force overflow */
.ld-product-table .ld-pt-col-sku          { width: auto; white-space: nowrap; }
.ld-product-table .ld-pt-col-name         { min-width: 0; }
.ld-product-table .ld-pt-col-compressor   { min-width: 0; }
.ld-product-table .ld-pt-col-a-mm,
.ld-product-table .ld-pt-col-b-mm,
.ld-product-table .ld-pt-col-c-mm        { width: auto; }
.ld-product-table .ld-pt-col-quantity    { width: auto; }
.ld-product-table .ld-pt-col-add-to-cart { width: auto; }

/* 3. Brand header with logo + cart button side by side */
.ld-brand-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.ld-brand-header-actions {
    display: flex;
    align-items: center;
}

/* =========================================================================
   Fixes v3.0.4
   ========================================================================= */

/* 1. Category hero image — force centre with block display */
.ld-cat-hero {
    text-align: center !important;
    margin-bottom: 40px !important;
    display: block !important;
}

.ld-cat-hero-img {
    display: block !important;
    margin: 0 auto !important;
    max-width: 100% !important;
    max-height: 320px !important;
    object-fit: contain !important;
}

/* 2. More breathing room between subcategory sections */
.ld-subcat-section {
    margin-bottom: 60px !important;
    padding-top: 12px;
}

.ld-subcat-title {
    margin-bottom: 28px !important;
}

/* Spacing between brand sections within a subcategory */
.ld-brand-section {
    margin-bottom: 44px !important;
}

.ld-brand-section:last-child {
    margin-bottom: 0 !important;
}


/* =========================================================================
   Fix v3.1.1 — cart button after table, aligned right
   ========================================================================= */

.ld-pt-caption {
    text-align: right;
    caption-side: top;
    padding-bottom: 10px;
}

/* =========================================================================
   Filter bar
   ========================================================================= */
.ld-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
    padding: 16px 20px;
    background: #f5f6f8;
    border-radius: 6px;
}

.ld-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ld-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #17287c;
    white-space: nowrap;
}

.ld-filter-select {
    padding: 6px 32px 6px 12px;
    border: 1px solid #d0d4e0;
    border-radius: 4px;
    background: #fff;
    font-size: 0.875rem;
    color: #333;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2317287c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 160px;
}

.ld-filter-select:focus {
    outline: none;
    border-color: #17287c;
}
