/* Container Principal - Modular */
.alce-frete-widget,
#alce-frete-cart-widget,
#alce-frete-simulator {
    font-family: inherit;
    max-width: 100%;
    margin-top: 15px;
}

/* Label - Modular */
.alce-frete-widget label,
#alce-frete-cart-widget label,
#alce-frete-simulator label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px !important;
    margin-right: 10px;
}

/* Header: Input + Botão - Modular */
.alce-frete-header {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: stretch;
    flex: 1;
}

.alce-frete-header input[type="text"] {
    flex: 1;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    height: 35px;
    font-size: 15px;
    margin: 0;
    min-width: 120px;
}

.alce-frete-header button {
    background-color: #0059CD !important;
    color: white !important;
    border: 1px solid #0059CD !important;
    padding: 10px 40px 10px 40px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    cursor: pointer;
    height: 35px !important;
    text-transform: none !important;
    font-size: 15px !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.alce-frete-header button:hover {
    background-color: #0059CD !important;
}

/* Layout em linha: label + input + botão */
#alce-frete-title {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    width: 100% !important;
}

#alce-frete-title .alce-frete-debug-badge {
    margin-left: auto !important;
    padding: 2px 6px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
    color: #fff !important;
    line-height: 1 !important;
    display: inline-block !important;
}

.alce-frete-debug-badge.api {
    background: #2c7be5 !important;
}

.alce-frete-debug-badge.cache {
    background: #8898aa !important;
}

#alce-frete-title>label {
    margin-bottom: 0 !important;
    width: auto !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

.alce-frete-header {
    margin-bottom: 0 !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 1 auto !important;
}

/* Forçar quebra de linha para o resto do conteúdo (lista, loading, etc) */
#alce-frete-cart-loading,
#alce-frete-cart-list,
#alce-frete-cart-summary,
#alce-frete-cart-debug,
#alce-frete-loading,
#alce-frete-results,
.alce-frete-location-header,
.alce-frete-legend {
    width: 100% !important;
    /* margin-top: 10px !important; */
}

#alce-frete-cart-summary {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 12px !important;
}

#alce-frete-cart-summary .alce-frete-label {
    font-weight: 600 !important;
}

#alce-frete-cart-summary .woocommerce-Price-amount.amount {
    font-weight: 600 !important;
    text-align: right !important;
}

/* Checkout: ocultar CEP e botão calcular quando houver billing_postcode */
.woocommerce-checkout #alce-frete-cart-calc,
.woocommerce-checkout #alce-frete-cart-zip,
.woocommerce-checkout .alce-frete-header {
    display: none !important;
}

.woocommerce-checkout #alce-frete-title>label {
    display: none !important;
}


.woocommerce-cart .cart_totals .woocommerce-shipping-destination {
    margin-bottom: 13px !important;
}


/* Lista de Serviços - Modular */
.alce-frete-list,
#alce-frete-cart-list,
#alce-frete-simulator-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#alce-frete-cart-widget ul#alce-frete-cart-list {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#alce-frete-cart-widget ul#alce-frete-cart-list li {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 6px !important;
}

/* Card de Serviço - Modular */
.alce-frete-card {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    background: #fff !important;
    padding: 12px 14px !important;
    margin-bottom: 8px !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    position: relative !important;
    transition: background 0.2s !important;
    border-left: 1px solid #e5e5e5 !important;
    min-height: auto !important;
    box-shadow: none !important;
}

.alce-frete-card:hover {
    background: #f7f7f7 !important;
}

/* Indicadores Visuais - Modular */
.alce-frete-card.cheapest {
    border-left: 4px solid #4CAF50 !important;
}

.alce-frete-card.fastest {
    border-left: 4px solid #FF9800 !important;
}

/* Radio Button Padrão - Modular */
.alce-frete-card input[type="radio"] {
    margin: 0 !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transform: none !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    border: 2px solid #c6c6c6 !important;
    border-radius: 50% !important;
    background: #fff !important;
    position: relative !important;
    box-shadow: none !important;
    display: inline-block !important;
    opacity: 1 !important;
}

.alce-frete-card input[type="radio"]::before {
    content: none !important;
}

.alce-frete-card input[type="radio"]:checked {
    border-color: #2c2c2c !important;
}

.alce-frete-card input[type="radio"]:checked::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #2c2c2c !important;
    border: 0px none #FFF !important;
}

/* Conteúdo do Card - Modular */
.alce-frete-content {
    font-size: 14px !important;
    color: #333 !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    display: inline-block !important;
    margin-left: 8px !important;
}

