/*
 * WorldFood Cotización Flotante
 * Agencia Mesa Marcial
 */

/* Oculta el snippet anterior para evitar dos globos si aún sigue activo. */
#Wf-quote-float,
#wf-quote-float {
    display: none !important;
}

.wfq-app,
.wfq-app * {
    box-sizing: border-box;
}

.wfq-app {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 999991;
    width: 390px;
    max-width: calc(100vw - 44px);
    font-family: "Montserrat", "Plus Jakarta Sans", Arial, sans-serif;
    pointer-events: none;
}

.wfq-trigger,
.wfq-drawer {
    pointer-events: auto;
}

.wfq-trigger[hidden] {
    display: none !important;
}

/* BOTÓN CERRADO */
.wfq-trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 190px;
    min-height: 64px;
    margin: 0;
    padding: 9px 19px 9px 9px;
    color: #fff !important;
    background: #00513f !important;
    border: 1px solid rgba(255, 255, 255, .14) !important;
    border-radius: 999px !important;
    box-shadow: 0 15px 42px rgba(0, 58, 43, .30) !important;
    cursor: pointer;
    appearance: none;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.wfq-trigger:hover,
.wfq-trigger:focus-visible {
    color: #fff !important;
    background: #073f33 !important;
    transform: translateY(-2px);
    box-shadow: 0 19px 48px rgba(0, 58, 43, .36) !important;
    outline: none;
}

.wfq-trigger.is-pulsing {
    animation: wfqPulse .58s ease;
}

.wfq-trigger__icon,
.wfq-heading__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 45px;
    height: 45px;
    color: #00513f;
    background: #fff;
    border-radius: 50%;
}

.wfq-trigger__icon svg,
.wfq-heading__icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wfq-trigger__copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    text-align: left;
    line-height: 1.08;
}

