/* =============================================================
 * Woofit – Dárek k objednávce (slim full-width layout)
 *
 * Architektura: section.wfg-gift-box je full-width, uvnitř 3-col flex:
 *   .wfg-box-thumb  (volitelný náhled / obrázek vybrané misky)
 *   .wfg-box-text   (titulek + popis nebo název dárku)
 *   .wfg-box-action (form se selecty + CTA / sekundární link)
 *
 * Brand paleta sjednocená s woofit-utulky-fee a woofit-dynamic-upsells:
 *   #fff8ef bg / #ead8c5 border / #3b1e00 text / #e87016 accent.
 * Fonty Quicksand (UI) + Baloo 2 (text).
 * ============================================================= */

.wfg-gift-box {
    position: relative;
    margin: 16px 0;
    padding: 12px 18px;
    border: 1px solid #ead8c5;
    border-radius: 12px;
    background: #fff8ef;
    color: #3b1e00;
    font-family: "Baloo 2", "Quicksand", sans-serif;
    text-align: left;
    transition: opacity .15s ease;
}

.wfg-gift-box.is-loading {
    opacity: .55;
    pointer-events: none;
}

/* 3-col horizontální layout. Aplikuje se vždy, když je v sekci thumb
 * (selection s adminskou ilustrací, progress s ilustrací, confirmed s obrázkem misky)
 * a vždy v confirmed (tam je product image vždy). */
.wfg-gift-box.wfg-has-thumb,
.wfg-gift-box.wfg-confirmed {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---- Thumbnail (vlevo) ---- */
.wfg-box-thumb {
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    box-sizing: border-box;
    padding: 6px;
    border-radius: 10px;
    background: #fdf3e3;
    border: 1px solid #ead8c5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wfg-box-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Progress = ještě subtilnější (jednořádkový text vedle). */
.wfg-progress .wfg-box-thumb {
    width: 64px;
    height: 64px;
    padding: 4px;
}

/* ---- Text (uprostřed, roste) ---- */
.wfg-box-text {
    flex: 1 1 auto;
    min-width: 220px;
    /* Flatsome u některých témat dědí text-align: center z rodičovského
       .col-inner — vynucujeme zpět left. */
    text-align: left;
}

/* Titulek v selection */
.wfg-gift-box h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 2px;
    font-family: "Quicksand", "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 15.5px;
    line-height: 1.25;
    color: #3b1e00;
}

.wfg-gift-box h2::before {
    content: "🎁";
    font-size: 16px;
    flex-shrink: 0;
}

/* Popis v selection / progress */
.wfg-gift-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #3b1e00;
    opacity: .85;
}

/* Progress / unlocked headline = klíčová informace zákazníka („nakup za X Kč
 * navíc a máš dárek" nebo „máš dopravu zdarma"). Headline-grade typografie,
 * stejná gravitas jako .woofit-utulky-fee-header strong. */
.wfg-headline,
.wfg-progress p,
.wfg-unlocked p {
    font-family: "Quicksand", "Baloo 2", sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: #3b1e00;
    margin: 0 0 8px;
    opacity: 1;
}

/* ---- Progress bar s milestones ---- */
.wfg-progress-bar {
    position: relative;
    height: 10px;
    margin: 8px 0 6px;
    background: rgba(59, 30, 0, .14);
    border-radius: 6px;
    overflow: visible; /* milestones „prosakují" nad/pod baru */
}

.wfg-progress-bar-fill {
    height: 100%;
    /* Zelený gradient = pozitivní progress (dosahuješ odměn). Sjednoceno se
       zelenou v .wfg-rewards-legend-item.is-unlocked a .wfg-side-reward
       badgem — všechno co znamená „máš to" je v téhle tónině. */
    background: linear-gradient(90deg, #1a8a40, #34a853);
    border-radius: 6px;
    transition: width .4s ease;
}

.wfg-progress-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff8ef;
    border: 1.5px solid #ead8c5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    z-index: 1;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.wfg-progress-marker.is-unlocked {
    /* Zelená barvou matchuje fill v .wfg-progress-bar-fill — milestone vypadá
       jako přirozená součást progress fillu, ne odpojený hnědý kruh. */
    background: #1a8a40;
    border-color: #1a8a40;
    transform: translate(-50%, -50%) scale(1.05);
}

