/**
 * freegift
 * Frontend styles
 */

.freegift-progress {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 18px;
    background: #fafafa;
    transition: background-color .25s ease, border-color .25s ease;
}

.freegift-progress--reached {
    background: #ecfdf5;
    border-color: #10b981;
}

.freegift-progress__inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.freegift-progress__image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.freegift-progress__icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.freegift-progress__body {
    flex: 1 1 auto;
    min-width: 0;
}

.freegift-progress__message {
    margin-bottom: 8px;
}

.freegift-progress__title {
    display: block;
    font-size: 0.95rem;
    line-height: 1.3;
    margin-bottom: 2px;
    color: #111827;
}

.freegift-progress--reached .freegift-progress__title {
    color: #047857;
}

.freegift-progress__subtitle {
    display: block;
    font-size: 0.82rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.freegift-progress__bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.freegift-progress__bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #f59e0b, #f97316);
    border-radius: 999px;
    transition: width .4s cubic-bezier(.22, .61, .36, 1);
}

.freegift-progress--reached .freegift-progress__bar-fill {
    background: linear-gradient(90deg, #10b981, #059669);
}

.freegift-progress--pulse {
    animation: freegift-pulse 0.9s ease-out;
}

@keyframes freegift-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
    70%  { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 480px) {
    .freegift-progress {
        padding: 12px 14px;
    }
    .freegift-progress__inner {
        gap: 10px;
    }
    .freegift-progress__image,
    .freegift-progress__icon {
        width: 44px;
        height: 44px;
        font-size: 26px;
    }
    .freegift-progress__title {
        font-size: 0.88rem;
    }
}

.freegift-progress__media {
    flex-shrink: 0;
}

.freegift-progress__icon[hidden] {
    display: none;
}

.freegift-progress__media-link {
    display: block;
    line-height: 0;
}

.freegift-progress__link {
    color: inherit;
    text-decoration: none;
}

.freegift-progress__link:hover,
.freegift-progress__link:focus {
    color: inherit;
    text-decoration: underline;
}

.freegift-progress__media-link:focus-visible,
.freegift-progress__link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* The two insertion points are not padded the same by the theme: on the cart
   page the hook sits directly inside a borderless, unpadded .card — so a margin
   on the block collapses away — while on the checkout page it sits inside a
   .card-block the theme pads with .75rem. Carry the spacing on the wrapper,
   using padding, which never collapses, and stand down where the theme already
   provides it. */
.freegift-container {
    padding: .75rem .75rem 1rem;
}

#js-checkout-summary .freegift-container {
    padding: 0 0 1rem;
}

/* The wrapper stays in the DOM as a refresh target even when the block renders
   nothing, so it must not leave its padding behind. */
.freegift-container:empty {
    padding: 0;
}
