/* Popup Header */
.ampromo-popup-header {
    text-align: left !important;
    margin-bottom: 0 !important;
    margin-left: 25px;
    margin-right: 25px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px 8px 0 0;
}

.popup-container-wrapper {
    margin-left: 25px;
    margin-right: 25px;
}

.ampromo-header-content {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.ampromo-back-arrow {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.ampromo-arrow-icon {
    display: block;
    width: 25px;
    height: 25px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23EB5757' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5'%3E%3C/path%3E%3Cpath d='M12 19l-7-7 7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.ampromo-popup-title-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0 12px;
}

.ampromo-title-subtitle-wrapper {
    display: flex;
    flex-grow: 1;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.ampromo-gift-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.ampromo-popup-wrapper .ampromo-popup-title,
body .ampromo-popup-wrapper .ampromo-popup-title {
    font-size: 18px;
    font-weight: 600;
    display: inline-block;
    text-align: left;
    color: #000000;
    line-height: 1.2;
    margin: 0 0 2px 0;
}

.ampromo-popup-wrapper .ampromo-popup-subtitle,
body .ampromo-popup-wrapper .ampromo-popup-subtitle {
    font-weight: 400;
    font-size: 15px;
    color: #3F3F3F;
    text-align: left;
    margin-left: 0;
}

.ampromo-close:before, 
.ampromo-close:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #696969;
    top: 50%;
    left: 0;
}

.ampromo-close:before {
    transform: rotate(45deg);
}

.ampromo-close:after {
    transform: rotate(-45deg);
}

.ampromo-close:hover {
    opacity: 1;
}

/* Gift Popup Main Styles */
.ampromo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 998;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

.ampromo-overlay.-show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ampromo-popup-wrapper {
    position: relative;
    max-width: 650px;
    width: 90%;
    background-color: #fff;
    border-radius: 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

/* Product Grid */
.ampromo-grid-products {
    padding: 20px;
    background-color: #fff;
}

.ampromo-products-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    row-gap: 15px;
    column-gap: 30px;
}

.ampromo-item {
    position: relative;
    box-sizing: border-box;
    margin-bottom: 15px;
    transition: border-color 0.2s ease;
}

.ampromo-item.-selected {
    border-color: #0078a8;
}

/* Product Image */
.ampromo-item-image {
    width: 100% !important;
    height: auto !important;
    max-height: 120px !important;
    object-fit: contain !important;
    background: transparent !important;
    display: block !important;
    background-color: transparent !important;
    border: none !important;
    margin-right: 15px !important;
    margin-left: 10px;
}

/* Product Details */
.ampromo-product-details {
    margin-top: 0;
    text-align: left;
    flex: 1;
}

.ampromo-brand-name {
    font-family: 'Proxima Nova', sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    color: #000;
    margin-bottom: 3px;
}

.ampromo-title {
    font-family: 'Proxima Nova', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #000000;
    margin-bottom: 5px;
}

.ampromo-price {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin-bottom: 15px;
}

/* Item Layout - Update to match mockup */
/* Product Checkbox - Fix missing styling */
.ampromo-product-select {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    z-index: 2;
    margin: 0;
}

.ampromo-product-select input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #999;
    border-radius: 2px;
    background-color: #fff;
    position: relative;
    cursor: pointer;
    margin: 0;
    padding: 0;
    display: block;
    transition: all 0.2s ease;
}

.ampromo-product-select input[type="checkbox"]:checked,
.ampromo-product-select input[type="checkbox"].checkbox-checked {
    background-color: #000;
    border-color: #000;
}

.ampromo-product-select input[type="checkbox"]:checked::after,
.ampromo-product-select input[type="checkbox"].checkbox-checked::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    top: 2px;
    left: 6px;
    transform: rotate(45deg);
}

/* Hide any existing checkbox-checkmark spans that might be in the DOM */
.checkbox-checkmark {
    display: none !important;
}

/* Attribute Display */
.ampromo-attribute {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.attribute-label {
    margin-right: 5px;
    font-weight: 500;
    font-size: 13px;
}

/* Restructured item content container */
.ampromo-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: none !important;
}

/* Ensure the img element itself has no background */
img.ampromo-item-image {
    background: none !important;
}

.field.configurable {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.field.configurable label span {
    font-family: 'Proxima Nova', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 19px;
    color: #474747;
}

.attribute-name {
    font-family: 'Proxima Nova', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #474747;
    line-height: 19px;
}

.super-attribute-select {
    width: 100%;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 0 10px;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9L12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    font-size: 14px;
    color: #333;
}

/* Quantity Controls */
.ampromo-qty-controls {
    display: flex;
    align-items: center;
}

.qty-decrease,
.qty-increase {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    position: relative;
    background: #fff;
}

.qty-decrease::after,
.qty-increase::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 16px;
    background:#606060;
}

