/* 1. Блокування штатного вікна теми WoodMart */
#woodmart-added-to-cart,
.woodmart-cart-popup,
.wd-cart-popup {
    display: none !important;
}

/* 2. Затінення фону */
.maxmy-qc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

/* 3. Контейнер модального вікна */
.maxmy-qc-dialog {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--wd-form-brd-radius, 8px);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    position: relative;
    animation: maxmyQcPop 0.22s ease-out forwards;
}

@keyframes maxmyQcPop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.maxmy-qc-content {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    box-sizing: border-box;
}

/* 4. Шапка з охайним хрестиком (стиль кредиту) */
.maxmy-qc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.maxmy-qc-title {
    font-size: 17px;
    font-weight: 700;
    color: #242424;
    margin: 0;
}

.maxmy-qc-close {
    font-size: 26px !important;
    line-height: 1 !important;
    color: #999 !important;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: inline-block !important;
    transition: color 0.2s ease !important;
    user-select: none !important;
}

.maxmy-qc-close:hover {
    color: #333 !important;
    background: transparent !important;
}

/* 5. Контейнер списку товарів та автоскрол після 3-х товарів */
.maxmy-qc-items-list {
    max-height: 250px; /* Висота розрахована рівно під 3 товари */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    margin-bottom: 4px;
    flex-shrink: 1;
}

/* Охайний тонкий скролбар для списку */
.maxmy-qc-items-list::-webkit-scrollbar {
    width: 5px;
}

.maxmy-qc-items-list::-webkit-scrollbar-track {
    background: #f4f4f4;
    border-radius: 4px;
}

.maxmy-qc-items-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.maxmy-qc-items-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 6. Рядок товару */
.maxmy-qc-product-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.maxmy-qc-product-row:last-child {
    border-bottom: none;
}

.maxmy-qc-product-img {
    width: 62px;
    height: 62px;
    min-width: 62px;
    border-radius: 6px;
    border: 1px solid #eaeaea;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    flex-shrink: 0;
}

.maxmy-qc-product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.maxmy-qc-product-info {
    flex: 1;
    min-width: 0;
}

.maxmy-qc-product-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 600;
    color: #242424;
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 4px;
}

.maxmy-qc-product-name:hover {
    color: var(--wd-primary-color, #0088cc);
}

.maxmy-qc-product-price-row {
    font-size: 13.5px;
    color: #666;
}

.maxmy-qc-qty {
    margin-right: 4px;
}

.maxmy-qc-price,
.maxmy-qc-price .woocommerce-Price-amount {
    font-weight: 700;
    color: var(--wd-primary-color, #0088cc);
}

/* 7. Рядок загальної вартості */
.maxmy-qc-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 16px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 6px;
    flex-shrink: 0;
}

.maxmy-qc-total-label {
    font-size: 17px;
    font-weight: 700;
    color: #242424;
}

.maxmy-qc-total-value,
.maxmy-qc-total-value .woocommerce-Price-amount {
    font-size: 19px;
    font-weight: 700;
    color: var(--wd-primary-color, #0088cc);
}

/* 8. Кнопка "Оформити" */
.maxmy-qc-actions {
    flex-shrink: 0;
}

.maxmy-qc-btn-checkout {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 12px 20px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    border-radius: var(--wd-form-brd-radius, 5px) !important;
    background-color: var(--wd-primary-color, #0088cc) !important;
    color: #ffffff !important;
    box-sizing: border-box !important;
    transition: opacity 0.2s ease !important;
    text-decoration: none !important;
}

.maxmy-qc-btn-checkout:hover {
    opacity: 0.9 !important;
    color: #ffffff !important;
}

/* 9. Смуга таймера */
.maxmy-qc-progress-track {
    width: 100%;
    height: 3px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.maxmy-qc-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--wd-primary-color, #0088cc);
    transform-origin: left;
}

/* 10. Мобільна оптимізація */
@media (max-width: 480px) {
    .maxmy-qc-dialog {
        max-width: 95%;
        max-height: 85vh;
    }
    .maxmy-qc-content {
        padding: 16px 18px;
    }
    .maxmy-qc-items-list {
        max-height: 220px; /* Трохи компактніше для мобільних екранів */
    }
    .maxmy-qc-product-img {
        width: 56px;
        height: 56px;
        min-width: 56px;
    }
}