/* Gift With Purchase — selection grid & quick view */

:root {
    --gift-accent: var(--primary-brand-color, var(--primary-color, #c9a227));
    --gift-accent-soft: color-mix(in srgb, var(--gift-accent) 14%, white);
    --gift-accent-strong: color-mix(in srgb, var(--gift-accent) 22%, white);
    --gift-surface: #ffffff;
    --gift-border: rgba(0, 0, 0, 0.08);
    --gift-text-muted: #6b7280;
    --gift-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --gift-shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12);
    --gift-shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.22);
    --gift-radius: 16px;
    --gift-radius-sm: 12px;
}

/* ── Checkout gift section ── */
.gift-selection-section {
    margin-top: 1.5rem;
    padding: 1.35rem 1.35rem 1.5rem;
    border-radius: var(--gift-radius);
    background:
        linear-gradient(135deg, var(--gift-accent-soft) 0%, rgba(255, 255, 255, 0.95) 48%, #fff 100%);
    border: 1px solid color-mix(in srgb, var(--gift-accent) 28%, transparent);
    box-shadow: var(--gift-shadow-sm);
}

.gift-selection-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.gift-selection-header__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--gift-accent);
    color: var(--primary-button-text-color, #fff);
    font-size: 1.15rem;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--gift-accent) 35%, transparent);
}

.gift-selection-title {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary-title-color, #111827);
}

.gift-selection-optional {
    display: inline-block;
    margin-inline-start: 0.35rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gift-text-muted);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--gift-border);
    border-radius: 999px;
    vertical-align: middle;
}

.gift-promotion-hint {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--gift-text-muted);
}

/* ── Gift product cards grid ── */
.gift-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.gift-product-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    border: 1px solid var(--gift-border);
    border-radius: var(--gift-radius-sm);
    cursor: pointer;
    text-align: start;
    background: var(--gift-surface);
    overflow: hidden;
    box-shadow: var(--gift-shadow-sm);
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease;
}

.gift-product-card:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--gift-shadow-md);
    border-color: color-mix(in srgb, var(--gift-accent) 40%, transparent);
}

.gift-product-card.is-selected {
    border-color: var(--gift-accent);
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--gift-accent) 20%, transparent),
        var(--gift-shadow-md);
}

.gift-product-card:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.gift-product-card__media {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
}

.gift-product-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.gift-product-card:hover:not(:disabled) .gift-product-card__media img {
    transform: scale(1.05);
}

.gift-product-card__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: 2rem;
    color: color-mix(in srgb, var(--gift-accent) 55%, #94a3b8);
}

.gift-product-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.gift-product-card__overlay i {
    font-size: 1.1rem;
}

.gift-product-card:hover:not(:disabled) .gift-product-card__overlay {
    opacity: 1;
}

.gift-product-card__check {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--gift-accent);
    color: var(--primary-button-text-color, #fff);
    font-size: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.gift-product-card__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.75rem 0.85rem 0.9rem;
}

.gift-product-name {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--primary-text-color, #1f2937);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gift-product-selected-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gift-accent);
    background: var(--gift-accent-soft);
    border-radius: 999px;
}

/* ── Promotion page gift section ── */
.gift-promo-gift-section {
    padding: 1.35rem;
    border-radius: var(--gift-radius);
    background: #fff;
    border: 1px solid var(--gift-border);
    box-shadow: var(--gift-shadow-sm);
    transition: opacity 0.25s ease;
}

.gift-promo-gift-section.is-locked {
    opacity: 0.55;
    pointer-events: none;
}

.gift-promo-gift-section.is-unlocked {
    opacity: 1;
    pointer-events: auto;
    background:
        linear-gradient(135deg, var(--gift-accent-soft) 0%, rgba(255, 255, 255, 0.95) 48%, #fff 100%);
    border-color: color-mix(in srgb, var(--gift-accent) 28%, transparent);
}

#gift-section .gift-products-grid {
    margin-top: 0.5rem;
}

.gift-promo-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* ── Quick view modal ── */
.gift-quick-view-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    padding: 16px;
}

.gift-quick-view-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-quick-view-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: giftQvFadeIn 0.25s ease;
}

.gift-quick-view-dialog {
    position: relative;
    width: min(940px, 100%);
    max-height: min(92vh, 860px);
    background: var(--gift-surface);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--gift-shadow-lg);
    animation: giftQvSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes giftQvFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes giftQvSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gift-quick-view-close {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #374151;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: transform 0.15s ease, background 0.15s ease;
}

