/* Promo Campaigns Frontend Styles */

/* Campaign Reward Module */
.campaign-reward-module {
    background: #fff;
    margin-bottom: 20px;
}

.campaign-reward-module__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin: 20px 0;
}

.campaign-reward-module__banner {
    flex: 1;
    min-width: 200px;
}

.campaign-reward-module__banner img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.campaign-reward-module__title {
    font-size: 32px;
    font-weight: 600;
    color: #f44336;
    margin: 0;
    line-height: 1.2;
}

.campaign-reward-module__description {
    font-size: 16px;
    color: #583510;
    margin: 10px 0;
    line-height: 1.5;
}

.campaign-reward-module__remaining-time {
    display: flex;
    flex-direction: row;
    font-size: 20px;
    font-weight: 500;
    color: #5b400f;
    line-height: 1.5;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.campaign-reward-module__remaining-time__countdown {
    font-weight: 600;
    color: #FE9F3A;
}

/* Select Free Product */
.select-free-product-wrapper {
    display: block;
    font-size: 22px;
    font-weight: 400;
    line-height: 1.5;
}

.select-free-product-wrapper strong {
    font-weight: 600;
}

.select-free-product-button-wrapper>div {
    display: flex;
    align-items: center;
    gap: 10px;
}

#open-free-product-selection {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

#open-free-product-selection:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.selected-free-product {
    /* display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; */
    font-size: 16px;
    display: block;
    margin: 0;
    text-align: center;
}

.selected-free-product strong {
    font-weight: 600;
    color: #FE9F3A;
}

.selected-free-product .select-free-product-available {
    color: #FE9F3A;
}

.selected-workshop-price {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.free-price {
    color: #2ecc71;
}

.discounted-price {
    color: #f31d12;
}

/* Campaign Reward Selection Popup */
.campaign-reward-selection-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999999;
    overflow-y: auto;
}

.campaign-reward-selection-popup__overlay {
    position: relative;
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.campaign-reward-selection-popup__close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.campaign-reward-selection-popup__close-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.campaign-reward-selection-popup .campaign-reward-module {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.campaign-reward-selection-popup .campaign-reward-module__title {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: 0;
}

.campaign-reward-selection-popup .campaign-reward-module__description {
    text-align: center;
    padding: 15px 20px;
    margin: 0;
}

.campaign-reward-selection {
    container-type: inline-size;
    container-name: campaign-reward-selection;
}

.campaign-reward-selection .campaign-reward-module__description {
    text-align: left;
    padding: 0;
    margin: 0;
    font-size: 20px;
    font-weight: 400;
    color: #583510;
    line-height: 1.4;
}

/* Reward Selection Counter */
.promo-temp-cart {
    text-align: left;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #f39c12;
    margin: 0;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    width: fit-content;
    border: 1px solid #f39c12;
}

/* Reward List */
.reward-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
}

/* Reward Item Card */
.reward-item-card {
    background: #fff4e8;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 0;
}

.reward-item-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #FE9F3A;
}

.reward-item-card--selected {
    border-color: #FE9F3A;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.reward-item-card--out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
}

.reward-item-card--out-of-stock:hover {
    transform: none;
    box-shadow: none;
}

.reward-item-card__image {
    width: 100%;
    height: 170px;
    flex-basis: 40%;
}

.reward-item-card__image img,
.woocommerce .reward-item-card__image img,
.woocommerce-page .reward-item-card__image img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    line-height: 0;
}

.reward-item-card__content {
    padding: 15px;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    text-align: left;
}

.reward-item-card__title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    color: #583510;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reward-item-card__price {
    display: flex;
    align-items: center;
    gap: 8px;
    /* margin-bottom: 15px; */
    flex: 1;
}

.reward-item-card__price--original {
    text-decoration: line-through;
    color: #8e571d;
    font-size: 16px;
}

.reward-item-card__price--current {
    font-size: 16px;
    font-weight: 600;
    color: #f44336;
}

.reward-item-card__footer {
    margin: auto 0 0;
    display: flex;
    gap: 12px;
    box-sizing: border-box;
    flex-direction: row;
    justify-content: center;
    align-self: center;
}

