/**
 * Cart Gift Section Styles
 * Matching Flatsome product card design
 */

.cart-gift-section {
    padding: 20px 15px;
    margin-bottom: 25px;
    color: #ffffff;
    position: relative;
    z-index: 1;
}

/* Full-width background - placed outside container flow */
.cart-gift-section-bg {
    position: fixed;
    left: 0;
    right: 0;
    background: var(--primary-color, #086068);
    z-index: 0;
    pointer-events: none;
}

.gift-section-header {
    margin-bottom: 15px;
    text-align: center;
}

.gift-section-header h3 {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gift-section-header .gift-section-subtitle {
    margin: 6px 0 0;
    font-size: 0.85em;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0;
}

.gift-change-notice {
    background: rgba(255,255,255,0.15);
    padding: 10px 15px;
    margin-bottom: 15px;
    text-align: center;
}

.gift-change-notice p {
    margin: 0;
    color: #fff;
    font-size: 0.9em;
}

/* Product Grid - Equal Heights */
.cart-gift-section .gift-products-grid {
    margin: 0 -10px;
    display: flex;
    flex-wrap: wrap;
}

.cart-gift-section .gift-product {
    padding: 0 10px 20px;
    cursor: pointer;
    margin-bottom: 0;
    display: flex;
}

.cart-gift-section .gift-product .col-inner {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100%;
}

.cart-gift-section .gift-product .product-small.box {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

.cart-gift-section .gift-product .box-image {
    flex-shrink: 0;
    width: 100%;
}

.cart-gift-section .gift-product .box-text {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.cart-gift-section .gift-product .box-text .title-wrapper {
    flex: 1 !important;
}

.cart-gift-section .gift-product .gift-price {
    margin-top: auto !important;
}

.cart-gift-section .gift-product .col-inner,
.cart-gift-section .gift-product .col-inner.box-shadow-1,
.cart-gift-section .gift-product .col-inner.box-shadow-2 {
    background: #ffffff;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none;
    transition: opacity 0.2s ease;
}

.cart-gift-section .gift-product:hover .col-inner {
    opacity: 0.92;
}

.cart-gift-section .gift-product.selected .col-inner {
    box-shadow: 0 0 0 3px #fff;
}

.cart-gift-section .gift-product.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Loading Overlay - persists across page reload */
.cart-gift-section.is-loading .gift-products-grid {
    opacity: 0.4;
    pointer-events: none;
}

.cart-gift-selected-notice.is-loading .gift-text,
.cart-gift-selected-notice.is-loading .change-gift-link {
    opacity: 0.4;
}

.gift-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 96, 104, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: giftFadeIn 0.15s ease;
}

/* Spinner */
.gift-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: giftSpin 0.7s linear infinite;
}

@keyframes giftSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes giftFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Image Box */
.cart-gift-section .gift-product .box-image {
    position: relative;
}

/* Image Wrapper with Placeholder */
.cart-gift-section .gift-image-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
    background: #e8e8e8;
}

.cart-gift-section .gift-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: giftPlaceholderPulse 1.5s ease-in-out infinite;
}

