/* Add to cart popup — trang sản phẩm */

html.atc-popup-open {
    overflow: hidden;
}

.atc-popup {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atc-popup[hidden] {
    display: none;
}

.atc-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}

.atc-popup__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: calc(100% - 32px);
    max-width: 480px;
    max-height: 85vh;
    padding: 24px;
    background: var(--default-color-white);
    border-radius: 8px;
    outline: none;
}

.atc-popup__close {
    position: absolute;
    top: 8px;
    right: 12px;
    padding: 0;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--default-color-black);
    cursor: pointer;
}

.atc-popup__state {
    display: none;
    flex-direction: column;
    min-height: 0;
}

.atc-popup[data-state="success"] .atc-popup__state--success,
.atc-popup[data-state="error"] .atc-popup__state--error {
    display: flex;
}

.atc-popup__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 24px 16px 0;
    font-size: 18px;
}

.atc-popup__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--default-color-green-dark);
    color: var(--default-color-white);
    font-size: 14px;
}

.atc-popup__cart {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.atc-popup__items {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    border-top: 1px solid var(--default-color-grey);
}

.atc-popup__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--default-color-grey);
}

.atc-popup__item.is-added {
    background: var(--default-color-beige);
}

.atc-popup__thumb {
    flex-shrink: 0;
    width: 56px;
}

.atc-popup__thumb img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
}

.atc-popup__info {
    flex: 1;
    min-width: 0;
    font-size: 14px;
}

.atc-popup__name {
    margin: 0 0 4px;
    font-weight: 600;
    line-height: 1.35;
}

.atc-popup__name a {
    color: inherit;
    text-decoration: none;
}

.atc-popup__info .variation {
    margin: 0 0 4px;
    font-size: 13px;
    color: #666;
}

.atc-popup__info .variation dt,
.atc-popup__info .variation dd,
.atc-popup__info .variation p {
    display: inline;
    margin: 0;
}

.atc-popup__qty {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.atc-popup__line-total {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
}

.atc-popup__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 12px 0 0;
}

.atc-popup__subtotal strong {
    font-size: 18px;
    color: var(--default-color-red);
}

.atc-popup__actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Selector 4 class để thắng `.woocommerce button.button.alt` (css/custom.css) và style .button của parent theme. */
.atc-popup .atc-popup__actions .button.atc-popup__continue,
.atc-popup .atc-popup__actions .button.atc-popup__checkout {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 45px;
    margin: 0 !important;
    padding: 0 12px;
    border: 2px solid var(--default-color-dark-blue);
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.atc-popup .atc-popup__actions .button.atc-popup__continue {
    background: var(--default-color-white);
    color: var(--default-color-dark-blue);
}

.atc-popup .atc-popup__actions .button.atc-popup__continue:hover {
    background: var(--default-color-grey);
}

.atc-popup .atc-popup__actions .button.atc-popup__checkout {
    background: var(--default-color-dark-blue);
    color: var(--default-color-white);
}

.atc-popup .atc-popup__actions .button.atc-popup__checkout:hover {
    background: var(--default-color-navy-blue);
    border-color: var(--default-color-navy-blue);
}

.atc-popup__state--error .atc-popup__actions .button {
    flex: 1;
    margin: 0 !important;
}

.atc-popup__view-cart {
    align-self: center;
    margin-top: 12px;
    font-size: 14px;
    text-decoration: underline;
}

.atc-popup__error-msg {
    margin: 0;
}

@media (max-width: 480px) {
    .atc-popup {
        align-items: flex-end;
    }

    .atc-popup__panel {
        width: 100%;
        max-height: 90vh;
        padding: 20px 16px;
        border-radius: 12px 12px 0 0;
    }

    .atc-popup__actions {
        flex-direction: column-reverse;
        flex-shrink: 0;
    }

    /* Cột dọc: flex-basis 0 sẽ áp lên chiều cao và làm nút co về 0 → giữ height 45px. */
    .atc-popup .atc-popup__actions .button.atc-popup__continue,
    .atc-popup .atc-popup__actions .button.atc-popup__checkout,
    .atc-popup__state--error .atc-popup__actions .button {
        flex: 0 0 auto;
        width: 100%;
    }
}