/* Localização - Modular */
.alce-frete-location-header {
    margin-top: 30px !important;
    margin-bottom: 15px !important;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

#alce-frete-cart-widget .alce-frete-location-header {
    margin-top: 20px !important;
}

.alce-frete-location-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    background-image: url('../images/sign-turn-right-fill.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

/* Hide WordPress emoji images inside icon */
.alce-frete-location-icon img.emoji,
.alce-frete-location-icon img {
    display: none !important;
}

/* Legenda - Modular */
.alce-frete-legend {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 8px;
    font-size: 11px;
    color: #666;
}

.alce-frete-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.alce-frete-bar {
    width: 3px;
    height: 10px;
    display: inline-block;
}

.alce-frete-bar.green {
    background: #4CAF50;
}

.alce-frete-bar.orange {
    background: #FF9800;
}

button#alce-frete-cart-calc {
    font-size: 13px !important;
    background-color: #0059CD !important;
    color: #FFFFFF !important;
    border: 1px solid #0059CD !important;
    padding: 10px 40px 10px 40px;
    margin-left: 10px;
}

/* Ocultar apenas elementos de debug */
#alce-frete-cart-debug {
    display: none !important;
}

body.alce-debug-on #alce-frete-cart-debug {
    display: block !important;
}

ul#alce-frete-cart-list {
    margin-top: 24px;
}

span.alce-frete-content {
    margin-left: 24px;
}

li#alce-frete-cart-list {
    margin-bottom: 10px !important;
}

input#alce-frete-cart-zip {
    font-size: 12px;
    width: 130px;
    height: 35px;
    padding: 15px 40px 15px 15px;
}

@media (min-width: 768px) {

    #alce-frete-cart-widget label,
    #alce-frete-simulator label {
        margin-top: 10px;
        margin-bottom: 10px;
        width: auto;
    }
}

@media (max-width: 767px) {
    #alce-frete-title>label {
        display: none !important;
    }

    #alce-frete-title {
        margin-bottom: 10px;
    }

    div#alce-frete-cart-widget {
        margin-bottom: 15px;
    }
}

/* Forçar alinhamento à direita na linha de totais do frete (WooCommerce) */
.cart_totals table tr.shipping td,
.woocommerce-shipping-totals td,
.cart_totals table tr.fee td {
    text-align: right !important;
    justify-content: flex-end !important;
    /* Caso seja flex */
}

/* Ocultar lista nativa de frete do WooCommerce para evitar duplicação */
.woocommerce-shipping-methods,
#shipping_method {
    display: none !important;
}

/* Garantir que nosso widget seja visível */
#alce-frete-cart-widget {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ocultar a linha nativa de entrega do WooCommerce para evitar duplicação */
.cart_totals .woocommerce-shipping-totals,
.cart_totals tr.shipping {
    display: none !important;
}

.cart_totals .woocommerce-shipping-totals #alce-frete-cart-widget,
.woocommerce-checkout #alce-frete-cart-widget {
    width: 100% !important;
    margin-top: 8px !important;
    box-sizing: border-box !important;
}

/* Checkout: manter nosso widget visível e lista nativa oculta para evitar duplicação */
.woocommerce-checkout .woocommerce-shipping-methods,
.woocommerce-checkout #shipping_method {
    display: none !important;
}

.woocommerce-checkout #alce-frete-cart-widget {
    display: block !important;
}

.cart_totals .woocommerce-shipping-totals {
    width: 100% !important;
    padding: 0 !important;
}

.cart_totals table.shop_table {
    width: 100% !important;
}

.cart_totals table.shop_table_responsive {
    width: 100% !important;
}

.woocommerce-page table.shop_table {
    width: 100% !important;
}

.woocommerce .cart-collaterals .cart_totals table.shop_table,
.woocommerce-page .cart-collaterals .cart_totals table.shop_table,
.woocommerce-cart .cart-collaterals .cart_totals table.shop_table,
.woocommerce .cart-collaterals .cart_totals table.shop_table_responsive,
.woocommerce-page .cart-collaterals .cart_totals table.shop_table_responsive,
.woocommerce-cart .cart-collaterals .cart_totals table.shop_table_responsive,
.wp-block-woocommerce-cart-totals-block table.shop_table,
.wc-block-cart__totals table.shop_table {
    width: 100% !important;
}

.cart_totals table tr.shipping td:last-child {
    padding-right: 0 !important;
}

.cart_totals table tr.alce-frete-cart-row td {
    padding: 0 !important;
}

.cart_totals table tr.alce-frete-cart-row td #alce-frete-cart-widget {
    width: 100% !important;
    display: block !important;
}

