/* Wrapper General */
.custom-wc-shortcode-wrapper {
    width: 100%;
    margin: 20px 0;
}

/* Barra de Ordenamiento (Toolbar) */
.custom-cat-toolbar-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.custom-woocommerce-ordering {
    display: flex;
    align-items: center;
    margin: 0;
}

.custom-woocommerce-ordering label {
    font-size: 13px;
    font-weight: 600;
    color: #555555;
    margin-right: 8px;
    margin-bottom: 0;
}

.custom-woocommerce-ordering select.orderby {
    border: 1px solid #dcdcdc !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    outline: none;
    cursor: pointer;
}

/* Grid adaptable */
.custom-products-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 3), 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .custom-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .custom-products-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Tarjeta del producto */
.custom-card-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Insignia "SALE!" */
.custom-onsale {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    background-color: #00c9b7;
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
}

/* Imagen */
.custom-card-image-link {
    display: block;
    width: 100%;
    overflow: hidden;
}

.custom-card-image-link img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Bloque Inferior Azul */
.custom-card-info-box {
    background-color: #0056cb;
    padding: 0 0 15px 0;
    color: #ffffff;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.custom-card-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
    /* La barra sube sobre la imagen con margin-top negativo: hay que
       asegurar que las insignias se pintan por encima y no se recortan. */
    position: relative;
    z-index: 1;
}

.custom-card-dimension {
    color: #ffffff;
    font-weight: 800;
    font-size: 15px;
}

@media (min-width: 801px){
    .custom-card-header-bar {margin-top: -30px;}
}

/* Insignia del atributo "size" (sólo si el producto lo tiene) */
.custom-card-size {
    background-color: #002d72;
    color: #fff;
    padding: 8px 16px;
    border-radius: 11px;
    font-weight: 700;
    font-size: clamp(16px, 2.5vw, 22px);
    line-height: 1.1;
    white-space: nowrap;
    /* Puede encogerse si el valor es largo; el botón nunca lo hace. */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-card-btn {
    background-color: #00c9b7;
    color: #ffffff !important;
    padding: 7px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.custom-card-btn:hover {
    background-color: #00a899;
}

/* Título */
.custom-card-title {
    margin: 0 0 10px 0 !important;
    padding: 0 12px !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
}

.custom-card-title a {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Precios */
.custom-price-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}

.custom-old-price {
    color: #ff4d4d !important;
    text-decoration: line-through;
    text-decoration-color: #ff4d4d;
    text-decoration-thickness: 2px;
    font-weight: 700;
    font-size: clamp(14px, 1.8vw, 17px);
    line-height: 1.2;
}

/* wc_price() envuelve el importe en <span class="woocommerce-Price-amount">,
   que en algunos temas trae su propio color y lo anula. */
.custom-old-price .woocommerce-Price-amount,
.custom-old-price .woocommerce-Price-currencySymbol {
    color: inherit !important;
    font-size: inherit;
    font-weight: inherit;
}

.custom-sale-badge {
    background-color: #002d72;
    color: #ffffff;
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    display: inline-block;
}

/* El precio de los productos variables llega como HTML de WooCommerce */
.custom-sale-badge del,
.custom-sale-badge ins {
    color: #ffffff;
    background: none;
    text-decoration-color: #ff4d4d;
}

.custom-sale-badge ins {
    text-decoration: none;
}

/* Paginación (shortcode con paginate="yes") */
.custom-products-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 25px;
}

.custom-products-pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #dcdcdc;
    background: #ffffff;
    color: #333333;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
}

.custom-products-pagination .page-numbers:hover {
    border-color: #0056cb;
}

.custom-products-pagination .page-numbers.current {
    background-color: #0056cb;
    border-color: #0056cb;
    color: #ffffff;
}

/* Aviso "sin productos" / categoría inexistente */
.custom-wc-notice {
    margin: 20px 0;
    font-size: 14px;
    color: #555555;
}

/* Botón de envío del selector (sólo visible sin JavaScript) */
.custom-orderby-submit {
    margin-left: 8px;
    padding: 6px 12px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}