/**
 * Free Shipping Progress - Frontend Styles
 * Extends UIKit with custom styling for the free shipping progress bar
 *
 * @package FSP_WC
 */

/* ==========================================================================
   Wrapper
   ========================================================================== */

.fsp-wrapper.fsp-cart-empty {
    opacity: 0.8;
}

.fsp-wrapper.fsp-no-threshold {
    border-color: #ffc107;
    background: #fff9e6;
}

/* ==========================================================================
   Message
   ========================================================================== */

.fsp-message {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 15px;
    text-align: center;
}

.fsp-message strong {
    /*color: #1e87f0;*/
    font-weight: 600;
}

.fsp-message-reached {
    color: #32d296;
    font-weight: 600;
    font-size: 18px;
}

.fsp-message-under {
    color: #333;
}

/* ==========================================================================
   Progress Bar Container
   ========================================================================== */

.fsp-progress-container {
    position: relative;
    margin-bottom: 20px;
}

.fsp-progress-container .uk-progress {
    height: 30px;
    border-radius: 15px;
    background: #f0f0f0;
}

/* Progress bar success state */
.fsp-threshold-reached .uk-progress {
    background: #e8f5e9;
}

.fsp-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 14px;
    color: #333;
    pointer-events: none;
}

/* ==========================================================================
   Products Section
   ========================================================================== */

.fsp-products {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.fsp-products[data-position="top"] {
    margin-top: 0;
    margin-bottom: 30px;
    padding-top: 0;
    padding-bottom: 20px;
    border-top: none;
    border-bottom: 1px solid #e5e5e5;
}

.fsp-products-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

/* Product Card */
.fsp-product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fsp-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.fsp-product-card .uk-card-media-top {
    overflow: hidden;
    background: #f8f8f8;
}

.fsp-product-card .uk-card-media-top img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.fsp-product-card:hover .uk-card-media-top img {
    transform: scale(1.05);
}

.fsp-product-card .uk-card-body {
    padding: 15px;
}

.fsp-product-card .uk-card-title {
    font-size: 16px;
    line-height: 1.3;
    margin-bottom: 8px;
}

.fsp-product-card .uk-card-title a {
    color: #333;
    text-decoration: none;
}

.fsp-product-card .uk-card-title a:hover {
    color: #1e87f0;
}

.fsp-product-price {
    font-size: 18px;
    font-weight: 600;
    color: #1e87f0;
    margin-bottom: 10px;
}

.fsp-add-to-cart {
    text-transform: none;
    font-size: 14px;
    padding: 8px 15px;
}

.fsp-add-to-cart:hover {
    background: #0f7ae5;
}

/* Loading state for add to cart */
.fsp-add-to-cart.loading {
    position: relative;
    color: transparent;
}

.fsp-add-to-cart.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: fsp-spin 0.6s linear infinite;
}

@keyframes fsp-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 959px) {
    .fsp-wrapper {
        padding: 15px;
    }
    
    .fsp-message {
        font-size: 14px;
    }
    
    .fsp-message-reached {
        font-size: 16px;
    }
    
    .fsp-progress-container .uk-progress {
        height: 25px;
    }
    
    .fsp-products-title {
        font-size: 16px;
    }
    
    .fsp-product-card .uk-card-title {
        font-size: 14px;
    }
    
    .fsp-product-price {
        font-size: 16px;
    }
}

@media (max-width: 639px) {
    .fsp-wrapper {
        padding: 10px;
        margin: 15px 0;
    }
    
    .fsp-message {
        font-size: 13px;
    }
    
    .fsp-progress-container .uk-progress {
        height: 20px;
    }
    
    .fsp-progress-text {
        font-size: 12px;
    }
    
    .fsp-products {
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .fsp-product-card .uk-card-body {
        padding: 10px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Fade in animation for threshold reached */
.fsp-threshold-reached .fsp-message-reached {
    animation: fsp-fadeIn 0.5s ease-in;
}

@keyframes fsp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for progress bar when near threshold */
.fsp-wrapper[data-percentage="90"] .uk-progress,
.fsp-wrapper[data-percentage="95"] .uk-progress {
    animation: fsp-pulse 2s ease-in-out infinite;
}

@keyframes fsp-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(30, 135, 240, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(30, 135, 240, 0);
    }
}

/* ==========================================================================
   Debug Mode Styling
   ========================================================================== */

.fsp-wrapper[data-debug="true"]::before {
    content: "DEBUG: " attr(data-detection-method);
    display: block;
    padding: 5px;
    margin-bottom: 10px;
    background: #f0f0f0;
    border: 1px dashed #999;
    font-size: 11px;
    font-family: monospace;
    text-align: center;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .fsp-wrapper {
        border: none;
        box-shadow: none;
    }
    
    .fsp-products {
        display: none;
    }
}

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

/* Focus states */
.fsp-add-to-cart:focus {
    outline: 2px solid #1e87f0;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fsp-wrapper {
        border: 2px solid #000;
    }
    
    .fsp-message strong {
        text-decoration: underline;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fsp-wrapper,
    .fsp-product-card,
    .fsp-product-card .uk-card-media-top img,
    .fsp-threshold-reached .fsp-message-reached {
        animation: none !important;
        transition: none !important;
    }
}