.reward-item-card__button,
.reward-item-card__minus,
.reward-item-card__plus {
    width: 100%;
    padding: 10px;
    background: #ffffff;
    color: #fe9f3a;
    border: none;
    border-radius: 32px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reward-item-card__button:hover,
.reward-item-card__minus:hover,
.reward-item-card__plus:hover {
    background: #9c63261a;
}

.reward-item-card__button:disabled,
.reward-item-card__minus:disabled,
.reward-item-card__plus:disabled {
    background: white;
    cursor: not-allowed;
    transform: none;
    opacity: .5;
}

.reward-item-card__button:disabled:hover,
.reward-item-card__minus:disabled:hover,
.reward-item-card__plus:disabled:hover {
    background: white;
    transform: none;
}

.reward-item-card__minus,
.reward-item-card__plus {
    height: 42px;
    width: 42px;
    padding: 0;
    display: flex;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
}

.reward-item-card__quantity {
    font-size: 18px;
    font-weight: 600;
    color: #583510;
    min-width: 60px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Quantity Controls */
.reward-quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.quantity-btn {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    background: #005a87;
    transform: scale(1.1);
}

.quantity-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.quantity-btn--plus {
    background: #28a745;
}

.quantity-btn--plus:hover {
    background: #218838;
}

.quantity-btn--minus {
    background: #dc3545;
}

.quantity-btn--minus:hover {
    background: #c82333;
}

.quantity-display {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    min-width: 30px;
    text-align: center;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
}

/* Availability Status */
.availability-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.availability-status.available {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.availability-status.full {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.availability-count {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Messages */
.campaign-reward-module .message {
    /* hide on default */
    display: none;
}

.campaign-reward-module .message__text {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

.campaign-reward-module .message__text--success {
    color: #155724;
    display: block;
}

.campaign-reward-module .message__text--error {
    color: #721c24;
    display: block;
}

.campaign-reward-module .message__text--warning {
    color: #856404;
    display: block;
}

.campaign-reward-module .splide__arrow--prev {
    left: -1.5rem;
}

.campaign-reward-module .splide__arrow--next {
    right: -1.5rem;
}

.campaign-reward-module .splide__arrow {
    /* background: #fff6ed; */
    background-color: #ffac55;
    opacity: 1;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    outline: none;
    border: 1px solid white;
    box-shadow: 4px 2px 12px 0 #d4d4d4;
}

.campaign-reward-module .splide__arrow svg {
    /* fill: #fe9f3a; */
    fill: white;
}

.campaign-reward-module .splide__pagination {
    bottom: -1rem;
    padding: 0;
}

.campaign-reward-module .splide__pagination__page.is-active {
    background: #ffdcb6;
}

/* Campaign Footer */
.campaign-reward-module__footer {
    padding: 40px 20px 20px;
    box-sizing: border-box;
    background: transparent;
    text-align: center;
}

.campaign-reward-module__button {
    padding: 12px 24px;
    border: none;
    border-radius: 32px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.campaign-reward-module__button--primary {
    background: linear-gradient(131deg, #ffd18a 0%, #fffaea 100%);
    color: #2c1b08;
    min-width: 120px;
}

.campaign-reward-module__button--primary:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* [071325TIN] Add disabled state */
.campaign-reward-module__button:disabled,
.campaign-reward-module__button:disabled:hover,
.campaign-reward-module__button--primary:disabled,
.campaign-reward-module__button--primary:disabled:hover {
    opacity: .9;
    box-shadow: none;
    background: #3333;
    color: #202020;
    cursor: not-allowed;
}

.campaign-reward-module__button.loading {
    pointer-events: none;
    opacity: 0.7;
    width: fit-content;
}

.campaign-reward-module__button.loading svg {
    display: none;
}

.campaign-reward-module__button.loading .loading-indicator {
    display: block;
    animation: spin 1s linear infinite;
}

.loading-indicator {
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Promo Reward Confirmation */
.promo-reward-confirmation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.promo-reward-confirmation h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: white;
}

.promo-reward-confirmation p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.promo-reward-confirmation .reward-details {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

/* Masked Coupon Display */
.promo-coupon-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    flex-wrap: wrap;
}

.promo-coupon-label {
    font-weight: 600;
}

.promo-coupon-code {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.promo-coupon-discount {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* .campaign-reward-module__header {
        flex-direction: column;
        text-align: center;
    } */

    .campaign-reward-module__remaining-time {
        align-items: center;
    }

    .select-free-product-button-wrapper {
        flex-direction: column;
        text-align: center;
    }

    .reward-list {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }

    .campaign-reward-selection-popup__overlay {
        padding: 10px;
    }

    .promo-coupon-display {
        flex-direction: column;
        text-align: center;
    }

    .reward-item-card__footer {
        gap: 8px;
    }

    /* .reward-item-card {
        flex-direction: column;
        align-items: center;
    } */
}

@container (width < 480px) {

    .reward-selection-counter {
        font-size: 14px;
    }

    .reward-item-card__image {
        flex-basis: 46%;
        height: 140px;
        width: 100%;
    }

    .reward-item-card__image img,
    .woocommerce .reward-item-card__image img,
    .woocommerce-page .reward-item-card__image img {
        height: 100%;
        object-fit: cover;
        max-height: 100%;
    }

    .campaign-reward-module__description,
    .campaign-reward-selection .campaign-reward-module__description {
        font-size: 16px;
    }

    .reward-item-card__content {
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
        /* text-align: center; */
    }

    .reward-item-card__price {
        justify-content: center;
    }

    .reward-item-card__price--original {
        font-size: 14px;
    }

    .reward-item-card__price--current {
        font-size: 14px;
    }

    #apply-reward {
        padding: 8px 16px;
        gap: 4px;
        width: fit-content;
        font-size: 14px;
        min-width: unset;
    }
}

@media (max-width: 480px) {

    .reward-selection-counter {
        font-size: 14px;
    }

    .reward-item-card__image {
        flex-basis: 46%;
        height: 140px;
        width: 100%;
    }

    .reward-item-card__image img,
    .woocommerce .reward-item-card__image img,
    .woocommerce-page .reward-item-card__image img {
        height: 100%;
        object-fit: cover;
        max-height: 100%;
    }

    .reward-item-card__content {
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
        /* text-align: center; */
    }

    .reward-item-card__price {
        justify-content: center;
    }

    .reward-item-card__title {
        font-size: 14px;
    }

    .reward-item-card__price--original {
        font-size: 14px;
    }

    .reward-item-card__price--current {
        font-size: 14px;
    }

    .campaign-reward-module__title {
        font-size: 20px;
    }

    .promo-reward-confirmation {
        padding: 20px;
    }

    .promo-reward-confirmation h2 {
        font-size: 20px;
    }
}

/* [071025TIN] Add css for confirm checkout popup */
.checkout-reward-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.checkout-reward-popup__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkout-reward-popup__content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 100%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .checkout-reward-popup__content {
        min-width: 300px;
        width: 100%;
        margin: 0;
    }
}

.checkout-reward-popup__header {
    padding: 20px 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkout-reward-popup__header h3 {
    margin: 0;
    font-size: 18px;
    color: #f39c12;
    line-height: 1.2;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.checkout-reward-popup__close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #734500;
    padding: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-reward-popup__close:hover {
    color: #333;
}

.checkout-reward-popup__body {
    padding: 20px;
    box-sizing: border-box;
}

.checkout-reward-popup__body p {
    margin: 8px 0;
    line-height: 1.5;
    padding: 0;
    font-size: 16px;
    color: #3b2300;
    font-weight: 400;
}

.checkout-reward-popup__footer {
    padding: 15px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.checkout-reward-popup .btn {
    background: transparent;
    padding: 8px 16px;
    border: 1px solid #33200c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    color: #33200c;
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
}

.checkout-reward-popup .btn--secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.checkout-reward-popup .btn--secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.checkout-reward-popup .btn--primary {
    border-color: #fe9f3a;
    background: #fe9f3a;
    color: white;
}

.checkout-reward-popup .btn--primary:hover {
    background: #925e0a;
}

.checkout-reward-popup .reward-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box;
    padding: 16px;
    border: 1px solid #f39c12;
    border-radius: 14px;
}

.checkout-reward-popup .reward-summary .reward-summary__row {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 400;
    color: #3b2300;
}

.checkout-reward-popup .reward-summary .reward-summary__label {
    font-weight: 500;
}


@media (max-width: 768px) {
    .checkout-reward-popup__footer {
        flex-direction: column;
    }

    .checkout-reward-popup .btn {
        width: 100%;
        padding: 12px 20px;
    }
}

/* [071425TIN] Css to hide notices after 5 seconds */
/* .woocommerce-info:has(.timed-notice-data),
.woocommerce-message:has(.timed-notice-data),
.woocommerce-error:has(.timed-notice-data) {
    animation: hideNotice forwards;
    animation-duration: 10s;
} */

@keyframes hideNotice {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        display: none;
    }

}

/* [250715LH] Timed notice hide button style */
.timed-notice-hide-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #333;
    z-index: 10;
}

.timed-notice-hide-btn:hover {
    color: #f44336;
}

.close-timed-notice {
    position: absolute;
    top: calc(50% - 11px);
    right: 10px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: red
}

/* // [250715LH] Temporary cart for reward selection */
/* Temporary Cart Styles */
.promo-temp-cart {
    position: static;
    width: 100%;
    margin: 24px 0;
    background: transparent;
    border: 1px solid #f39c12;
    border-radius: 8px;
    box-shadow: none;
    padding: 12px 0 8px 0;
    transition: all 0.3s;
    counter-reset: temp-cart-counter;
}

.promo-temp-cart__item-index::before {
    /* get content as list counter */
    content: counter(temp-cart-counter);
    width: 15px;
    display: inline-block;
}

.promo-temp-cart__header {
    padding: 4px 16px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.promo-temp-cart__header svg.rotated {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.promo-temp-cart__empty {
    font-size: 14px;
    font-weight: 400;
    color: #7d4d1b;
    padding: 0 8px;
}

.promo-temp-cart__list {
    max-height: 220px;
    overflow-y: auto;
    padding: 0 8px;
    counter-reset: temp-cart-counter;
}

.promo-temp-cart__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 5px;
    margin-bottom: 6px;
    padding: 5px 10px;
    /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); */
    font-size: 14px;
    counter-increment: temp-cart-counter;
}

.promo-temp-cart__item-title {
    flex: 1 1 auto;
    color: #333;
    font-weight: 500;
    margin-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.promo-temp-cart__item-qty {
    color: #888;
    margin-right: 8px;
    font-size: 0.95em;
}

.promo-temp-cart__remove {
    background: none;
    border: none;
    color: #d9534f;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 3px;
    transition: background 0.15s;
}

.promo-temp-cart__remove:hover {
    background: #ffeaea;
    color: #b30000;
}

@media (max-width: 600px) {
    .promo-temp-cart {
        width: 100%;
        margin: 16px 0;
        min-width: unset;
        max-width: unset;
    }
}