/* Cross-sell modal styles for Ama theme */

.ama-cs-overlay {
    --ama-cs-border: #e7ebf1;
    --ama-cs-text: #1d2734;
    --ama-cs-muted: #687487;
    --ama-cs-primary: #20386c;
    --ama-cs-primary-hover: #162a52;
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.ama-cs-overlay.is-disabled {
    display: none;
}

.ama-cs-overlay.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.ama-cs-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 24, 38, 0.58);
}

.ama-cs-modal {
    position: relative;
    z-index: 1;
    width: min(61.25rem, 100%);
    max-height: min(86vh, 57.5rem);
    overflow: auto;
    background: #ffffff;
    border: 0.0625rem solid var(--ama-cs-border);
    border-radius: 0.875rem;
    box-shadow: 0 1.5rem 4.375rem rgba(12, 20, 33, 0.28);
    padding: 1.5rem;
    color: var(--ama-cs-text);
}

.ama-cs-modal h3 {
    margin: 0 2.25rem 0.375rem 0;
    font-size: 1.25rem;
    line-height: 1.25;
}

.ama-cs-modal p {
    margin: 0;
    color: var(--ama-cs-muted);
    line-height: 1.45;
}

/* Top-right X button only */
.ama-cs-modal > .ama-cs-close {
    position: absolute;
    right: 0.625rem;
    top: 0.625rem;
    width: 2.125rem;
    height: 2.125rem;
    border: 0.0625rem solid var(--ama-cs-border);
    border-radius: 50%;
    background: #fff;
    color: #4b586f;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.ama-cs-modal > .ama-cs-close:hover {
    background: #f4f7fb;
    color: #1e2a40;
}

.ama-cs-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem;
    margin-top: 1rem;
}

.ama-cs-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 0.0625rem solid var(--ama-cs-border);
    border-radius: 0.625rem;
    background: #fbfcfe;
}

.cs-thumb-link {
    display: block;
    flex-shrink: 0;
}

.ama-cs-item .cs-thumb,
.ama-cs-item .cs-thumb-link img {
    width: 5.25rem;
    height: 5.25rem;
    border-radius: 0.5rem;
    object-fit: cover;
    display: block;
    background: #eef2f7;
}

.cs-details {
    flex: 1;
    min-width: 0;
}

.cs-details .title {
    display: block;
    color: var(--ama-cs-text);
    text-decoration: none;
    font-weight: 600;
    line-height: 1.35;
}

.cs-details .title:hover {
    color: var(--ama-cs-primary);
}

.ama-cs-item .price {
    color: var(--ama-cs-muted);
    font-size: 0.92rem;
    margin-top: 0.375rem;
}



.cs-choose { display: inline-flex; align-items: stretch; margin-top: 0.5rem;}
.cs-choose input { margin: 0; }

.ama-cs-qty-btn {
    padding: 0;
    width: 2rem;
    border: 0.0625rem solid #ddd;
    background: #fff;
    color: var(--ama-cs-text);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
    min-height: 44px;
}

.ama-cs-qty-minus {
    border-radius: 0.75rem 0 0 0.75rem;
    border-right: none;
}

.ama-cs-qty-plus {
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.ama-cs-qty-btn:hover {
    background-color: #f0f0f0;
    border-color: var(--ama-cs-primary);
}

.ama-cs-qty-btn:active {
    background-color: #e8e8e8;
}

.ama-cs-qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ama-cs-qty {
    width: 5rem;
    max-width: 30%;
    padding: 0.625rem 0.75rem;
    border: 0.0625rem solid #ddd;
    border-radius: 0;
    background: #fff;
    text-align: center;
}
.ama-cs-unit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    align-self: stretch;
    padding: .6687rem .625rem;
    background: #3a1f6b;
    color: #fff;
    border-radius: 0 .75rem .75rem 0;
    border: 0.0625rem solid #ddd;
    border-left: none;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1rem;
}
.ama-cs-qty:focus { outline: none; box-shadow: 0 0 0 0.125rem rgba(58,31,107,0.15); }
.ama-cs-unit:empty { display: none; }

.ama-cs-sand-product-select {
    padding: 0.625rem 0.75rem;
    border: 0.0625rem solid var(--ama-cs-border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--ama-cs-text);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}

.ama-cs-sand-product-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.125rem rgba(32, 56, 108, 0.15);
    border-color: var(--ama-cs-primary);
}

.ama-cs-sand-product-select:hover {
    border-color: var(--ama-cs-primary);
}


.ama-cs-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.625rem;
    margin-top: 1.125rem;
    padding-top: 1rem;
    border-top: 0.0625rem solid var(--ama-cs-border);
}

/* Footer close/add buttons */
.ama-cs-actions .button {
    position: static;
    border: 0.0625rem solid #ccd5e3;
    background: #fff;
    color: #2a3850;
    border-radius: 999px;
    padding: 0.625rem 1.125rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.ama-cs-actions .button:hover {
    background: #f4f7fb;
}

.ama-cs-actions .button.alt {
    background: var(--ama-cs-primary);
    border-color: var(--ama-cs-primary);
    color: #fff;
}

.ama-cs-actions .button.alt:hover {
    background: var(--ama-cs-primary-hover);
    border-color: var(--ama-cs-primary-hover);
}

@media (max-width: 61.25rem) {
    .ama-cs-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 40rem) {
    .ama-cs-overlay {
        padding: 0.75rem;
    }

    .ama-cs-modal {
        padding: 1rem;
        border-radius: 0.75rem;
    }

    .ama-cs-list {
        grid-template-columns: 1fr;
        gap: 0.625rem;
        margin-top: 0.75rem;
    }

    .ama-cs-item {
        padding: 0.625rem;
    }

    .ama-cs-item .cs-thumb,
    .ama-cs-item .cs-thumb-link img {
        width: 4.5rem;
        height: 4.5rem;
    }

    .ama-cs-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .ama-cs-actions .button {
        width: 100%;
        text-align: center;
    }
}
@media (max-width: 991px){
    .ama-cs-list{grid-template-columns: 1fr}
}