.qty-increase::before {
    left: 0;
}

.ampromo-qty {
    flex: 1;
    height: 36px;
    text-align: center;
    border: none;
    font-size: 14px;
    min-width: 50px;
    padding: 0;
    margin: 0;
    background: #fff;
}

.ampromo-qty::-webkit-inner-spin-button,
.ampromo-qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ampromo-qty:focus {
    outline: none;
}

/* Add to cart button */
.ampromo-item-buttons .ampromo-button {
    background-color: #000;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 12px 25px;
    border-radius: 0;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: 1px solid #000000;
}

/* Make sure our CSS has higher specificity than any other CSS */
.ampromo-popup-wrapper .ampromo-item,
.ampromo-popup-wrapper .ampromo-product-select,
.ampromo-popup-wrapper .ampromo-product-select input[type="checkbox"],
.ampromo-popup-wrapper .ampromo-product-select input[type="checkbox"]:checked,
.ampromo-popup-wrapper .ampromo-product-select input[type="checkbox"]:checked:after {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Compatibility fixes */
.ampromo-gallery.ampromo-slick {
    position: absolute;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
}

.slick-placeholder-item {
    display: none;
}

.ampromo-product-wrapper {
    display: flex;
    width: 100%;
    align-items: center;
    background: none;
    min-height: 120px;
}

.ampromo-column-checkbox {
    display: flex;
    justify-content: left;
    cursor: pointer;
    flex: 0 0 40px;
    align-items: center;
    padding-top: 0;
    height: 100%;
}

.ampromo-product-select {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    z-index: 2;
    margin: 0;
}

.ampromo-product-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid #999;
    border-radius: 2px;
    background-color: #fff;
    position: relative;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    margin: 0;
    padding: 0;
    display: block;
    transition: all 0.2s ease;
}

.ampromo-product-select input[type="checkbox"]:checked,
.ampromo-product-select input[type="radio"]:checked {
    background-color: #000;
    border-color: #000;
}

.ampromo-product-select input[type="checkbox"]:checked:after {
    content: '';
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    top: 2px;
    left: 5px;
    transform: rotate(45deg);
}

.ampromo-column-image {
    flex: 0 0 120px;
    padding: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ampromo-item-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 120px;
    display: block;
    background: none;
}

.ampromo-column-details {
    flex: 1;
    padding-left: 5px;
    min-width: 0;
}

