/**
 * Heartbit Product Options - heartbit-po.css
 * Estilos del módulo de opciones y panel resumen flotante.
 *
 * @package Heartbit Product Options
 * @version 2.0.6
 * @author  Heartbit Visual Design SL
 */

/* ==========================================================================
   MÓDULO DE OPCIONES (shortcode [opciones])
   ========================================================================== */

.heartbit_module_title {
    padding: 2.5rem 0 1rem 0;
}

.heartbit_ops_img {
    margin: 0 10px 10px 0;
    display: inline-block;
    min-width: 100px;
    max-width: 120px;
    float: left;
}

.heartbit_ops_desc {
    padding: 5px;
}

.heartbit_ops_title {
    font-size: 14px;
    font-weight: 600;
    max-width: 98%;
    padding-top: 0.5em;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.heartbit-ops-title-link,
.heartbit-ops-title-link:visited {
    color: inherit;
    text-decoration: none;
}

.heartbit-ops-title-link:hover {
    text-decoration: underline;
    color: #017b0d;
}

input.heartbit_single_option {
    margin-right: 0.8em;
    margin-left: 1em;
}

.opt-detalles label strong {
    margin-left: 0.3em;
}

.opt-detalles {
    display: table;
}

.opt-detalles-1,  .opt-detalles-2,  .opt-detalles-3,
.opt-detalles-4,  .opt-detalles-5,  .opt-detalles-6,
.opt-detalles-7,  .opt-detalles-8,  .opt-detalles-9,
.opt-detalles-10, .opt-detalles-11, .opt-detalles-12 {
    display: none;
    overflow: hidden;
}

#bt-add-1,  #bt-add-2,  #bt-add-3,
#bt-add-4,  #bt-add-5,  #bt-add-6,
#bt-add-7,  #bt-add-8,  #bt-add-9,
#bt-add-10, #bt-add-11, #bt-add-12 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.heartbit_opt {
    width: 100%;
}

/* Tarjeta con opción seleccionada */
.heartbit_ops_li.is-selected {
    border-color: #017b0d;
    transition: border-color 0.2s ease;
}

.heartbit_ops,
#left-area ul.heartbit_ops,
.entry-content ul.heartbit_ops,
.et-l--body ul.heartbit_ops {
    overflow: hidden;
    border: 1px solid #d9d9d9;
    padding: 0 !important;
    margin: 0 !important;
    display: table;
    width: 100%;
    list-style-type: none !important;
    line-height: normal !important;
}

#left-area ul.heartbit_ops li,
.entry-content ul.heartbit_ops li,
.et-l--body ul.heartbit_ops li {
    list-style-type: none !important;
    padding: 0 !important;
    line-height: normal !important;
}

.heartbit_ops_li {
    list-style: none;
    display: inline-table;
    margin: 1rem;
    width: calc(50% - 2rem);
    border: 1px solid #d9d9d9;
}

/* Ocultar en relacionados y barra lateral */
.related .resumen-precios                                          { display: none; }
.comanda_lateral .heartbit_ops,
.comanda_lateral .heartbit_ops_module,
.comanda_lateral .resumen-precios                                  { display: none !important; }
.comanda_lateral .resumen-precios                                  { position: relative !important; }

/* ==========================================================================
   PANEL RESUMEN FLOTANTE (#floatprices)
   ========================================================================== */

#floatprices {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background-color: #ffffff;
    border-bottom: 2px solid #017b0d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 10px 20px;
    width: 100%;
    box-sizing: border-box;
    transition: top 0.15s ease;
}

/* Layout interno del panel */
#floatprices .float-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    max-width: 1280px;
    margin: 0 auto;
}

#floatprices .float-product-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex-shrink: 0;
}

#floatprices .float-product-name {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
}

#floatprices .float-base-price {
    font-size: 0.9rem;
    margin: 0;
    color: #555;
}

/* Resumen opciones seleccionadas */
#floatprices .resumen-precios {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 16px;
    flex: 1;
}

#floatprices h4.tit-opciones {
    display: none; /* el título inline no se necesita en el panel */
}

#floatprices ul.precios-opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

#floatprices ul.precios-opciones li.resumen {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    padding-right: 0.8rem;
}