.gift-quick-view-close:hover {
    transform: scale(1.05);
    background: #fff;
}

.gift-quick-view-body {
    max-height: min(92vh, 860px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.gift-quick-view-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 280px;
    padding: 2rem;
    color: var(--gift-text-muted);
    font-size: 0.95rem;
}

.gift-quick-view-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--gift-accent);
    border-radius: 50%;
    animation: giftQvSpin 0.7s linear infinite;
}

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

/* ── Quick view content ── */
.gift-qv-content {
    padding: 1.5rem;
}

.gift-qv-layout {
    display: grid;
    grid-template-columns: minmax(240px, 360px) 1fr;
    gap: 2rem;
    align-items: start;
}

.gift-qv-media-frame {
    position: relative;
    border-radius: var(--gift-radius-sm);
    overflow: hidden;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px var(--gift-border);
}

.gift-qv-badge {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--primary-button-text-color, #fff);
    background: var(--gift-accent);
    border-radius: 999px;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--gift-accent) 40%, transparent);
}

.gift-qv-main-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.gift-qv-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.gift-qv-thumb {
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 2px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
    box-shadow: var(--gift-shadow-sm);
}

.gift-qv-thumb:hover {
    transform: translateY(-1px);
}

.gift-qv-thumb.active {
    border-color: var(--gift-accent);
}

.gift-qv-thumb img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 7px;
    display: block;
}

.gift-qv-category {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gift-text-muted);
    background: #f3f4f6;
    border-radius: 999px;
}

.gift-qv-title {
    margin: 0 0 0.65rem;
    font-size: clamp(1.25rem, 2.5vw, 1.6rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--primary-title-color, #111827);
}

.gift-qv-short-desc {
    margin: 0 0 1.25rem;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--gift-text-muted);
}

.gift-qv-variants-label {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gift-text-muted);
}

.gift-qv-option-group {
    margin-bottom: 1.1rem;
}

.gift-qv-content .size-title {
    margin: 0 0 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-title-color, #374151);
}

.gift-qv-content .size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gift-qv-content .size-btn {
    min-width: 44px;
    padding: 0.55rem 1rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    background: #fff;
    color: var(--primary-text-color, #374151);
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.gift-qv-content .size-btn:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--gift-accent) 50%, #e5e7eb);
}

.gift-qv-content .size-btn.active {
    border-color: var(--gift-accent);
    background: var(--gift-accent);
    color: var(--primary-button-text-color, #fff);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--gift-accent) 35%, transparent);
}

.gift-qv-content .size-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.gift-qv-info-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    font-size: 0.88rem;
    border-bottom: 1px dashed var(--gift-border);
}

.gift-qv-info-label {
    color: var(--gift-text-muted);
}

.gift-qv-info-value {
    font-weight: 600;
}

.gift-qv-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gift-border);
}

.gift-qv-stock {
    min-height: 1.25rem;
    margin: 0 0 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.gift-qv-stock.in-stock {
    color: #059669;
}

.gift-qv-stock.in-stock::before {
    content: '●';
    margin-inline-end: 0.35rem;
}

.gift-qv-stock.out-of-stock {
    color: #dc2626;
}

.gift-qv-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--primary-button-text-color, #fff);
    background: var(--gift-accent);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--gift-accent) 38%, transparent);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
}

.gift-qv-select-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--gift-accent) 45%, transparent);
}

.gift-qv-select-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .gift-selection-section {
        padding: 1rem;
    }

    .gift-selection-header {
        flex-direction: row;
        align-items: center;
    }

    .gift-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .gift-qv-content {
        padding: 1rem;
    }

    .gift-qv-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .gift-quick-view-modal {
        padding: 0;
        align-items: flex-end;
    }

    .gift-quick-view-dialog {
        width: 100%;
        max-height: 94vh;
        border-radius: 20px 20px 0 0;
        animation: giftQvSlideUpMobile 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    }

    @keyframes giftQvSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .gift-qv-footer {
        position: sticky;
        bottom: 0;
        margin-top: 1rem;
        padding: 1rem 0 0.5rem;
        background: linear-gradient(to top, #fff 80%, rgba(255, 255, 255, 0));
    }
}

@media (max-width: 420px) {
    .gift-products-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gift-product-card__overlay span {
        display: none;
    }
}