.cart_totals table tr.shipping td:last-child #alce-frete-cart-widget {
    width: 100% !important;
    display: block !important;
}

.cart_totals table tr.shipping td#Entrega #alce-frete-cart-widget,
.woocommerce-shipping-totals td#Entrega #alce-frete-cart-widget,
.cart_totals table tr.shipping td[data-title="Entrega"] #alce-frete-cart-widget,
.woocommerce-shipping-totals td[data-title="Entrega"] #alce-frete-cart-widget {
    width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
}

.cart_totals table tr.shipping td#Entrega #alce-frete-cart-widget,
.woocommerce-shipping-totals td#Entrega #alce-frete-cart-widget,
.cart_totals table tr.shipping td[data-title="Entrega"] #alce-frete-cart-widget,
.woocommerce-shipping-totals td[data-title="Entrega"] #alce-frete-cart-widget {
    width: 100% !important;
    display: block !important;
}

.cart_totals table tr.shipping td[data-title="Entrega"],
.woocommerce-shipping-totals td[data-title="Entrega"] {
    padding-right: 0 !important;
}

.woocommerce-checkout .wfacp_shipping_table ul#shipping_method,
.woocommerce-checkout ul#shipping_method,
.woocommerce-checkout ul.wfacp_no_add_here {
    display: none !important;
}

/* Radio styles removed to inherit Theme styles */

/* forcing Premium Black Style to match PIX */
.woocommerce-checkout .alce-frete-card input[type="radio"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid #000 !important;
    /* Strong Black Border */
    border-radius: 50% !important;
    margin-right: 10px !important;
    background-color: #fff !important;
    cursor: pointer !important;
    vertical-align: middle !important;
    position: relative !important;
}

.woocommerce-checkout .alce-frete-card input[type="radio"]:checked {
    border-color: #000 !important;
    background-color: #fff !important;
    /* White background for the gap */
    background-image: radial-gradient(circle, #000 0%, #000 40%, transparent 45%, transparent 100%) !important;
    /* Sharp Black Dot */
    box-shadow: none !important;
}

#alce-frete-debug-top {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 12px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    border-radius: 14px !important;
    color: #fff !important;
    z-index: 2147483647 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2) !important;
    display: block !important;
    pointer-events: none !important;
}

#alce-frete-debug-top.api {
    background: #2c7be5 !important;
}

#alce-frete-debug-top.cache {
    background: #8898aa !important;
}

#alce-frete-debug-top.select {
    background: #00a650 !important;
}

#alce-frete-debug-top.frenet {
    background: #673ab7 !important;
}

/* Native shipping totals handling is done via JS */

/* Checkout Cleanup */
.alce-frete-checkout-mode>label,
.alce-frete-checkout-mode #alce-frete-cart-zip,
.alce-frete-checkout-mode #alce-frete-cart-calc {
    display: none !important;
}

.woocommerce-billing-fields__field-wrapper {
    width: 100%;
}

/* Debug Badge (Side Tab Gadget) */
#alce-frete-debug-top {
    position: fixed !important;
    top: 150px !important;
    right: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 10px 15px 10px 15px !important;
    color: white !important;
    font-weight: 700 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 14px !important;
    line-height: 1 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;

    /* Shape: Tab attached to Right side */
    border-top-left-radius: 30px !important;
    border-bottom-left-radius: 30px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;

    /* Transition for Collapse */
    width: auto !important;
    min-width: 0 !important;
    max-width: 300px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    transform: translateX(0) !important;
    cursor: default !important;
}

#alce-frete-debug-top.collapsed {
    /* Collapsed State: Hide text, keep icon */
    max-width: 50px !important;
    /* Width just for icon + padding */
    padding: 10px 10px 10px 15px !important;
    /* Adjust padding to center icon */
    justify-content: center !important;
    gap: 0 !important;
}

/* Hide text in collapsed state */
#alce-frete-debug-top.collapsed span {
    display: none !important;
    opacity: 0 !important;
    width: 0 !important;
    margin: 0 !important;
}

#alce-frete-debug-top img {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    filter: brightness(0) invert(1) !important;
    /* Ensure white icon */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#alce-frete-debug-top span {
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* Colors */
#alce-frete-debug-top.api {
    background-color: #c0392b !important;
}

#alce-frete-debug-top.cache {
    background-color: #f39c12 !important;
}

#alce-frete-debug-top.frenet {
    background-color: #c0392b !important;
}

#alce-frete-debug-top.wp {
    background-color: #2c3e50 !important;
}

#alce-frete-debug-top.select {
    background-color: #e67e22 !important;
}