.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 15px;
    color: #222;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.checkout {
    padding: 16px 40px;
    background-color: var(--g-brand-500, #2c7a5b);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.checkout:hover {
    background-color: var(--g-brand-700, #225f47);
}

.continue {
    padding: 8px 20px;
    background-color: transparent;
    color: #737373;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s;
    display: block;
    margin: 15px auto 0;
    text-decoration: underline;
}

.continue:hover {
    color: #333;
}

/* --- Модалка «Товари в кошику» зі списком позицій (міні-кошик) --- */

.modal-content--cart {
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-cart-items {
    border-top: 1px solid #eee;
    max-height: 45vh;
    overflow-y: auto;
    text-align: left;
    margin-top: 6px;
}

.modal-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.modal-item-link {
    flex-shrink: 0;
}

.modal-item-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    background: #f4f4f4;
}

.modal-item-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.modal-item-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    text-decoration: none;
    line-height: 1.35;
}

.modal-item-name:hover {
    color: var(--g-brand-500, #2c7a5b);
}

.modal-item-unit {
    font-size: 12px;
    color: #8a8a8a;
    margin-top: 2px;
}

.modal-qty {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
}

.modal-qty-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.modal-qty-btn:hover {
    border-color: var(--g-brand-500, #2c7a5b);
    color: var(--g-brand-500, #2c7a5b);
}

.modal-qty-input {
    width: 38px;
    height: 26px;
    margin: 0 4px;
    padding: 0 2px;
    border: none;
    border-bottom: 1px solid #ddd;
    background: transparent;
    text-align: center;
    font-size: 14px;
    color: #222;
    -moz-appearance: textfield;
}

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

.modal-qty-input:focus {
    outline: none;
    border-bottom-color: var(--g-brand-500, #2c7a5b);
}

.modal-item-subtotal {
    min-width: 78px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
}

.modal-remove-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 5px;
    font-size: 15px;
    line-height: 1;
    color: #b5b5b5;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.modal-remove-btn:hover {
    background: #fdf0ef;
    color: #d9534f;
}

.modal-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 14px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: #222;
    text-align: left;
}

.modal-cart-total span {
    font-weight: 700;
}

.modal-cart-total-value {
    white-space: nowrap;
}

.modal-cart-empty {
    padding: 22px 0;
    text-align: center;
    color: #777;
    font-size: 14px;
}

@media (max-width: 480px) {
    .modal-content--cart {
        padding: 20px 16px;
    }

    .modal-item-image {
        width: 48px;
        height: 48px;
    }

    .modal-item-unit {
        display: none;
    }

    .modal-item-subtotal {
        min-width: 64px;
    }

    .checkout {
        padding: 14px 28px;
        font-size: 16px;
    }
}
/* ============================================================
   Міні-кошик: бейджі свіжості ліній (ціна/кількість) і маркування
   недоступних позицій (маркери у сховище пише js/cart_sync.js)
   ============================================================ */
.modal-cart-item--unavailable {
    opacity: 0.55;
}
.modal-line-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    line-height: 1.4;
}
.modal-line-badge + .modal-line-badge {
    margin-left: 5px;
}
.modal-line-badge--unavailable {
    background: #fdecea;
    color: #b3261e;
    border: 1px solid #f5c6c2;
}
.modal-line-badge--price-up {
    background: #fdf3e7;
    color: #a05a15;
    border: 1px solid #f2d9b8;
}
.modal-line-badge--price-down {
    background: #f2f9f0;
    color: var(--g-brand-700, #3d7a2a);
    border: 1px solid #cde8c4;
}
.modal-line-badge--qty {
    background: #eef3f8;
    color: #2f5a86;
    border: 1px solid #ccdcec;
}
.modal-qty-static {
    font-size: 13px;
    color: #666;
    align-self: center;
}