.field.configurable {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.control {
    flex: 1;
}

/* Style cho label */
.attribute-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.qty-label {
    flex: 0 0 90px;
    margin-right: 10px;
    font-size: 15px;
    font-weight: 400;
    line-height: 19px;
    color: #474747;
}

.qty-control-wrapper {
    display: flex;
    align-items: center;
    height: 36px;
    border: 1px solid #606060;
    overflow: hidden;
    flex: 1;
}

.qty-decrease,
.qty-increase {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.ampromo-qty {
    width: 50px;
    height: 36px;
    text-align: center;
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    font-size: 14px;
}

.ampromo-item-content {
    padding: 0 10px;
}

.ampromo-product-details {
    margin-top: 10px;
}

.field.configurable.qty {
    display: flex;
    align-items: center;
    margin-top: 15px;
}

.field-qty .attribute-label-wrapper {
    margin-right: 10px;
}

input.ampromo-qty:focus {
    outline: none;
    box-shadow: 0 0 0 1px rgba(0, 120, 168, 0.3);
}

.ampromo-item {
    min-height: 180px;
    box-sizing: border-box;
}

.ampromo-button-container {
    display: flex;
    justify-content: flex-end;
    margin: 20px 0 10px;
}

.ampromo-button:hover {
    background-color: #005f87;
}

.super-attribute-select:hover {
    border-color: #999;
}

.ampromo-popup-wrapper {
    max-width: 650px;
    width: 90%;
    padding-right: 0;
    padding-left: 0;
    padding-bottom: 0;
}

.ampromo-item-buttons {
    padding: 15px 45px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    background: #f3f5f9;
    gap: 20px;
}

.ampromo-button:disabled,
.ampromo-button[disabled] {
    background-color: #999 !important;
    cursor: not-allowed !important;
    border: 1px solid #999;
}

.selected-gifts-summary {
    padding: 0;
    margin: 0;
    border: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.gifts-selected-text {
    font-size: 15px;
    font-weight: 400;
    margin: 0;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gifts-selected-names {
    font-weight: 600;
    color: #000000;
}

.ampromo-item .ampromo-items-form {
    background: none;
    width: 100%;
    display: block;
    padding: 0;
}

.field.configurable {
    margin-bottom: 12px;
}

.super-attribute-select,
.control select {
    max-width: 100%;
    box-sizing: border-box;
    border: none;
    background-color: #f6f6f8;
}

.ampromo-item {
    margin-bottom: 15px;
    transition: border-color 0.2s ease;
}

.ampromo-items-form {
    margin: 0;
}

input.ampromo-qty {
    background: none;
    font-style: normal;
}

button.qty-decrease:hover,
button.qty-increase:hover {
    background: none;
    border: none;
    color: #333;
}

select.super-attribute-select.color-select > option {
    font-style: normal;
    text-transform: uppercase;
}

.ampromo-options select.super-attribute-select {
    font-style: normal;
    text-transform: uppercase;
}

.ampromo-product-details .ampromo-details {
    margin-bottom: 5px;
}

.ampromo-button {
    flex: 0 0 auto;
    min-width: 180px;
    white-space: nowrap;
}

.ampromo-options .fieldset:last-child {
    margin-bottom: 0;
}

/* Responsive adjustments - Enhanced */
@media only screen and (max-width: 1024px) {
    .ampromo-popup-wrapper {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
    }
    
    .ampromo-popup-header {
        margin-left: 15px;
        margin-right: 15px;
        padding: 12px 15px;
    }
    
    .popup-container-wrapper {
        margin-left: 15px;
        margin-right: 15px;
    }
    
    .ampromo-products-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0;
    }
    
    .ampromo-grid-products {
        padding: 15px 10px;
    }
    
    .ampromo-item-buttons {
        padding: 12px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .selected-gifts-summary {
        text-align: center;
        margin-top: 5px;
    }
    
    .ampromo-button {
        order: 1;
        width: 100%;
    }
    
    .gifts-selected-text {
        white-space: normal;
        text-align: center;
    }
    
    /* Adjust popup title and close button */
    .ampromo-popup-wrapper .ampromo-popup-title,
    body .ampromo-popup-wrapper .ampromo-popup-title {
        font-size: 16px;
    }
    
    .ampromo-popup-wrapper .ampromo-popup-subtitle,
    body .ampromo-popup-wrapper .ampromo-popup-subtitle {
        font-size: 14px;
    }
    
    .ampromo-gift-icon {
        min-width: 35px;
        width: 35px;
        height: 35px;
    }
}

@media only screen and (max-width: 480px) {
    .ampromo-product-wrapper {
        flex-wrap: wrap;
    }
    
    .ampromo-column-checkbox {
        flex: 0 0 30px;
        padding-top: 0;
        align-items: center;
    }
    
    .field.configurable {
        flex-wrap: wrap;
    }
    
    .attribute-label-wrapper {
        flex: 0 0 100%;
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .control {
        width: 100%;
    }
    
    .super-attribute-select {
        width: 100%;
    }
    
    .ampromo-button {
        padding: 10px 15px;
        font-size: 14px;
    }

    .ampromo-column-details .ampromo-qty-controls {
        display: block;
    }

    .ampromo-column-details .ampromo-qty-controls .qty-control-wrapper {
        margin-top: 5px;
    }
}

@media only screen and (max-width: 375px) {
    .ampromo-popup-header {
        margin-left: 10px;
        margin-right: 10px;
        padding: 10px;
    }
    
    .popup-container-wrapper {
        margin-left: 10px;
        margin-right: 10px;
    }
    
    .ampromo-grid-products {
        padding: 10px 5px;
    }
    
    .ampromo-item-buttons {
        padding: 10px 15px;
    }
    
    .ampromo-column-checkbox {
        flex: 0 0 25px;
        align-items: center;
    }
    
    .ampromo-product-details .ampromo-brand-name {
        font-size: 14px;
    }
    
    .ampromo-product-details .ampromo-title {
        font-size: 14px;
    }
    
    .ampromo-product-details .ampromo-price {
        font-size: 16px;
    }
    
    .attribute-name, .qty-label {
        font-size: 14px;
    }
    
    .ampromo-item {
        min-height: 150px;
    }

    .ampromo-popup-wrapper .ampromo-item-image {
        margin: auto;
    }

    .attribute-label-wrapper {
        margin-right: revert;
    }

    .ampromo-popup-wrapper .ampromo-item .fieldset .field {
        margin-bottom: 5px;
    }
}