#floatprices .heartbit-remove-opt {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 3px !important;
    margin: 0 !important;
    font-size: 1.1rem !important;
    line-height: 1 !important;
    color: #cc0000 !important;
    cursor: pointer !important;
    flex-shrink: 0;
    transition: color 0.15s;
    text-transform: none !important;
    letter-spacing: normal !important;
}

#floatprices .heartbit-remove-opt:hover {
    color: #ff0000 !important;
    background: none !important;
}

#floatprices ul.precios-opciones li strong {
    padding-left: 0.2rem;
}

/* Total */
#floatprices .precios-tot {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

#floatprices .precios-tot p.precio-opciones {
    display: none; /* en el panel fixed solo mostramos el total */
}

#floatprices .precios-tot h4 {
    margin: 0;
    line-height: 1.2;
    font-size: 1rem;
    white-space: nowrap;
}

#floatprices .precios-tot h4 strong {
    font-size: 1.4rem;
    font-weight: 600;
    font-family: 'Open Sans', sans-serif;
    line-height: 1.2;
    padding-left: 0.3rem;
}

/* Botón añadir al carrito */
#floatprices .heartbit-float-btn {
    flex-shrink: 0;
    margin: 0;
    padding: 8px 20px;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ==========================================================================
   TOTALES (fuera del panel fixed)
   ========================================================================== */

.precios-tot h4 {
    line-height: 32px;
}

.precios-tot h4 strong {
    font-size: 28px;
    font-weight: normal;
    font-family: 'Open Sans', sans-serif;
    line-height: 32px;
}

.precios-tot li {
    list-style: none;
}

.precios-tot li h4 {
    padding-top: 1em;
    font-size: 20px;
    line-height: 1.7em;
}

.precios-tot li h4 strong {
    font-size: 28px;
    font-weight: normal;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media only screen and (max-width: 990px) {
    .heartbit_ops_li {
        display: inline-flex;
        margin: 1rem;
        width: calc(100% - 2rem);
        border: 1px solid #d9d9d9;
    }
}

/* Columna estrecha (WooCommerce sin shortcode, sidebar presente) */
@media only screen and (max-width: 1100px) {
    .heartbit_ops_li {
        width: calc(100% - 2rem);
    }

    .heartbit_ops_img {
        min-width: 80px;
        max-width: 90px;
    }
}

@media only screen and (max-width: 672px) {
    .heartbit_ops_img {
        float: none;
    }

    #floatprices .float-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    #floatprices .precios-tot p.precio-opciones {
        display: none;
    }
}

@media only screen and (max-width: 479px) {
    #floatprices .float-product-info,
    #floatprices ul.precios-opciones {
        display: none; /* en móvil pequeño: solo total + botón */
    }

    #floatprices .precios-tot h4 {
        text-align: center;
        padding: 2px 5px;
    }

    #floatprices .heartbit-float-btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   POPUP DE OPCIONES
   ========================================================================== */

/* Overlay */
.heartbit-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Bloquear scroll del body cuando el popup está abierto */
body.heartbit-popup-open {
    overflow: hidden;
}

/* Diálogo */
.heartbit-popup-dialog {
    position: relative;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 860px;
    height: 450px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Botón cerrar */
.heartbit-popup-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    z-index: 10;
    padding: 0 4px;
    transition: color 0.15s;
}
.heartbit-popup-close:hover {
    color: #017b0d;
}

/* Contenido individual de cada popup */
.heartbit-popup-content {
    display: none;
    flex-direction: row;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ---- Lado izquierdo ---- */
.heartbit-popup-left {
    width: 50%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e1e1e1;
    overflow: hidden;
}

/* Pestañas */
.heartbit-popup-tabs {
    display: flex;
    border-bottom: 2px solid #e1e1e1;
    flex-shrink: 0;
}

.heartbit-tab-btn {
    flex: 1;
    padding: 10px 14px;
    background: #f7f7f7;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    margin-bottom: -2px;
}
.heartbit-tab-btn:hover {
    background: #fff;
    color: #017b0d;
}
.heartbit-tab-btn.is-active {
    background: #fff;
    color: #017b0d;
    border-bottom-color: #017b0d;
}

/* Paneles de pestaña */
.heartbit-tab-panel {
    display: none;
    flex: 1;
    height: 100%;
    overflow: hidden;
}
.heartbit-tab-panel.is-active {
    display: block;
}

/* Imagen: ocupa ancho total, oculta lo sobrante por abajo */
.heartbit-popup-img-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
    line-height: 0;
}
.heartbit-popup-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Descripción con scroll si no cabe */
.heartbit-popup-desc {
    padding: 20px 24px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

/* ---- Lado derecho ---- */
.heartbit-popup-right {
    width: 50%;
    display: flex;
    flex-direction: column;
    padding: 32px 28px 24px;
    overflow-y: auto;
    box-sizing: border-box;
}

.heartbit-popup-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 20px;
    padding-right: 24px; /* espacio para la X */
    line-height: 1.3;
    color: #222;
}