.wfq-trigger__copy > span {
    color: rgba(255, 255, 255, .72);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.wfq-trigger__copy strong {
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.wfq-count {
    position: absolute;
    top: -5px;
    right: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    color: #173321;
    background: #9cc428;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .18);
    font-size: 11px;
    font-weight: 950;
    line-height: 1;
}

/* PANEL */
.wfq-drawer {
    position: absolute;
    left: 0;
    bottom: 78px;
    width: 390px;
    max-width: calc(100vw - 44px);
    overflow: hidden;
    background: #fff;
    border: 1px solid #dfe8d8;
    border-radius: 22px;
    box-shadow: 0 28px 80px rgba(0, 48, 36, .25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(13px) scale(.98);
    transform-origin: left bottom;
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

.wfq-drawer.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.wfq-drawer::after {
    content: "";
    position: absolute;
    left: 27px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-right: 1px solid #dfe8d8;
    border-bottom: 1px solid #dfe8d8;
    transform: rotate(45deg);
}

.wfq-drawer__top {
    position: relative;
    padding: 21px 22px 17px;
    border-bottom: 1px solid #edf1eb;
}

.wfq-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    padding-right: 34px;
}

.wfq-heading__icon {
    width: 49px;
    height: 49px;
    color: #fff;
    background: #00513f;
}

.wfq-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #83a523;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.wfq-heading h2 {
    margin: 0 !important;
    color: #00513f !important;
    font-size: 19px !important;
    font-weight: 950 !important;
    line-height: 1.12 !important;
    letter-spacing: -.02em;
}

.wfq-heading p {
    margin: 4px 0 0 !important;
    color: #6c786f;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
}

.wfq-close {
    position: absolute;
    top: 13px;
    right: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 31px;
    margin: 0;
    padding: 0;
    color: #66756d !important;
    background: #f1f5ef !important;
    border: 0 !important;
    border-radius: 50% !important;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

/* LISTADO */
.wfq-items {
    max-height: min(390px, 48vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 7px 20px;
    scrollbar-width: thin;
    scrollbar-color: #c8d4ca transparent;
}

.wfq-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid #edf1eb;
}

.wfq-item:last-child {
    border-bottom: 0;
}

.wfq-item.is-new {
    animation: wfqNewItem 1.25s ease;
}

.wfq-item__image-link {
    display: block;
    width: 58px;
    height: 58px;
    padding: 5px;
    overflow: hidden;
    background: #f6f9f3;
    border: 1px solid #e7ede3;
    border-radius: 13px;
}

.wfq-item__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wfq-item__content {
    min-width: 0;
}

.wfq-item__name {
    display: -webkit-box;
    overflow: hidden;
    color: #173321 !important;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.32;
    text-decoration: none !important;
    text-transform: uppercase;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.wfq-item__name:hover {
    color: #00513f !important;
}

.wfq-item__details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.wfq-detail {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 25px;
    padding: 4px 9px;
    color: #53645a;
    background: #f4f8ef;
    border: 1px solid #e1eadb;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.wfq-detail strong {
    color: #00513f;
    font-size: 11px;
    font-weight: 950;
}

.wfq-item__without-detail {
    display: block;
    margin-top: 6px;
    color: #7a867e;
    font-size: 10px;
    font-weight: 650;
}

/* PIE */
.wfq-drawer__footer {
    padding: 15px 20px 19px;
    background: #fbfcfa;
    border-top: 1px solid #edf1eb;
}

.wfq-review {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 13px 17px;
    color: #fff !important;
    background: #00513f !important;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    text-decoration: none !important;
    transition: transform .2s ease, background .2s ease;
}

.wfq-review:hover {
    color: #fff !important;
    background: #073f33 !important;
    transform: translateY(-1px);
}

/* TOAST */
.wfq-toast {
    position: absolute;
    left: 0;
    bottom: 78px;
    width: max-content;
    max-width: 330px;
    padding: 12px 16px;
    color: #fff;
    background: #173321;
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .2);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
    pointer-events: none;
}

.wfq-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wfq-app.is-drawer-open .wfq-toast {
    bottom: auto;
    top: -52px;
}

@keyframes wfqPulse {
    0%, 100% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-3px) scale(1.045); }
}

@keyframes wfqNewItem {
    0% { background: rgba(156, 196, 40, .22); }
    100% { background: transparent; }
}

@media (max-width: 767px) {
    .wfq-app {
        left: 14px;
        bottom: 14px;
        width: calc(100vw - 28px);
        max-width: none;
    }

    .wfq-trigger {
        min-width: 0;
        min-height: 58px;
        padding: 7px 16px 7px 7px;
    }

    .wfq-trigger__icon {
        width: 42px;
        height: 42px;
    }

    .wfq-drawer {
        bottom: 72px;
        width: 100%;
        max-width: none;
        border-radius: 19px;
    }

    .wfq-items {
        max-height: 43vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wfq-trigger,
    .wfq-drawer,
    .wfq-toast,
    .wfq-item {
        transition: none;
        animation: none !important;
    }
}

/* ESTADO VACÍO: el globo permanece siempre visible */
.wfq-app.is-empty .wfq-count {
    color: #5f6f65;
    background: #eef3eb;
    border-color: #fff;
}

.wfq-app.is-empty .wfq-trigger {
    background: #00513f !important;
}

.wfq-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 28px 24px;
    text-align: center;
}

.wfq-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 13px;
    color: #00513f;
    background: #f1f7ed;
    border: 1px solid #e0eadb;
    border-radius: 50%;
}

.wfq-empty__icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wfq-empty strong {
    color: #173321;
    font-size: 14px;
    font-weight: 900;
}

.wfq-empty > span:last-child {
    max-width: 245px;
    margin-top: 7px;
    color: #6d7b72;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.55;
}

/* Producto mostrado inmediatamente mientras YITH confirma el AJAX */
.wfq-item.is-pending {
    opacity: .82;
}

.wfq-item.is-pending .wfq-item__image {
    filter: saturate(.75);
}

.wfq-item__pending-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    color: #7a8b80;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.wfq-item__pending-label::before {
    content: "";
    width: 9px;
    height: 9px;
    border: 2px solid #d6e1d2;
    border-top-color: #83a523;
    border-radius: 50%;
    animation: wfqSpin .75s linear infinite;
}

@keyframes wfqSpin {
    to { transform: rotate(360deg); }
}
