/* ========== TARJETAS DE PRODUCTOS REUTILIZABLES ========== */

/* Contenedor de tarjeta individual */
.related-simple-item {
    flex: 0 0 calc((100% - 32px) / 3);
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 16px;
    padding: 16px 18px;
    background: #f5f7fa;
    border-radius: 10px;
    border: 1px solid #d9dce2;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: #1d1f24;
    position: relative;
}

/* Link del producto */
.related-product-link {
    display: flex;
    gap: 16px;
    flex: 1;
    text-decoration: none;
    color: inherit;
    align-items: stretch;
}

.related-product-link:hover {
    text-decoration: none;
    color: inherit;
}

.related-product-link:hover .related-product-code {
    color: #FAB702;
}

/* Header del contenido (info + logo de marca) */
.related-content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.related-content-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Logo de marca */
.related-simple-brand-logo {
    flex: 0 0 33.333%;
    max-width: 120px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 4px;
}

.related-simple-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.related-simple-brand-logo .brand-logo-placeholder {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.related-simple-brand-logo .brand-logo-placeholder i {
    font-size: 20px;
    color: #999;
}

/* Imagen del producto */
.related-simple-image {
    flex: 0 0 33.333%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-simple-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

/* Contenido del producto */
.related-simple-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.related-product-code {
    font-size: 1.15rem;
    color: #10121a;
    font-weight: 700;
}

.related-product-description {
    font-size: 0.85rem;
    color: #4a5568;
    line-height: 1.3;
}

.related-product-montaje {
    font-size: 0.85rem;
    color: #4a5568;
    line-height: 1.3;
}

.related-product-unidades {
    font-size: 0.85rem;
    color: #16a34a;
    font-weight: 600;
    line-height: 1.3;
}

/* Control de cantidad y botones */
.related-simple-qty {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    flex-wrap: nowrap;
}

.quantity-control {
    display: inline-flex;
    border: 1px solid #c7ccd6;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.quantity-control .qty-btn,
.quantity-control .qty-input {
    border: none;
    background: #fff;
    text-align: center;
    height: 28px;
    font-size: 0.85rem;
    margin: 0;
    padding: 0;
}

.quantity-control .qty-btn {
    width: 24px;
    cursor: pointer;
    color: #1d1f24;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-control .qty-btn:hover {
    background: #0d6efd;
    color: #fff;
}

.quantity-control .qty-btn:first-child {
    border-right: 1px solid #c7ccd6;
}

.quantity-control .qty-btn:last-child {
    border-left: 1px solid #c7ccd6;
}

.quantity-control .qty-input {
    width: 40px;
    outline: none;
    font-weight: 600;
    color: #10121a;
    -moz-appearance: textfield;
}

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

.quantity-control .qty-input:focus {
    outline: none;
    background: #f8f9fa;
}

/* Botones de acción */
.related-simple-qty .related-simple-add {
    white-space: nowrap;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    background-color: #FAB702;
    border-color: #FAB702;
    color: #fff;
    font-size: 0.85rem;
}

.related-simple-qty .related-simple-add:hover {
    background-color: #e0a502;
    border-color: #e0a502;
}

/* Layout especial para contexto de búsqueda */
.search-context .related-simple-qty {
    flex-wrap: nowrap;
}

/* Control de cantidad */
.search-context .related-simple-qty .quantity-control {
    order: 1;
}

/* Botón añadir entre cantidad y eliminar */
.search-context .related-simple-qty .related-simple-add {
    order: 2;
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.85rem;
}

/* Botón eliminar */
.search-context .related-simple-qty .related-simple-remove {
    order: 3;
}

/* "En cesta" al final */
.search-context .related-simple-qty .related-cart-quantity {
    order: 4;
    margin-left: 0;
}

.related-simple-qty .related-simple-remove {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
    border-radius: 4px;
}

.related-simple-qty .related-simple-remove:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.related-simple-qty .related-simple-remove i {
    font-size: 0.9rem;
}

/* Indicador de cantidad en cesta */
.related-cart-quantity {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.375rem 0.6rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.related-cart-quantity .cart-qty-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.related-cart-quantity .cart-qty-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #28a745;
    min-width: 18px;
    text-align: center;
}

/* Línea indicadora de stock */
.product-stock-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 0 0 10px 10px;
    transition: all 0.3s ease;
}

.related-simple-item:hover .product-stock-indicator {
    height: 5px;
}

/* ========== CARRUSEL DE PRODUCTOS RELACIONADOS ========== */

.related-products-simple {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 32px 0;
    width: 100%;
}

.related-simple-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
}

.related-simple-nav:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.85);
}

.related-simple-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.related-simple-viewport {
    overflow: hidden;
    flex: 1;
}

.related-simple-track {
    display: flex;
    gap: 16px;
    transition: transform 0.3s ease;
}

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

@media (max-width: 992px) {
    .related-simple-item {
        flex: 0 0 calc((100% - 16px) / 2);
        padding: 14px 16px;
    }
}

@media (max-width: 576px) {
    .related-products-simple {
        gap: 8px;
        margin: 24px auto;
    }

    .related-simple-track {
        gap: 12px;
    }

    .related-simple-item {
        flex: 0 0 90%;
        min-height: 100px;
        padding: 12px 14px;
    }

    .related-simple-qty {
        gap: 6px;
    }

    .related-simple-qty .qty-input {
        width: 48px;
    }

    .related-simple-qty .related-simple-add {
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
    }

    .related-simple-image {
        border-radius: 6px;
    }

    .related-simple-content strong {
        font-size: 1rem;
    }
}
