/* =====================================================
   WC Free Gift Plugin v2.0 — Frontend Styles
   Dual Tier: Tier 1 (silver/purple) & Tier 2 (gold)
   ===================================================== */

/* ─── Variables ─────────────────────────────────────── */
:root {
    --wcf-primary:    #7c3aed;
    --wcf-primary-l:  #ede9fe;
    --wcf-green:      #16a34a;
    --wcf-green-l:    #dcfce7;
    --wcf-orange:     #ea580c;
    --wcf-orange-l:   #fff7ed;
    --wcf-gold:       #d97706;
    --wcf-gold-l:     #fef3c7;
    --wcf-tier2:      #b45309;
    --wcf-tier2-l:    #fffbeb;
    --wcf-radius:     16px;
    --wcf-shadow:     0 4px 24px rgba(124,58,237,.12);
    --wcf-shadow-t2:  0 4px 24px rgba(217,119,6,.18);
    --wcf-transition: all .25s cubic-bezier(.4,0,.2,1);
}

/* ─── Section Wrapper ──────────────────────────────── */
#wcf-gift-section {
    margin: 28px 0;
    font-family: inherit;
}

/* ─── Promo Bar (not qualified) ──────────────────── */
.wcf-promo-bar {
    background: linear-gradient(135deg, var(--wcf-orange-l), #fef3c7);
    border: 1.5px solid #fed7aa;
    border-radius: var(--wcf-radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.wcf-promo-icon  { font-size: 28px; flex-shrink: 0; }
.wcf-promo-content { flex: 1; }
.wcf-promo-title {
    font-weight: 700;
    font-size: 15px;
    color: #9a3412;
    margin: 0 0 6px;
}
.wcf-progress-wrap {
    background: #fed7aa;
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
}
.wcf-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--wcf-orange), var(--wcf-gold));
    border-radius: 99px;
    transition: width .5s ease;
}
.wcf-progress-text {
    font-size: 12px;
    color: #c2410c;
    margin: 5px 0 0;
}

/* ─── Tier Upgrade Bar (at tier1, teasing tier2) ─── */
.wcf-tier-upgrade-bar {
    background: linear-gradient(135deg, var(--wcf-gold-l), #fef9ee);
    border: 1.5px dashed var(--wcf-gold);
    border-radius: 10px;
    padding: 10px 16px;
    margin: 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.wcf-upgrade-icon { font-size: 18px; flex-shrink: 0; }
.wcf-upgrade-content { flex: 1; }
.wcf-upgrade-content p {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin: 0 0 5px;
}
.wcf-tier-upgrade-bar .wcf-progress-wrap {
    background: #fde68a;
}
.wcf-tier-upgrade-bar .wcf-progress-bar,
.wcf-progress-bar.tier2-bar {
    background: linear-gradient(90deg, var(--wcf-gold), #f59e0b);
}

/* ─── Gift Box — Tier 1 (Purple/Silver) ─────────── */
.wcf-gift-box {
    background: #fff;
    border: 2px solid var(--wcf-primary);
    border-radius: var(--wcf-radius);
    overflow: hidden;
    box-shadow: var(--wcf-shadow);
    animation: wcfSlideIn .4s ease;
}
.wcf-gift-box.tier1 {
    border-color: var(--wcf-primary);
    box-shadow: var(--wcf-shadow);
}

/* ─── Gift Box — Tier 2 (Gold) ──────────────────── */
.wcf-gift-box.tier2 {
    border-color: var(--wcf-gold);
    box-shadow: var(--wcf-shadow-t2);
}

@keyframes wcfSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Gift Header ────────────────────────────────── */
.wcf-gift-header {
    background: linear-gradient(135deg, var(--wcf-primary), #5b21b6);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.wcf-gift-box.tier2 .wcf-gift-header {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.wcf-gift-header-icon { font-size: 28px; }
.wcf-gift-header-text h3 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #fff !important;
    border: none;
    padding: 0;
}
.wcf-gift-header-text p {
    margin: 3px 0 0 !important;
    font-size: 13px;
    opacity: .85;
    color: #fff;
}
.wcf-badge-free {
    margin-left: auto;
    background: #fbbf24;
    color: #78350f;
    font-weight: 800;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 99px;
    letter-spacing: .5px;
    white-space: nowrap;
}
.wcf-gift-box.tier2 .wcf-badge-free {
    background: #fff;
    color: #92400e;
}

.wcf-gift-body { padding: 20px; }

/* ─── Selected Banner ─────────────────────────── */
.wcf-selected-banner {
    background: var(--wcf-green-l);
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--wcf-green);
    font-weight: 600;
}
.wcf-selected-banner .wcf-change-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--wcf-green);
    color: var(--wcf-green);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--wcf-transition);
}
.wcf-selected-banner .wcf-change-btn:hover {
    background: var(--wcf-green);
    color: #fff;
}

/* ─── Product Grid ──────────────────────────────── */
.wcf-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.wcf-product-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--wcf-transition);
    background: #fafafa;
    position: relative;
}
.wcf-product-card:hover {
    border-color: var(--wcf-primary);
    box-shadow: 0 4px 16px rgba(124,58,237,.15);
    transform: translateY(-2px);
}
.wcf-gift-box.tier2 .wcf-product-card:hover {
    border-color: var(--wcf-gold);
    box-shadow: 0 4px 16px rgba(217,119,6,.2);
}
.wcf-product-card.selected {
    border-color: var(--wcf-primary);
    background: var(--wcf-primary-l);
    box-shadow: 0 0 0 3px rgba(124,58,237,.2);
}
.wcf-gift-box.tier2 .wcf-product-card.selected {
    border-color: var(--wcf-gold);
    background: var(--wcf-gold-l);
    box-shadow: 0 0 0 3px rgba(217,119,6,.2);
}
.wcf-product-card .wcf-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--wcf-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: var(--wcf-transition);
    color: #fff;
    font-size: 13px;
}
.wcf-product-card.selected .wcf-check {
    opacity: 1;
    transform: scale(1);
}
.wcf-gift-box.tier2 .wcf-product-card .wcf-check {
    background: var(--wcf-gold);
}

.wcf-product-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.wcf-product-info {
    padding: 8px 10px;
    text-align: center;
}
.wcf-product-name {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wcf-product-orig-price {
    font-size: 11px;
    color: #9ca3af;
    text-decoration: line-through;
}
.wcf-free-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--wcf-green);
    background: var(--wcf-green-l);
    padding: 2px 8px;
    border-radius: 99px;
    display: inline-block;
    margin-top: 2px;
}

/* ─── Cart Free Gift Item ─────────────────────── */
.wcf-free-label {
    background: var(--wcf-green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: .3px;
}
.wcf-cart-gift-tag {
    background: var(--wcf-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: .3px;
}

/* ─── Thank You page ─────────────────────────── */
.wcf-thankyou-gift {
    background: var(--wcf-green-l) !important;
    border-left: 4px solid var(--wcf-green) !important;
    color: #166534 !important;
    font-size: 15px;
    padding: 14px 18px !important;
    border-radius: 8px !important;
    margin: 16px 0 !important;
}

/* ─── Blocks Cart Integration ─────────────────── */
.wcf-blocks-injected { padding: 0 0 16px; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 480px) {
    .wcf-products-grid  { grid-template-columns: repeat(2, 1fr); }
    .wcf-gift-header    { padding: 14px 16px; }
    .wcf-gift-body      { padding: 14px 16px; }
    .wcf-tier-upgrade-bar { margin: 0 14px 0; }
}