/* ---- Rewards legenda (status per odměna) ---- */
.wfg-rewards-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
    font-family: "Quicksand", sans-serif;
    font-size: 12px;
    color: #3b1e00;
}

.wfg-rewards-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.wfg-rewards-legend-item.is-locked {
    opacity: .65;
}

.wfg-rewards-legend-item.is-unlocked .wfg-rewards-legend-status {
    color: #1a8a40;
    font-weight: 700;
}

.wfg-rewards-legend-status {
    font-weight: 700;
    color: #e87016;
}

/* ---- „Side reward" badge (FS unlocked, ukazujeme i v selection/confirmed
 *      stavu jako vedlejší benefit) ---- */
.wfg-side-reward {
    display: inline-block;
    margin-top: 4px;
    font-family: "Quicksand", sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #1a8a40;
    letter-spacing: .02em;
}

/* =============================================================
 * Shortcodes: [woofit_rewards_topbar] a [woofit_rewards_bar]
 * ============================================================= */

/* Server-side render vždy emituje wrapper div (jako slot pro fragment swap),
 * i když je obsah prázdný — typicky: zákazník bez admin role v testovacím
 * režimu, nebo neaktivní reward. Prázdný wrapper by ale ukázal padding/border
 * krémové karty u .woofit-rewards-bar. :empty rule schová wrapper kdykoliv
 * nemá žádný obsah (žádný whitespace dovnitř, server ho rendruje natěsno). */
.woofit-rewards-topbar:empty,
.woofit-rewards-bar:empty,
.woofit-gift-fragment:empty {
    display: none !important;
}

/* Topbar — slim inline text pro hlavičku webu. Dědí color/font z theme
 * topbaru, vlastní pouze typografii a inline-block layout aby šel umístit
 * mezi další obsah v topbar liště (jiné widgety, telefon, sociální atd.). */
.woofit-rewards-topbar {
    display: inline-block;
    font-family: "Quicksand", "Baloo 2", sans-serif;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.3;
}

.woofit-rewards-topbar strong {
    font-weight: 700;
}

/* CTA link „Vybrat dárek" — přilepený za headline v unlocked stavech, když
 * zákazník má nárok na dárek, ale ještě si ho nevybral. Orange accent aby
 * to bylo očividně clickable. Sdílený pro topbar (inline) i bar (v <p>).
 */
.wfg-select-gift-link {
    color: #e87016;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-left: 4px;
    white-space: nowrap;
    transition: color .15s ease;
}

.wfg-select-gift-link:hover,
.wfg-select-gift-link:focus {
    color: #3b1e00;
}

/* Bar — sidebar mini-cart / cart drawer kontext.
 * Žádný box-frame: drawer už má vlastní styling (typicky bílé pozadí, čistá
 * typografie), krémový card s hnědým borderem by tam působil jako cizí
 * element. Sjednoceno s tím, jak fungoval původní [free_shipping_cart]
 * shortcode — jen plain headline + bar + legenda, bez wrapper card. Brand
 * cítění zachované přes color paletu uvnitř (zelený fill, hnědý text). */
.woofit-rewards-bar {
    margin: 14px 0 10px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: #3b1e00;
    font-family: "Baloo 2", "Quicksand", sans-serif;
    text-align: left;
}

.woofit-rewards-bar .wfg-headline {
    font-size: 13.5px;
    line-height: 1.35;
    margin: 0 0 8px;
}

.woofit-rewards-bar .wfg-progress-bar {
    height: 8px;
    margin: 4px 0 6px;
}