@keyframes giftPlaceholderPulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.cart-gift-section .gift-image-wrapper .image-fade_in {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cart-gift-section .gift-image-wrapper .image-fade_in img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Select Overlay */
.cart-gift-section .gift-select-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.cart-gift-section .gift-product:hover .gift-select-overlay {
    opacity: 1;
    border-color: var(--primary-color, #086068);
}

.cart-gift-section .gift-product.selected .gift-select-overlay {
    background: var(--primary-color, #086068);
    border-color: var(--primary-color, #086068);
    opacity: 1;
}

.cart-gift-section .gift-product.selected .gift-select-overlay::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
    margin-bottom: 2px;
}

/* Product Box Text - Match Flatsome exactly */
.cart-gift-section .gift-product .box-text,
.cart-gift-section .gift-product .product-small .box-text {
    padding: 9.52px 10px 19.04px !important;
    text-align: center;
}

.cart-gift-section .gift-product .product-title,
.cart-gift-section .gift-product .name,
.cart-gift-section .gift-product p.name,
.cart-gift-section .gift-product p.product-title,
.cart-gift-section .gift-product .box-text .name,
.cart-gift-section .gift-product .box-text .product-title {
    font-size: 13.6px !important;
    font-weight: 400 !important;
    color: #575757 !important;
    text-transform: none !important;
    line-height: 1.6 !important;
    margin-bottom: 0 !important;
}

/* Text Above Product */
.cart-gift-section .gift-product .gift-text-above {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 12px;
    font-size: 12px;
    text-align: center;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Custom Description */
.cart-gift-section .gift-product .gift-custom-description,
.cart-gift-section .gift-product p.gift-custom-description {
    color: #777 !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    margin-bottom: 5px;
    font-style: italic;
}

.cart-gift-section .gift-product .variation-name,
.cart-gift-section .gift-product p.variation-name {
    color: #575757 !important;
    margin-bottom: 5px;
    font-size: 12px;
}

.cart-gift-section .gift-product .gift-price,
.cart-gift-section .gift-product p.gift-price {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cart-gift-section .gift-product .gift-price del,
.cart-gift-section .gift-product .gift-price del .woocommerce-Price-amount {
    color: #999 !important;
    font-size: 13.6px !important;
    font-weight: 400 !important;
}

.cart-gift-section .gift-product .free-label {
    background: var(--primary-color, #086068);
    color: #ffffff;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Gift Selected Notice */
.cart-gift-selected-notice {
    padding: 15px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    position: relative;
    z-index: 1;
}

.cart-gift-selected-notice .gift-text {
    flex: 1;
    font-size: 14px;
}

.cart-gift-selected-notice .change-gift-link {
    color: #fff;
    text-decoration: underline;
    font-size: 13px;
}

.cart-gift-selected-notice .change-gift-link:hover {
    opacity: 0.85;
}

/* Cart item modifications */
.gift-badge {
    display: inline-block;
    background: var(--primary-color, #086068);
    color: #fff;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.free-price {
    color: var(--primary-color, #086068);
    font-weight: 700;
}

.gift-quantity {
    display: inline-block;
    width: 40px;
    text-align: center;
    background: #f5f5f5;
    padding: 5px;
}

/* Mobile Responsive */
@media (max-width: 48em) {
    .cart-gift-section {
        padding: 15px 10px;
        margin-bottom: 20px;
    }

    .cart-gift-section .gift-products-grid {
        margin: 0 -5px;
    }

    .cart-gift-section .gift-product {
        padding: 0 5px 15px;
    }

    .cart-gift-section .gift-product .box-text,
    .cart-gift-section .gift-product .product-small .box-text {
        padding: 8px 8px 15px !important;
    }

    .cart-gift-section .gift-product .product-title,
    .cart-gift-section .gift-product .name,
    .cart-gift-section .gift-product p.name,
    .cart-gift-section .gift-product p.product-title {
        font-size: 12px !important;
    }

    .cart-gift-section .gift-product .variation-name,
    .cart-gift-section .gift-product p.variation-name {
        font-size: 11px !important;
    }

    .cart-gift-section .gift-product .gift-price del,
    .cart-gift-section .gift-product .gift-price del .woocommerce-Price-amount {
        font-size: 12px !important;
    }

    .cart-gift-section .gift-product .free-label {
        font-size: 10px;
        padding: 2px 8px;
    }

    .cart-gift-section .gift-select-overlay {
        width: 20px;
        height: 20px;
        top: 5px;
        right: 5px;
    }

    .cart-gift-selected-notice {
        flex-wrap: wrap;
        padding: 12px 15px;
    }

    .cart-gift-selected-notice .change-gift-link {
        width: 100%;
        margin-top: 8px;
        display: block;
    }

    .cart-gift-section .gift-product .gift-text-above {
        padding: 6px 10px;
        font-size: 11px;
    }

    .cart-gift-section .gift-product .gift-custom-description,
    .cart-gift-section .gift-product p.gift-custom-description {
        font-size: 10px !important;
    }
}

/* =================================
   Mobile/Desktop Position Switching
   ================================= */

/* Default: Hide mobile position, show desktop position */
.cart-gift-section.gift-position-mobile,
.cart-gift-selected-notice.gift-position-mobile {
    display: none;
}

.cart-gift-section.gift-position-desktop,
.cart-gift-selected-notice.gift-position-desktop {
    display: block;
}

.cart-gift-selected-notice.gift-position-desktop {
    display: flex;
}

/* Mobile: Show mobile position, hide desktop position */
@media (max-width: 48em) {
    .cart-gift-section.gift-position-mobile,
    .cart-gift-selected-notice.gift-position-mobile {
        display: block;
    }

    .cart-gift-selected-notice.gift-position-mobile {
        display: flex;
    }

    .cart-gift-section.gift-position-desktop,
    .cart-gift-selected-notice.gift-position-desktop {
        display: none !important;
    }
}
