/* Upsell Products Styles */
.creaworld-upsell-products {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.creaworld-upsell-products h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #333;
}

.upsell-products-grid {
    display: grid;
    gap: 20px;
}

.upsell-product-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.upsell-product-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.upsell-product-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}

.upsell-product-title {
    font-size: 1.1em;
    margin: 0 0 10px 0;
    color: #333;
}

.upsell-product-price {
    font-size: 1.2em;
    font-weight: bold;
    color: #E91E63;
    margin-bottom: 15px;
}

.upsell-product-actions .button {
    width: 100%;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upsell-product-actions .button:hover:not(:disabled) {
    background: #45a049;
}

.upsell-product-actions .button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.upsell-product-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.upsell-product-item.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.creaworld-upsell-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: block;
}

.creaworld-upsell-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.creaworld-upsell-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .upsell-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .upsell-products-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Locked Quantity Styles */
.upsell-quantity-locked {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
}

.upsell-qty-label {
    font-weight: 600;
    color: #333;
}

.upsell-qty-value {
    background: #f5f5f5;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 500;
    color: #E91E63;
    min-width: 40px;
    text-align: center;
    display: inline-block;
}

/* Prevent editing via inspector */
.upsell-quantity-locked input[type="hidden"][data-locked="true"] {
    display: none !important;
}

/* Disable any quantity inputs for upsell products */
tr.cart_item[data-product-id*="upsell"] .quantity input[type="number"],
.upsell-quantity-locked input[type="number"] {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Greyed out upsell product when in cart */
.upsell-product-item.in-cart {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.upsell-product-item.in-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1;
    border-radius: 8px;
    pointer-events: none;
}

.upsell-product-item.in-cart .upsell-product-title,
.upsell-product-item.in-cart .upsell-product-price,
.upsell-product-item.in-cart a {
    color: #999;
    text-decoration: none;
}

.upsell-product-item.in-cart .add-upsell {
    background: #ccc;
    cursor: not-allowed;
    border-color: #bbb;
}

/* Already in cart badge */
.upsell-added-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    z-index: 2;
    pointer-events: none;
}

.upsell-product-item {
    position: relative;
}