.woofit-rewards-bar .wfg-progress-marker {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.woofit-rewards-bar .wfg-rewards-legend {
    font-size: 11px;
    gap: 8px;
    margin-top: 2px;
}

/* Confirmed text bloku */
.wfg-confirmed .wfg-box-text strong {
    display: block;
    font-family: "Quicksand", sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    color: #3b1e00;
    margin-bottom: 2px;
}

.wfg-gift-tag {
    display: inline-block;
    font-family: "Quicksand", sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #e87016;
    letter-spacing: .02em;
}

/* ---- Akční sloupec (vpravo) ----
 * Fixed šířka 240 px na desktopu — nezávislá na obsahu placeholderů.
 * Flatsome a další WC témata často nastavují `width: 100%` na select
 * v cart kontextu, takže bez tohoto constraint by se action nafoukla
 * podle nejdelšího option textu (např. "Nejprve vyberte velikost"
 * → ~600 px wide column). Mobil overrideme na 100% níže.
 */
.wfg-box-action {
    flex-shrink: 0;
    margin-left: auto;
    flex-basis: 240px;
    max-width: 240px;
}

/* ---- Form: inline selects + CTA, žádné visible labely ---- */
.wfg-fields {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.wfg-fields select {
    min-height: 36px;
    padding: 6px 28px 6px 12px;
    border: 1.5px solid #3b1e00;
    border-radius: 4px;
    background: #fff;
    font-family: "Quicksand", sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: #3b1e00;
    min-width: 140px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%233b1e00' d='M6 8 0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 7px;
}

.wfg-fields select:focus-visible {
    outline: 2px solid #e87016;
    outline-offset: 2px;
}

.wfg-fields select:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Primární CTA „Přidat dárek" */
.wfg-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 6px 14px;
    border: 1.5px solid #3b1e00;
    border-radius: 4px;
    background: #3b1e00;
    color: #fff8ef;
    font-family: "Quicksand", sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.wfg-add:hover:not(:disabled) {
    background: #2b1500;
    border-color: #2b1500;
    color: #fff;
}

.wfg-add:focus-visible {
    outline: 2px solid #e87016;
    outline-offset: 2px;
}

.wfg-add:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.wfg-add.loading {
    opacity: .7;
    pointer-events: none;
}

/* Sekundární link „Změnit nebo odebrat" */
.wfg-remove {
    background: none;
    border: 0;
    padding: 0;
    color: #e87016;
    font-family: "Baloo 2", sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color .15s ease;
}

.wfg-remove:hover {
    color: #3b1e00;
}

.wfg-remove:focus-visible {
    outline: 2px solid #e87016;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ---- Cart row dekorace (label u dárkové položky v shop_table) ---- */
.wfg-cart-label {
    display: inline-block;
    margin-top: 2px;
    font-family: "Quicksand", sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .03em;
    color: #e87016;
}

.wfg-fixed-quantity {
    display: inline-block;
    min-width: 2em;
    padding: 4px 10px;
    text-align: center;
    font-family: "Quicksand", sans-serif;
    font-weight: 700;
    color: #3b1e00;
    background: #fdf3e3;
    border: 1px solid #ead8c5;
    border-radius: 4px;
}

/* ---- Responzivní ----
 * Na mobilu necháváme thumb + text v jednom řádku — typický mobil (375 px+)
 * pohodlně pobere thumb 72 px + text vedle. Akční sloupec (form / link)
 * dostane width:100% a přirozeně se zalomí na další řádek díky flex-wrap.
 * Žádné force-stack do centered columny.
 */
@media (max-width: 720px) {
    .wfg-gift-box {
        padding: 12px 14px;
    }

    .wfg-gift-box.wfg-has-thumb,
    .wfg-gift-box.wfg-confirmed {
        gap: 12px;
        align-items: center;
        text-align: left;
    }

    .wfg-box-thumb {
        width: 72px;
        height: 72px;
    }

    .wfg-progress .wfg-box-thumb {
        width: 56px;
        height: 56px;
    }

    .wfg-box-text {
        flex: 1 1 0;
        min-width: 0;
        text-align: left;
    }

    .wfg-gift-box h2 {
        justify-content: flex-start;
        font-size: 14.5px;
    }

    .wfg-progress p {
        /* Hlavička stále headline-grade, ale o píď menší aby se na úzkém
           mobile screen vlezla vedle 56 px thumbnailu na 2-3 řádky. */
        font-size: 15px;
    }

    /* Akce má width:100% → flex-wrap zalomí na další řádek pod thumb+text.
       Desktop max-width: 240px zde overrideme zpět na none. */
    .wfg-box-action {
        flex-basis: auto;
        max-width: none;
        width: 100%;
        margin-left: 0;
    }

    .wfg-fields {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .wfg-fields select,
    .wfg-add {
        width: 100%;
        min-width: 0;
    }
}
