/*
 * Fabcrush Cart Restore Item Button Styles
 * Styles the "Отмяна?" (Cancel/Undo) button when removing items from cart
 * Matches the "use design" button style from AI marketplace gallery
 */

/* Show restore-item notices (when item is removed from cart) */
.woocommerce-cart .woocommerce-message .restore-item,
.woocommerce-page .woocommerce-message .restore-item {
    display: inline-block !important;
}

/* Style the restore-item button container - position to right */
/* Only apply flex layout when restore-item is present */
.woocommerce-cart .woocommerce-message:has(.restore-item),
.woocommerce-page .woocommerce-message:has(.restore-item) {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
}

/* Move restore-item button to the right */
.woocommerce-cart .woocommerce-message .restore-item,
.woocommerce-page .woocommerce-message .restore-item {
    margin-left: auto !important;
    margin-right: 0 !important;
    order: 999 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* Style the restore-item button to match marketplace "use design" button */
.woocommerce-cart .woocommerce-message .restore-item,
.woocommerce-page .woocommerce-message .restore-item,
a.restore-item {
    width: auto !important;
    padding: 10px 12px !important;
    margin: 0 0 0 auto !important;
    /* Set background-color transparent, then apply gradient as background-image */
    background-color: transparent !important;
    background-image: linear-gradient(135deg, #2b6bc7 0%, #cf3a74 50%, #e53143 75%, #ff6b35 100%) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 100% 100% !important;
    border: 1px solid rgba(102, 126, 234, 0.5) !important;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15) !important;
    transform: none !important;
    font-weight: 600 !important;
    /* Gradient text effect - clip background to text */
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important;
    text-align: center !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    font-size: 0.9rem !important;
    line-height: 1.3 !important;
}

/* Hover state - matches marketplace button hover */
.woocommerce-cart .woocommerce-message .restore-item:hover,
.woocommerce-page .woocommerce-message .restore-item:hover,
a.restore-item:hover {
    /* Background color for the button box */
    background-color: rgba(102, 126, 234, 0.1) !important;
    /* Keep gradient for text */
    background-image: linear-gradient(135deg, #2b6bc7 0%, #cf3a74 50%, #e53143 75%, #ff6b35 100%) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 100% 100% !important;
    border: 1px solid rgba(102, 126, 234, 0.3) !important;
    backdrop-filter: blur(3px);
    transform: none !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1) !important;
    text-decoration: none !important;
    /* Keep gradient text on hover */
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important;
}

/* Active state */
.woocommerce-cart .woocommerce-message .restore-item:active,
.woocommerce-page .woocommerce-message .restore-item:active,
a.restore-item:active {
    transform: none !important;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.2) !important;
}

/* Focus state */
.woocommerce-cart .woocommerce-message .restore-item:focus,
.woocommerce-page .woocommerce-message .restore-item:focus,
a.restore-item:focus {
    outline: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15), 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
}

/* Ensure the message text stays on the left */
.woocommerce-cart .woocommerce-message:has(.restore-item):before,
.woocommerce-page .woocommerce-message:has(.restore-item):before {
    order: 1 !important;
}

/* Message text wrapper */
.woocommerce-cart .woocommerce-message:has(.restore-item),
.woocommerce-page .woocommerce-message:has(.restore-item) {
    position: relative !important;
}

/* Ensure notice text appears on the left - handle both p tags and direct text */
.woocommerce-cart .woocommerce-message:has(.restore-item) p,
.woocommerce-page .woocommerce-message:has(.restore-item) p {
    flex: 0 1 auto !important;
    margin: 0 !important;
    order: 1 !important;
    max-width: none !important;
}

/* Handle direct text nodes - wrap inline content before restore-item */
.woocommerce-cart .woocommerce-message:has(.restore-item),
.woocommerce-page .woocommerce-message:has(.restore-item) {
    line-height: normal !important;
    text-align: left !important;
}

/* Make sure text before restore-item stays on left and doesn't expand */
.woocommerce-cart .woocommerce-message:has(.restore-item) > *:not(.restore-item),
.woocommerce-page .woocommerce-message:has(.restore-item) > *:not(.restore-item) {
    order: 1 !important;
    flex: 0 1 auto !important;
    margin-right: auto !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .woocommerce-cart .woocommerce-message .restore-item,
    .woocommerce-page .woocommerce-message .restore-item {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 12px !important;
        order: 2 !important;
    }
    
    .woocommerce-cart .woocommerce-message,
    .woocommerce-page .woocommerce-message {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}

