/**
 * Stili per il frontend di Free Shipping Bar Pro
 */

/* Variabili CSS */
.fsbp-bar-wrapper {
    --fsbp-progress-color: #4CAF50;
    --fsbp-background-color: #e0e0e0;
    --fsbp-text-color: #333333;
    --fsbp-success-color: #4CAF50;
}

/* Base Wrapper */
.fsbp-bar-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.fsbp-content {
    text-align: center;
}

/* Message */
.fsbp-message {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 500;
    color: var(--fsbp-text-color);
    line-height: 1.5;
}

.fsbp-message .woocommerce-Price-amount {
    font-weight: 700;
    color: var(--fsbp-progress-color);
}

/* Progress Bar */
.fsbp-progress-bar {
    height: 12px;
    background: var(--fsbp-background-color);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.fsbp-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--fsbp-progress-color), color-mix(in srgb, var(--fsbp-progress-color) 80%, white));
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

/* Stile 1: Classico */
.fsbp-style1 .fsbp-progress-bar {
    border-radius: 4px;
}

.fsbp-style1 .fsbp-progress {
    border-radius: 4px;
}

/* Stile 2: Arrotondato */
.fsbp-style2 .fsbp-progress-bar {
    height: 16px;
    border-radius: 10px;
}

.fsbp-style2 .fsbp-progress {
    border-radius: 10px;
}

/* Stile 3: Sottile */
.fsbp-style3 .fsbp-progress-bar {
    height: 6px;
    border-radius: 3px;
}

.fsbp-style3 .fsbp-progress {
    border-radius: 3px;
}

/* Stile 4: Striped */
.fsbp-style4 .fsbp-progress {
    background: var(--fsbp-progress-color);
    position: relative;
    overflow: hidden;
}

.fsbp-style4 .fsbp-stripes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.2) 10px,
        rgba(255, 255, 255, 0.2) 20px
    );
    animation: fsbp-stripes 1s linear infinite;
}

@keyframes fsbp-stripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 28px 0;
    }
}

/* Animazioni */
.fsbp-animated .fsbp-progress {
    animation: fsbp-pulse 2s ease-in-out infinite;
}

.fsbp-animated.fsbp-reached .fsbp-progress {
    animation: fsbp-celebrate 0.5s ease-out;
}

@keyframes fsbp-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

@keyframes fsbp-celebrate {
    0% {
        transform: scaleX(0.95);
    }
    50% {
        transform: scaleX(1.02);
    }
    100% {
        transform: scaleX(1);
    }
}

/* Stato: Raggiunto */
.fsbp-reached .fsbp-progress-bar {
    background: color-mix(in srgb, var(--fsbp-success-color) 20%, white);
}

.fsbp-reached .fsbp-progress {
    background: var(--fsbp-success-color);
    width: 100% !important;
}

.fsbp-reached .fsbp-message {
    color: var(--fsbp-success-color);
}

/* Barra Fissa */
.fsbp-fixed-container {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.fsbp-fixed-container.fsbp-fixed-top {
    top: 0;
}

.fsbp-fixed-container.fsbp-fixed-bottom {
    bottom: 0;
}

.fsbp-fixed-container .fsbp-bar-wrapper {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 15px 20px;
}

.fsbp-fixed-container .fsbp-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.fsbp-fixed-container .fsbp-message {
    margin: 0;
    flex-shrink: 0;
    font-size: 14px;
}

.fsbp-fixed-container .fsbp-progress-bar {
    flex-grow: 1;
    height: 10px;
}

/* Mini Cart */
.fsbp-context-mini-cart {
    margin: 10px 0;
    padding: 12px;
    border-radius: 4px;
}

.fsbp-context-mini-cart .fsbp-message {
    font-size: 13px;
    margin-bottom: 10px;
}

.fsbp-context-mini-cart .fsbp-progress-bar {
    height: 8px;
}

/* Shop e Product */
.fsbp-context-shop,
.fsbp-context-product {
    margin-bottom: 25px;
}

/* Checkout */
.fsbp-context-checkout {
    margin-bottom: 30px;
}

/* Nascosto */
.fsbp-bar-wrapper.fsbp-hidden {
    display: none;
}

/* Loading state */
.fsbp-bar-wrapper.fsbp-loading {
    opacity: 0.6;
    pointer-events: none;
}

.fsbp-bar-wrapper.fsbp-loading .fsbp-progress {
    animation: fsbp-loading 1.5s ease-in-out infinite;
}

@keyframes fsbp-loading {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .fsbp-bar-wrapper {
        padding: 15px;
        margin: 15px 0;
    }
    
    .fsbp-message {
        font-size: 14px;
    }
    
    .fsbp-progress-bar {
        height: 10px;
    }
    
    .fsbp-fixed-container .fsbp-content {
        flex-direction: column;
        gap: 10px;
        padding: 0 15px;
    }
    
    .fsbp-fixed-container .fsbp-progress-bar {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .fsbp-bar-wrapper {
        padding: 12px;
    }
    
    .fsbp-message {
        font-size: 13px;
    }
    
    .fsbp-progress-bar {
        height: 8px;
    }
}

/* WooCommerce Blocks Compatibility */
.wp-block-woocommerce-cart .fsbp-bar-wrapper,
.wp-block-woocommerce-checkout .fsbp-bar-wrapper {
    margin: 20px 0;
}

/* Transizioni per aggiornamento AJAX */
.fsbp-bar-wrapper.fsbp-updating {
    transition: all 0.3s ease;
}

.fsbp-bar-wrapper.fsbp-updating .fsbp-progress {
    transition: width 0.5s ease-out;
}

/* Print styles - nasconde la barra nella stampa */
@media print {
    .fsbp-bar-wrapper,
    .fsbp-fixed-container {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fsbp-bar-wrapper {
        border: 2px solid currentColor;
    }
    
    .fsbp-progress-bar {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fsbp-progress,
    .fsbp-bar-wrapper,
    .fsbp-stripes {
        animation: none !important;
        transition: none !important;
    }
}
