/**
 * Homi Free Shipping – Frontend Badge Styles
 *
 * @package Homi_Free_Shipping
 */

/* =============================================
   Badge Base Styles
   ============================================= */

.hfs-badge {
    display: inline-flex;
    align-items: end;
    gap: 4px;
    padding: 4px 7px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--hfs-badge-color, #ffffff);
    background: var(--hfs-badge-bg, #45bd61);
    border-radius: 4px;
    z-index: 10;
    white-space: nowrap;
}

.hfs-badge__icon {
    font-size: 13px;
    line-height: 1;
}

body .hfs-badge__icon img{
    background: none !important;
    transform: rotateY(-180deg) !important;
}

/* =============================================
   Catalog Badge (Loop)
   ============================================= */

.hfs-badge--catalog {
    position: absolute;
    margin: 0;
}

/* Position variants */
.hfs-badge--top-left {
    top: 8px;
    left: 8px;
}

.hfs-badge--top-right {
    top: 8px;
    right: 8px;
}

.hfs-badge--bottom-left {
    bottom: 8px;
    left: 8px;
}

.hfs-badge--bottom-right {
    bottom: 8px;
    right: 8px;
}

/* =============================================
   Single Product Badge
   ============================================= */

.hfs-badge--single,
.hfs-badge--single-alt {
    display: inline-flex;
    margin: 10px 0;
    font-size: 11px;
    padding: 6px 14px;
    border-radius: 4px;
}

/* Only show one badge on single product page */
.hfs-badge--single {
    display: none;
}

/* Show the alt (after summary) badge */
.hfs-badge--single-alt {
    display: inline-flex;
}

/* =============================================
   Sale badge conflict – push sale badge away
   ============================================= */

.hfs-badge--catalog.hfs-badge--top-left ~ .onsale,
.hfs-badge--top-left + .onsale {
    top: 40px !important;
}

.hfs-badge--catalog.hfs-badge--top-right ~ .onsale {
    /* Sale badge stays in its default position */
}

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

@media (max-width: 480px) {
    .hfs-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .hfs-badge__icon {
        font-size: 11px;
    }

    .hfs-badge--single-alt {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* =============================================
   Cart Notice – Free Shipping Progress
   ============================================= */

.hfs-cart-notice {
    margin:20px 0;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
}

.hfs-cart-notice__content {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.hfs-cart-notice__icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.hfs-cart-notice__text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
}

.hfs-cart-notice__text .woocommerce-Price-amount {
    color: var(--hfs-badge-bg, #45bd61);
    font-weight: 700;
}

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

.hfs-cart-notice__progress-bar {
    width: 100%;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}

.hfs-cart-notice__progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(
        90deg,
        var(--hfs-badge-bg, #45bd61),
        color-mix(in srgb, var(--hfs-badge-bg, #45bd61), white 20%)
    );
    position: relative;
}

.hfs-cart-notice__progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
}

/* =============================================
   Notice States
   ============================================= */

/* Pending – still needs more */
.hfs-cart-notice--pending {
    border-color: #ffd54f;
    background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%);
}

.hfs-cart-notice--pending .hfs-cart-notice__text {
    color: #5d4037;
}

/* Success – qualified for free shipping */
.hfs-cart-notice--success {
    border-color: var(--hfs-badge-bg, #45bd61);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.hfs-cart-notice--success .hfs-cart-notice__text {
    color: #1b5e20;
}

.hfs-cart-notice--success .hfs-cart-notice__progress-fill {
    background: var(--hfs-badge-bg, #45bd61);
}

/* =============================================
   Mini-cart variant
   ============================================= */

.hfs-cart-notice--mini-cart {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 6px;
}

.hfs-cart-notice--mini-cart .hfs-cart-notice__icon {
    font-size: 18px;
}

.hfs-cart-notice--mini-cart .hfs-cart-notice__text {
    font-size: 12px;
}

.hfs-cart-notice--mini-cart .hfs-cart-notice__progress-bar {
    height: 5px;
}

/* =============================================
   Notice Responsive
   ============================================= */

@media (max-width: 480px) {
    .hfs-cart-notice {
        padding: 12px 14px;
    }

    .hfs-cart-notice__content {
        gap: 8px;
        margin-bottom: 8px;
    }

    .hfs-cart-notice__icon {
        font-size: 18px;
    }

    .hfs-cart-notice__text {
        font-size: 13px;
    }

    .hfs-cart-notice__progress-bar {
        height: 6px;
    }
}

/* =============================================
   WPC Fly Cart Integration
   ============================================= */

.hfs-cart-notice--fly-cart {
    margin: 0 16px 12px;
    padding: 12px 14px;
    border-radius: 6px;
    box-sizing: border-box;
}

.hfs-cart-notice--fly-cart .hfs-cart-notice__content {
    gap: 8px;
    margin-bottom: 8px;
}

.hfs-cart-notice--fly-cart .hfs-cart-notice__icon {
    font-size: 18px;
    transform: rotateY(-180deg);
}

.hfs-cart-notice--fly-cart .hfs-cart-notice__text {
    line-height: 1.3;
}

.hfs-cart-notice--fly-cart .hfs-cart-notice__progress-bar {
    height: 6px;
}

/* Ensure contrast on fly cart colored backgrounds */
.woofc-style-01 .hfs-cart-notice--fly-cart,
.woofc-style-03 .hfs-cart-notice--fly-cart,
.woofc-style-05 .hfs-cart-notice--fly-cart {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.woofc-style-01 .hfs-cart-notice--fly-cart.hfs-cart-notice--pending,
.woofc-style-03 .hfs-cart-notice--fly-cart.hfs-cart-notice--pending,
.woofc-style-05 .hfs-cart-notice--fly-cart.hfs-cart-notice--pending {
    background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%);
    border-color: #ffd54f;
}

.woofc-style-01 .hfs-cart-notice--fly-cart.hfs-cart-notice--success,
.woofc-style-03 .hfs-cart-notice--fly-cart.hfs-cart-notice--success,
.woofc-style-05 .hfs-cart-notice--fly-cart.hfs-cart-notice--success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: var(--hfs-badge-bg, #45bd61);
}
