

/* ── Reorder gift section: heading always on top ── */
.woocommerce-cart-form {
    display: flex !important;
    flex-direction: column !important;
}
.woocommerce-cart-form .shop_table { order: 1; }
.woocommerce-cart-form .ifmcg-overlay-wrap { order: 2; }
.woocommerce-cart-form .adv-gift-section { order: 3; }

/* ── Availability note ── */
.ifmcg-overlay-terms.ifmcg-inside {
    display: block !important;
    font-size: 12px !important;
    color: #888 !important;
    margin: 4px 0 10px !important;
    font-style: italic !important;
    border-left: 3px solid #c8a96e !important;
    padding-left: 8px !important;
    background: #fffdf8 !important;
    border-radius: 0 4px 4px 0 !important;
    line-height: 1.5 !important;
}

/* ── Selected gift card ── */
.wgb-product-item-cnt.ifmcg-gift-sel {
    border: 2px solid #c8a96e !important;
    border-radius: 10px !important;
    background: #fffaf3 !important;
    position: relative !important;
    box-shadow: 0 4px 16px rgba(200,169,110,.2) !important;
}
/* Gold checkmark badge top-right */
.wgb-product-item-cnt.ifmcg-gift-sel::before {
    content: '' !important;
    position: absolute !important;
    top: 8px !important; right: 10px !important;
    width: 22px !important; height: 22px !important;
    border-radius: 50% !important;
    z-index: 10 !important;
    background-color: #c8a96e !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") !important;
    background-size: 14px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    display: block !important;
}

/* ── Dim non-selected when a gift is active ── */
.wgb-grid-cnt.ifmcg-sel-active .wgb-product-item-cnt:not(.ifmcg-gift-sel),
.adv-gift-section.ifmcg-sel-active .wgb-product-item-cnt:not(.ifmcg-gift-sel) {
    opacity: 0.45 !important;
    transition: opacity .25s !important;
}
.wgb-grid-cnt.ifmcg-sel-active .wgb-product-item-cnt:not(.ifmcg-gift-sel):hover,
.adv-gift-section.ifmcg-sel-active .wgb-product-item-cnt:not(.ifmcg-gift-sel):hover {
    opacity: 0.85 !important;
}
/* Swap mode: restore full opacity */
.wgb-grid-cnt.ifmcg-swap-mode .wgb-product-item-cnt,
.adv-gift-section.ifmcg-swap-mode .wgb-product-item-cnt {
    opacity: 1 !important;
}
.adv-gift-section.ifmcg-swap-mode {
    outline: 2px dashed #c8a96e !important;
    outline-offset: 4px !important;
    border-radius: 8px !important;
}

/* ── Your Gift panel ── */
#ifmcg-gp {
    display: none;
    margin: 18px 0 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #c8a96e;
    box-shadow: 0 2px 12px rgba(200,169,110,.12);
}
#ifmcg-gp.vis { display: block !important; }
#ifmcg-gp .gp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #c8a96e;
    color: #fff;
    padding: 9px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
#ifmcg-gp .gp-header svg { width: 14px; height: 14px; fill: #fff; flex-shrink: 0; }
#ifmcg-gp .gp-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fffaf3 0%, #fdf4e3 100%);
    flex-wrap: wrap;
}
#ifmcg-gp .gp-img-wrap {
    flex-shrink: 0;
    width: 72px; height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8d5b0;
    background: #fff;
}
#ifmcg-gp .gp-img-wrap img {
    width: 100% !important; height: 100% !important;
    object-fit: cover !important; display: block !important;
}
#ifmcg-gp .gp-info { flex: 1; min-width: 120px; }
#ifmcg-gp .gp-lbl {
    font-size: 10px; color: #999;
    text-transform: uppercase; letter-spacing: .8px;
    font-weight: 600; margin-bottom: 3px;
}
#ifmcg-gp .gp-nm { font-size: 16px; font-weight: 700; color: #2a2a2a; line-height: 1.3; }
#ifmcg-gp .gp-free {
    display: inline-block; background: #edf7ed; color: #2d7a2d;
    font-size: 10px; font-weight: 700; padding: 1px 7px;
    border-radius: 20px; margin-top: 4px; letter-spacing: .4px;
}
#ifmcg-gp .gp-action { flex-shrink: 0; }
#ifmcg-gp .gp-sw {
    background: transparent; color: #c8a96e;
    border: 1.5px solid #c8a96e; border-radius: 6px;
    padding: 7px 16px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .2s, color .2s; white-space: nowrap;
}
#ifmcg-gp .gp-sw:hover { background: #c8a96e; color: #fff; }
#ifmcg-gp .gp-sw.cancel-mode { background: #f9f0e2; color: #9a7a3e; border-color: #d4b57e; }
#ifmcg-gp-hint {
    display: none; background: #fffdf6; border-top: 1px solid #f0e0c0;
    padding: 8px 18px; font-size: 12px; color: #a07840;
    font-style: italic; text-align: center;
}
#ifmcg-gp-hint.vis { display: block !important; }

/* ── Force single-row layout: prevent WGB grid from wrapping to 2 rows ── */
.wgb-grid-cnt { overflow: hidden !important; }
.wgb-grid-cnt .wgb-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: hidden !important;
}
.wgb-grid-cnt .wgb-row > [class*="wgb-col"] {
    flex-shrink: 0 !important;
}
.adv-gift-section .wgb-add-gift-btn { white-space: nowrap !important; }
