/**
 * Force Add to Cart AJAX Function
 * Styles
 * 
 * @package Force_Add_To_Cart_Ajax
 * @version 1.0.0
 * @author Showmik Hassan
 */

/* ==========================================================================
   Notification Styles
   ========================================================================== */

.fac-notice {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    min-width: 300px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    overflow: hidden;
}

.fac-notice.fac-notice-show {
    transform: translateX(0);
}

.fac-notice-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.fac-notice-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fac-notice-icon svg {
    width: 24px;
    height: 24px;
}

.fac-notice-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    font-weight: 500;
}

.fac-notice-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.fac-notice-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Notice Types */
.fac-notice-success {
    border-left: 4px solid #10b981;
}

.fac-notice-success .fac-notice-icon {
    color: #10b981;
}

.fac-notice-error {
    border-left: 4px solid #ef4444;
}

.fac-notice-error .fac-notice-icon {
    color: #ef4444;
}

.fac-notice-warning {
    border-left: 4px solid #f59e0b;
}

.fac-notice-warning .fac-notice-icon {
    color: #f59e0b;
}

.fac-notice-loading {
    border-left: 4px solid #3b82f6;
}

.fac-notice-loading .fac-notice-icon {
    color: #3b82f6;
}

/* Spinner Animation */
.fac-spinner {
    animation: fac-spin 1s linear infinite;
}

@keyframes fac-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Notice Buttons */
.fac-notice-buttons {
    display: flex;
    gap: 8px;
    padding: 0 20px 16px;
    margin-top: -4px;
}

.fac-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fac-btn-cart {
    background: #f3f4f6;
    color: #374151;
}

.fac-btn-cart:hover {
    background: #e5e7eb;
    color: #1f2937;
    text-decoration: none;
}

.fac-btn-checkout {
    background: #10b981;
    color: #ffffff;
}

.fac-btn-checkout:hover {
    background: #059669;
    color: #ffffff;
    text-decoration: none;
}

/* ==========================================================================
   Button Loading States
   ========================================================================== */

.fac-processing,
.fac-processing.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.fac-processing::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: fac-spin 0.8s linear infinite;
}

.single_add_to_cart_button.fac-processing::after,
.add_to_cart_button.fac-processing::after {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    margin-top: 0;
    left: auto;
    top: auto;
    vertical-align: middle;
}

/* Added State */
.add_to_cart_button.added,
.single_add_to_cart_button.added {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.fac-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.fac-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media screen and (max-width: 480px) {
    .fac-notice {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }
    
    .fac-notice-buttons {
        flex-direction: column;
    }
    
    .fac-btn {
        width: 100%;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .fac-notice {
        background: #1f2937;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
    }
    
    .fac-notice-message {
        color: #f9fafb;
    }
    
    .fac-notice-close {
        color: #9ca3af;
    }
    
    .fac-notice-close:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .fac-btn-cart {
        background: #374151;
        color: #f9fafb;
    }
    
    .fac-btn-cart:hover {
        background: #4b5563;
        color: #ffffff;
    }
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[dir="rtl"] .fac-notice {
    right: auto;
    left: 20px;
    transform: translateX(-120%);
    border-left: none;
    border-right-width: 4px;
    border-right-style: solid;
}

[dir="rtl"] .fac-notice.fac-notice-show {
    transform: translateX(0);
}

[dir="rtl"] .fac-notice-success {
    border-right-color: #10b981;
}

[dir="rtl"] .fac-notice-error {
    border-right-color: #ef4444;
}

[dir="rtl"] .fac-notice-warning {
    border-right-color: #f59e0b;
}

[dir="rtl"] .fac-notice-loading {
    border-right-color: #3b82f6;
}

@media screen and (max-width: 480px) {
    [dir="rtl"] .fac-notice {
        left: 10px;
        right: 10px;
    }
}

/* ==========================================================================
   Animation Enhancements
   ========================================================================== */

@keyframes fac-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.fac-notice-error.fac-notice-show {
    animation: fac-shake 0.5s ease-in-out;
}

@keyframes fac-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.add_to_cart_button.added,
.single_add_to_cart_button.added {
    animation: fac-pulse 1s ease-out;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.fac-notice:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.fac-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.fac-notice-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .fac-notice,
    .fac-spinner,
    .fac-processing::after,
    .fac-overlay,
    .add_to_cart_button.added,
    .single_add_to_cart_button.added {
        animation: none;
        transition: none;
    }
}