/* Checkboxes */
.heartbit-popup-checks {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.heartbit-check-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    transition: border-color 0.15s, background 0.15s;
    font-size: 0.9rem;
    line-height: 1.4;
}
.heartbit-check-label:hover {
    border-color: #017b0d;
    background: #f5fdf5;
}
.heartbit-check-label input[type="checkbox"] {
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: #017b0d;
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.heartbit-check-label span strong {
    color: #017b0d;
    font-weight: 700;
}

/* Trigger button en la tarjeta */
.heartbit-popup-trigger {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

/* ==========================================================================
   RESPONSIVE POPUP
   ========================================================================== */

@media only screen and (max-width: 700px) {
    .heartbit-popup-content {
        flex-direction: column;
        overflow-y: auto;
    }

    .heartbit-popup-left,
    .heartbit-popup-right {
        width: 100%;
        border-right: none;
        height: auto;
    }

    .heartbit-popup-left {
        border-bottom: 1px solid #e1e1e1;
        max-height: 45vh;
    }

    .heartbit-popup-right {
        padding: 20px 16px;
    }

    .heartbit-popup-dialog {
        height: auto;
        max-height: 65vh;
        overflow-y: auto;
        border-radius: 4px;
    }
}

/* Móvil landscape: viewport bajo, popup en fila y altura contenida */
@media only screen and (max-width: 900px) and (orientation: landscape) {
    .heartbit-popup-overlay {
        padding: 8px;
        align-items: center;
    }

    .heartbit-popup-dialog {
        height: auto;
        max-height: 92vh;
        overflow: hidden;
    }

    .heartbit-popup-content {
        flex-direction: row; /* volvemos a fila para aprovechar el ancho */
        overflow: hidden;
        height: 100%;
        max-height: 92vh;
    }

    .heartbit-popup-left {
        width: 50%;
        border-right: 1px solid #e1e1e1;
        border-bottom: none;
        max-height: 92vh;
        overflow: hidden;
    }

    .heartbit-popup-right {
        width: 50%;
        padding: 12px 16px;
        overflow-y: auto;
        max-height: 92vh;
    }

    .heartbit-tab-panel.is-active {
        overflow-y: auto;
        max-height: calc(92vh - 44px); /* descontar altura de pestañas */
    }
}

/* =====================================================================
 * CARRITO — filas de opciones
 * =================================================================== */
.woocommerce-cart tr.heartbit-option-item td,
.woocommerce-checkout tr.heartbit-option-item td {
    background-color: #fafafa;
    border-top: none !important;
}

.woocommerce-cart tr.heartbit-option-item td.product-name,
.woocommerce-checkout tr.heartbit-option-item td.product-name {
    padding-left: 2em;
}

.woocommerce-cart tr.heartbit-option-item td.product-thumbnail,
.woocommerce-checkout tr.heartbit-option-item td.product-thumbnail {
    padding-left: 1.5em;
}

/* Ocultar metadata de bloque WooCommerce en filas de opciones */
.heartbit-option-item .wc-block-components-product-metadata__description {
    display: none !important;
}

/* Breadcrumb de categoría — no aporta valor en carrito ni checkout */
.woocommerce-cart .wc-block-components-product-metadata__description,
.woocommerce-checkout .wc-block-components-product-metadata__description {
    display: none !important;
}

/* Indentación filas de opciones — carrito de bloques */
.heartbit-option-item .wc-block-cart-item__image {
    padding-left: 1.5em !important;
}

.heartbit-option-item .wc-block-cart-item__product {
    padding-left: 0.5em !important;
}

.heartbit-option-item .wc-block-cart-item__wrap {
    background-color: #fafafa;
}
