.woocommerce-gift-wrapping {
    width: 100%;
    margin: 38px 0px;
    padding: 0;
    /* border-radius: 5px; */
    overflow: hidden;

    border: 2px solid var(--theme-border-color); /* taken from woo cart page */

    background: #FFFFFF00;
}

.gw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    margin-bottom: -1px;
    cursor: pointer;
    background-color: #ffffff00;
    transition: background-color 0.3s ease;

    font-weight: 500;
}

.gw-header:hover {
    background-color: #f0f0f0;
}

.gw-toggle-icon {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plus-icon {
    position: relative;
    width: 16px;
    height: 16px;
}

.plus-icon:before,
.plus-icon:after {
    content: '';
    position: absolute;
    background-color: #000000;
    transition: transform 0.3s ease;
}

.plus-icon:before {
    width: 16px;
    height: 2px;
    top: 7px;
    left: 0;
}

.plus-icon:after {
    width: 2px;
    height: 16px;
    top: 0;
    left: 7px;
}

.woocommerce-gift-wrapping.expanded .plus-icon:after {
    transform: rotate(90deg);
}

.gw-animated-line {
    height: 2px;
    background-color: #000000;
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.woocommerce-gift-wrapping.expanded .gw-animated-line {
    transform: scaleX(1);
}

.gw-content {
    padding: 0px;
    max-height: 0px;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.gw-content-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    max-height: 0px;
    transition: max-height 0.5s ease-in-out;
}

.woocommerce-gift-wrapping.expanded .gw-content {
    max-height: 20000px;
}

.woocommerce-gift-wrapping.expanded .gw-content-wrapper {
    max-height: 20000px;
}

.gw-products {
    display: grid;
    flex-wrap: wrap;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

@media (max-width: 991px){
    .gw-products {
        display: grid;
        flex-wrap: wrap;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin: 20px 0;
    }
}

@media (max-width: 660px){
    .gw-products {
        display: grid;
        flex-wrap: wrap;
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 20px 0;
    }
}

.gw-product {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid #ddd;
    border-radius: 5px;
    padding: 5px;
    /* cursor: pointer; */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    border: 3px solid #d6acb900;

    transition: border 0.15s ease, background-color 0.3s ease;
}

.gw-product.selected {
    border-color: #d6acb9;
    /* background-color: #d6acb94d; */
}

.gw-product.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #ccc;
}

/* Hide the checkbox input and replace with a checkmark for selected items */
.gw-product input[type="checkbox"] {
    display: none;
}

.gw-product.selected .gift-wrap-product-checkbox:after {
    content: "✓";
    position: absolute;
    top: 0;
    right: 5px;
    color: #000000;
    font-size: 16px;
    font-weight: bold;
}

/* Notice for products already in gift wrap */
.gift-wrap-product-notice {
    position: absolute;
    bottom: 50%;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 14px;
    padding: 2px;
    text-align: center;
}

.gw-product-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    justify-content: flex-end;
}

.size-gift-wrap-product-image {
    /* max-width: 100%;
    max-height: 50px;
    width: auto;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none; */

    margin-top: auto;
    margin-bottom: auto;
}

.gift-wrap-product-title {
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 15px;
    /* overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; */
    width: 100%;
    line-height: 1.2;
}

.gw-product-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: auto;
}

.gift-wrap-quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border-radius: 3px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.quantity-btn:hover {
    border-color: #000;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-input {
    flex-grow: 0;
    height: 20px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    padding: 0;
    min-width: 30px;
    -moz-appearance: textfield;
}

/* Remove spinner arrows from number input */
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.gift-wrap-available-quantity {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-top: 3px;
    width: 100%;
}

.gift-wrap-product-checkbox {
    position: absolute;
    top: 5px;
    right: 5px;
}

.gift-wrapping-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 20px;
    gap: 10px;
}

.gift-wrapping-actions-row {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    width: 100%;
    flex-wrap: wrap;
    gap: 15px;
}

.gift-wrap-variations {
    display: flex;
    gap: 15px;
    flex-grow: 1;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-right: auto;
    margin-bottom: 20px;
}

.gift-wrap-variation-select {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.gift-wrap-variation-select label {
    font-size: 12px;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Custom Select Styling */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    padding-right: 50px !important;
    font-size: 14px;
    cursor: pointer;
}

.custom-select-trigger:after {
    content: "";
    position: absolute;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #000000;
    transition: all 0.2s ease;
}

.custom-select.opened .custom-select-trigger:after {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid #ddd;
    border-top: 0;
    background-color: white;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 49;
    max-height: 200px;
    overflow-y: auto;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.custom-select.opened {
    z-index: 49;
}

.custom-select.opened .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    z-index: 49;
}

.custom-option {
    position: relative;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-option:hover {
    background-color: rgba(127, 84, 179, 0.1);
}

.custom-option.selected {
    color: #000000;
    background-color: rgba(127, 84, 179, 0.1);
}

/* Color swatch styling */
.color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #ddd;
}

.custom-option.has-color {
    padding-left: 8px;
}

#gift-wrapping-continue {
    background-color: #000000;
    color: white;
    position: relative;
    min-width: 120px;
}

@media (max-width: 540px){
    #gift-wrapping-continue {
        width: 100%;
    }

    .gift-wrap-variation-select {
        margin-right: auto;
    }

    .variation-selection-notice {
        text-align: left !important;
    }

    .gw-content,
    .woocommerce-gift-wrapping.expand-finished {
        overflow: visible !important;
    }
}

#gift-wrapping-continue:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#gift-wrapping-continue .loading-spinner {
    display: none;
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

#gift-wrapping-continue.loading .button-text {
    visibility: hidden
}

#gift-wrapping-continue.loading .loading-spinner {
    display: inline;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.variation-selection-notice {
    color: #e2401c;
    font-size: 12px;
    margin-top: 5px;
    width: 100%;
    text-align: right;
}

/* Simple swatches */

.gift-wrap-error {
    color: #e2401c;
    font-size: 14px;
    margin-right: 15px;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

/* Notification styles */
.gift-wrap-notification {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    width: 100%;
    text-align: center;
}

.gift-wrap-notification-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gift-wrap-notification-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

