/***** Ficha de producto rediseñada (docs/ficha-producto.md) *****/
/* Solo se carga en la ficha (templates/catalog/product.tpl). Para deshacerlo, ver el documento. */

/* En #main y no en la columna: el tema copia el bloque de compra a la barra fija inferior (custom.js, bottomSticky) */
#main {
    --tef-verde: #85ad00;
    --tef-verde-claro: #95c51c;
    --tef-verde-oscuro: #6c9400;
    --tef-texto: #1f2328;
    --tef-gris: #6b7280;
    --tef-borde: #e5e7eb;
    --tef-fondo: #f5f7f9;
    --tef-azul: #2563eb;
    --tef-rojo: #e11d48;
}

#main .tef-icono {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Título ---------- */
/* El tema reserva 150px a la derecha del h1 para el logo de la marca; sin logo, el título ocupa todo el ancho */
#main .tef-sin-marca h1 {
    padding-right: 0;
}

/* ---------- Precio ---------- */
#main .tef-precio {
    background: var(--tef-fondo);
    border-radius: 14px;
    padding: 16px 18px 14px;
    margin: 15px 0;
}
#main .tef-precio .product-price {
    display: block;
    margin: 0;
}
#main .tef-precio-fila {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
#main .tef-precio .current-price {
    display: block;
    margin: 0;
}
#main .tef-precio .current-price .price {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--tef-texto);
}
#main .tef-precio .product-discount {
    display: block;
    margin: 0;
}
#main .tef-precio .product-discount .regular-price {
    font-size: 15px;
    color: #9ca3af;
    text-decoration: line-through;
    margin: 0;
}
#main .tef-precio .discount {
    margin: 0 0 0 auto;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--tef-azul);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: none;
}
#main .tef-precio-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--tef-gris);
}
#main .tef-precio-info .tvproduct-tax-label {
    display: inline;
    float: none;
    margin: 0;
    padding: 0;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tef-gris);
}
#main .tef-devoluciones {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#main .tef-devoluciones .tef-icono {
    color: #16a34a;
}
#main .tef-devoluciones strong {
    color: var(--tef-texto);
}
#main .tef-precio .tax-shipping-delivery-label {
    margin: 0;
    font-size: 12px;
}
#main .tef-precio .tax-shipping-delivery-label:empty {
    display: none;
}

/* ---------- Cantidad y botón ---------- */
#main .tef-compra {
    display: block;
    margin: 0 0 10px;
}
#main .tef-compra-fila {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#main .tef-cantidad {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 10px 10px 10px 18px;
    background: var(--tef-fondo);
    border-radius: 14px;
}
#main .tef-cantidad .control-label {
    margin: 0;
    padding: 0;
    float: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tef-texto);
}
#main .tef-cantidad .qty {
    float: none;
    margin: 0;
    width: auto;
}
#main .tef-cantidad .bootstrap-touchspin {
    display: flex;
    align-items: center;
    width: auto;
    height: 46px;
    margin: 0;
    background: #fff;
    border: 1px solid var(--tef-borde);
    border-radius: 10px;
    overflow: hidden;
}
#main .tef-cantidad .input-group-btn-vertical {
    display: contents;
}
#main .tef-cantidad #quantity_wanted {
    order: 1;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--tef-texto);
}
#main .tef-cantidad .btn-touchspin {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--tef-texto);
    font-size: 22px;
    line-height: 1;
}
#main .tef-cantidad .btn-touchspin:hover {
    background: var(--tef-fondo);
}
#main .tef-cantidad .bootstrap-touchspin-down {
    order: 0;
    color: #9ca3af;
}
#main .tef-cantidad .bootstrap-touchspin-up {
    order: 2;
}
#main .tef-cantidad .btn-touchspin i {
    display: none;
}
#main .tef-cantidad .bootstrap-touchspin-down::before {
    content: "\2212";
}
#main .tef-cantidad .bootstrap-touchspin-up::before {
    content: "+";
}

#main .tef-compra .tv-product-page-add-to-cart-wrapper {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}
#main .tef-compra .tvcart-btn-model {
    display: block;
    width: 100%;
    margin: 0;
}
#main .tef-boton-carrito {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 62px;
    margin: 0;
    padding: 10px 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--tef-verde-claro), var(--tef-verde-oscuro));
    box-shadow: 0 10px 22px rgba(108, 148, 0, .35);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .02em;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
#main .tef-boton-carrito:hover,
#main .tef-boton-carrito:focus {
    color: #fff;
    filter: brightness(1.05);
    box-shadow: 0 12px 26px rgba(108, 148, 0, .45);
}
#main .tef-boton-carrito:active {
    transform: translateY(1px);
}
#main .tef-boton-carrito.disabled {
    background: #9ca3af;
    box-shadow: none;
}
#main .tef-boton-carrito .tef-boton-icono {
    position: absolute;
    left: 12px;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-top: -19px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .2);
}
#main .tef-boton-carrito .tef-boton-icono svg,
#main .tef-boton-carrito .tef-boton-flecha {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#main .tef-boton-carrito .tef-boton-icono i {
    margin: 0;
    font-size: 22px;
}
#main .tef-boton-carrito .tef-boton-flecha {
    position: absolute;
    right: 18px;
    top: 50%;
    margin-top: -11px;
}
#main .tef-boton-carrito .tef-boton-texto {
    margin: 0;
    color: inherit;
    font: inherit;
}

#main .tef-garantias {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 0;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: var(--tef-gris);
}
#main .tef-garantias li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#main .tef-garantias li + li::before {
    content: "\2022";
    margin: 0 10px;
    color: #c4c8cf;
}
#main .tef-icono-verde {
    color: #16a34a;
}
#main .tef-icono-ambar {
    color: #f59e0b;
    fill: #f59e0b;
}

#main .tef-extras {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 16px;
    margin-top: 8px;
}
#main .tef-extras .tvproduct-wishlist-compare {
    display: flex;
    margin: 0;
}
#main .tef-extras .tvproduct-stock-social:empty,
#main .tef-extras .product-additional-info:empty {
    display: none;
}

/* ---------- Bloques de confianza ---------- */
#main .tef-confianza {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0 0;
}
#main .tef-tarjeta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--tef-borde);
    border-radius: 12px;
    color: var(--tef-texto);
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
#main a.tef-tarjeta:hover {
    border-color: #cfd4da;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    color: var(--tef-texto);
}
#main .tef-tarjeta-ancha {
    grid-column: 1 / -1;
    padding: 14px;
}
#main .tef-tarjeta-icono {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
}
#main .tef-tarjeta-ancha .tef-tarjeta-icono {
    width: 46px;
    height: 46px;
}
#main .tef-tarjeta-icono svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#main .tef-gris { background: var(--tef-fondo); color: #374151; border: 1px solid var(--tef-borde); }
#main .tef-rojo { background: #ffe4e6; color: var(--tef-rojo); }
#main .tef-azul { background: #e0ecff; color: var(--tef-azul); }
#main .tef-verde { background: #dcfce7; color: #16a34a; }

#main .tef-tarjeta-texto {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    line-height: 1.3;
}
#main .tef-tarjeta-texto strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--tef-texto);
}
#main .tef-tarjeta-ancha .tef-tarjeta-texto strong {
    font-size: 15px;
}
#main .tef-tarjeta-texto small {
    overflow: hidden;
    font-size: 12px;
    color: var(--tef-gris);
    text-overflow: ellipsis;
}
#main .tef-antetitulo {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--tef-gris);
}
#main .tef-telefono a {
    color: var(--tef-rojo);
    font-size: 17px;
    letter-spacing: .06em;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}
#main .tef-telefono a:hover {
    color: #be123c;
}

/* ---------- Escritorio ---------- */
@media (min-width: 768px) {
    #main .tef-compra-fila {
        flex-direction: row;
        align-items: stretch;
    }
    #main .tef-cantidad {
        flex: 0 0 auto;
    }
    #main .tef-compra .tv-product-page-add-to-cart-wrapper {
        flex: 1 1 auto;
        width: auto;
    }
    #main .tef-boton-carrito {
        height: 100%;
    }
    #main .tef-garantias {
        justify-content: flex-start;
    }
    #main .tef-extras {
        justify-content: flex-start;
    }
}
@media (min-width: 768px) and (max-width: 1199px) {
    /* Columna estrecha: la cantidad pasa encima del botón */
    #main .tef-compra-fila {
        flex-direction: column;
    }
}
@media (min-width: 1200px) {
    #main .tef-precio .current-price .price {
        font-size: 34px;
    }
}
@media (max-width: 399px) {
    #main .tef-tarjeta {
        gap: 10px;
        padding: 10px;
    }
    #main .tef-tarjeta:not(.tef-tarjeta-ancha) .tef-tarjeta-texto strong {
        font-size: 13px;
    }
}

/* ---------- Descripción del producto ---------- */
/* Muchas descripciones vienen copiadas de webs de proveedores (listas anidadas, títulos enormes).
   El tema pone las listas en inline-block (custom.css: .cms-description ul), que crecen hasta su
   contenido más ancho y sacan el texto de la pantalla. Solo en la ficha: .cms-description se usa también en CMS. */
#main .product-description ul {
    max-width: 100%;
}
#main .product-description h1,
#main .product-description h2,
#main .product-description h3 {
    overflow-wrap: anywhere;
}
#main .product-description img,
#main .product-description table {
    max-width: 100%;
}
@media (max-width: 767px) {
    /* custom.css pone 4em (64px) al h1 de las descripciones */
    #main .product-description h1 {
        font-size: 2em;
    }
    /* Cada lista anidada suma 40px de sangría; en móvil se reduce */
    #main .product-description ul {
        padding-left: 20px;
    }
    #main .product-description ul ul {
        padding-left: 0;
    }
    /* Una tabla que aun así no quepa se desplaza dentro de su caja, sin mover la página */
    #main .product-description table {
        display: block;
        overflow-x: auto;
    }
}

/* ---------- Barra fija inferior (escritorio, al hacer scroll) ---------- */
/* El tema copia aquí el precio y el bloque de compra: versión compacta */
#main .tvfooter-product-sticky-bottom .tef-precio {
    margin: 0;
    padding: 0;
    background: none;
}
#main .tvfooter-product-sticky-bottom .tef-precio .current-price .price {
    font-size: 24px;
}
#main .tvfooter-product-sticky-bottom .tef-precio .discount,
#main .tvfooter-product-sticky-bottom .tef-devoluciones,
#main .tvfooter-product-sticky-bottom .tef-garantias,
#main .tvfooter-product-sticky-bottom .tef-extras,
#main .tvfooter-product-sticky-bottom .tvproduct-size-custom {
    display: none;
}
#main .tvfooter-product-sticky-bottom .tef-precio-info {
    margin-top: 2px;
}
#main .tvfooter-product-sticky-bottom .tef-compra {
    margin: 0;
}
#main .tvfooter-product-sticky-bottom .tef-compra-fila {
    flex-direction: row;
    align-items: center;
}
#main .tvfooter-product-sticky-bottom .tef-cantidad {
    padding: 6px 6px 6px 14px;
}
#main .tvfooter-product-sticky-bottom .tef-boton-carrito {
    min-width: 260px;
    min-height: 54px;
}

