/* ============================================================
   Cart Recommendations Styles
   Project: Ingreen.ua
   ============================================================ */

/* 1. Recommendations Block inside Cart */
.cart-recommendations-wrapper {
    width: 100%;
    margin-top: 25px;
    padding-top: 20px;
    padding-bottom: 45px;
    border-top: 1px solid #eee;
}

.cart-recommendations-header {
    margin-bottom: 16px;
}

.cart-recommendations-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin: 0;
    text-transform: none;
    letter-spacing: 0.3px;
    font-family: inherit;
}

/* 2 Products in a row */
.cart-recommendations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: flex-start;
    gap: 15px;
}

.cart-rec-item {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    transition: opacity 0.2s ease;
}

.cart-rec-item.loading {
    opacity: 0.55;
    pointer-events: none;
}

.cart-rec-image {
    text-align: center;
    margin-bottom: 10px;
    background: #f7f7f7;
    position: relative;
    overflow: hidden;
}

.cart-rec-image a {
    display: block;
    width: 100%;
}

.cart-rec-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    transition: opacity 0.25s ease;
}

#checkoutRecModal .cart-rec-image, #checkoutRecModal .cart-rec-image img {
    max-height: 270px;
}

.cart-rec-item:hover .cart-rec-image img {
    opacity: 0.93;
}

.cart-rec-info {
    text-align: left;
    margin-bottom: 10px;
}

.cart-rec-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: #222;
    text-decoration: none;
    height: 35px;
    margin-bottom: 6px;
}

.cart-rec-name:hover {
    color: #000;
    text-decoration: underline;
}

.cart-rec-price {
    font-size: 14px;
    font-weight: 700;
    color: #000;
    margin-bottom: 4px;
}

.cart-rec-price .price-normal {
    color: #000;
}

.cart-rec-price .price-special {
    color: #e53935;
    margin-right: 6px;
}

.cart-rec-price .price-old {
    text-decoration: line-through;
    color: #888;
    font-size: 12px;
    font-weight: 400;
}

/* 2. Color Swatches (circles under price) */
.cart-rec-colors {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 6px;
    min-height: 24px;
}

.cart-rec-color-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    text-decoration: none;
    border-radius: 50%;
    outline: none;
}

.cart-rec-color-btn .color-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0;
    border: 1px solid #d4d4d4;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
}

.cart-rec-color-btn:hover .color-circle {
    transform: scale(1.15);
}

.cart-rec-color-btn.active .color-circle {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #111;
}

/* 3. Add to Cart Full-width Black Button */
.cart-rec-actions {
    position: relative;
    width: 100%;
    margin-top: auto;
}

.btn-rec-add {
    width: 100%;
    height: 42px;
    padding: 0 10px;
    background-color: #000;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.btn-rec-add:hover {
    background-color: #222;
    color: #fff;
}
.btn-rec-add:focus {
    color: #fff;
}

.btn-rec-add.loading {
    opacity: 0.65;
    cursor: wait;
}

/* 4. Compact Size Selector (Appears if matched size not available) */
.cart-rec-size-selector {
    margin-top: 10px;
    text-align: center;
    padding-top: 4px;
}

.cart-rec-size-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.cart-rec-size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.btn-rec-size-pill {
    background: #fff;
    border: 1px solid #dcdcdc;
    color: #111;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.btn-rec-size-pill:hover {
    border-color: #000;
    background-color: #f7f7f7;
}

.btn-rec-size-pill:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
    border-color: #eee;
}

/* Mobile Adjustments */
@media (max-width: 767px) {
    .cart-recommendations-wrapper {
        padding-bottom: 65px;
        margin-top: -30px;
    }
    .cart-recommendations-grid {
        gap: 10px;
    }
    .btn-rec-add {
        font-size: 11px;
        height: 38px;
    }
    .cart-rec-color-btn .color-circle {
        width: 18px;
        height: 18px;
    }
    .btn-rec-size-pill {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* ============================================================
   5. Checkout Recommendations Modal (Centered & Clean)
   ============================================================ */
.modal.rec-checkout-modal,
#checkoutRecModal.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px 15px !important;
    z-index: 10500 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    text-align: center !important;
    background: rgba(0, 0, 0, 0.55) !important;
}

.modal.rec-checkout-modal.in,
#checkoutRecModal.modal.in {
    display: flex !important;
}

.rec-checkout-modal:before {
    display: none !important;
    content: none !important;
}

.modal.rec-checkout-modal .modal-dialog,
#checkoutRecModal .modal-dialog {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 1060px !important;
    max-width: 96vw !important;
    height: auto !important;
    min-height: auto !important;
    max-height: 90vh !important;
    margin: auto !important;
    display: block !important;
    transform: none !important;
    text-align: left !important;
}

.modal.rec-checkout-modal .modal-content,
#checkoutRecModal .modal-content {
    position: relative !important;
    height: auto !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.28) !important;
    background: #fff !important;
    padding: 0 !important;
}

.rec-popup-close {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 30px;
    line-height: 1;
    font-weight: 300;
    color: #333;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
    padding: 5px 8px;
}

.rec-popup-close:hover {
    opacity: 1;
    color: #000;
    transform: scale(1.1);
}

.rec-popup-title {
    font-size: 22px;
    font-weight: 500;
    color: #111;
    text-align: center;
    margin: 0 0 22px;
    letter-spacing: 0.3px;
    font-family: inherit;
}

.rec-popup-alert {
    background: #eef7ed;
    border: 1px solid #c3e6cb;
    color: #1e6b24;
    padding: 10px 16px;
    margin-bottom: 22px;
    font-size: 13.5px;
    font-weight: 500;
    text-align: center;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fadeInRecAlert 0.25s ease;
}

@keyframes fadeInRecAlert {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.rec-popup-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    align-items: flex-start;
}

.rec-popup-grid .cart-rec-item {
    flex: 0 0 calc((100% - 48px) / 4);
    max-width: calc((100% - 48px) / 4);
    box-sizing: border-box;
}

.rec-discount-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #d32f2f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 0;
    z-index: 2;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.btn-rec-add.btn-rec-added {
    background-color: #2e7d32 !important;
    color: #fff !important;
}

@media (max-width: 991px) and (min-width: 768px) {
    .modal.rec-checkout-modal .modal-dialog,
    #checkoutRecModal .modal-dialog {
        width: 95vw !important;
    }
    .rec-popup-grid {
        gap: 12px;
    }
    .rec-popup-grid .cart-rec-item {
        flex: 0 0 calc((100% - 36px) / 4);
        max-width: calc((100% - 36px) / 4);
    }
    .rec-popup-grid .cart-rec-name {
        font-size: 12px;
    }
    .rec-popup-grid .btn-rec-add {
        font-size: 11px;
        height: 36px;
    }
}

@media (max-width: 767px) {
    .modal.rec-checkout-modal,
    #checkoutRecModal.modal {
        padding: 10px 8px !important;
    }
    .modal.rec-checkout-modal .modal-dialog,
    #checkoutRecModal .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
    .modal.rec-checkout-modal .modal-content,
    #checkoutRecModal .modal-content {
        padding: 25px 10px 18px !important;
        max-height: 92vh !important;
    }
    .rec-popup-title {
        font-size: 16px;
        margin-bottom: 14px;
        padding: 0 20px;
    }
    .rec-popup-grid {
        gap: 10px;
    }
    .rec-popup-grid .cart-rec-item {
        flex: 0 0 calc((100% - 10px) / 2) !important;
        max-width: calc((100% - 10px) / 2) !important;
    }
    .rec-popup-grid .cart-rec-name {
        font-size: 12px;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    .rec-popup-grid .cart-rec-price {
        font-size: 13px;
        margin-bottom: 6px;
    }
    .rec-popup-grid .btn-rec-add {
        height: 36px;
        font-size: 11px;
    }
    .rec-popup-close {
        top: 6px;
        right: 8px;
        font-size: 26px;
    }
}

/* ============================================================
   Мобилка (575px и ниже) — классический попап с отступами по краям
   ============================================================ */
@media (max-width: 575px) {
    .modal.rec-checkout-modal,
    #checkoutRecModal.modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 16px 10px !important;
        margin: 0 !important;
        display: none;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(0, 0, 0, 0.6) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        z-index: 10500 !important;
    }

    .modal.rec-checkout-modal.in,
    #checkoutRecModal.modal.in {
        display: flex !important;
    }

    .modal.rec-checkout-modal .modal-dialog,
    #checkoutRecModal .modal-dialog {
        position: relative !important;
        width: 100% !important;
        max-width: calc(100vw - 20px) !important;
        height: auto !important;
        min-height: auto !important;
        max-height: calc(100dvh - 32px) !important;
        margin: auto !important;
        padding: 0 !important;
        border-radius: 6px !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .modal.rec-checkout-modal .modal-content,
    #checkoutRecModal .modal-content {
        position: relative !important;
        width: 100% !important;
        min-height: auto !important;
        max-height: calc(100dvh - 32px) !important;
        border: none !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
        background: #fff !important;
        padding: 24px 10px 20px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #checkoutRecModal .modal-body {
        padding: 0 !important;
    }

    .rec-popup-close {
        position: absolute !important;
        top: 10px !important;
        right: 12px !important;
        font-size: 32px !important;
        line-height: 1 !important;
        font-weight: 300 !important;
        color: #222 !important;
        background: transparent !important;
        border: none !important;
        padding: 6px 10px !important;
        opacity: 0.75 !important;
        z-index: 50 !important;
    }

    .rec-popup-close:hover,
    .rec-popup-close:active {
        opacity: 1 !important;
        color: #000 !important;
    }

    .rec-popup-title {
        font-size: 18px !important;
        font-weight: 600 !important;
        color: #111 !important;
        text-align: center !important;
        margin: 6px 0 16px !important;
        padding: 0 40px !important;
        line-height: 1.3 !important;
    }

    .rec-popup-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 16px 10px !important;
        width: 100% !important;
    }

    .rec-popup-grid .cart-rec-item {
        flex: 0 0 calc((100% - 10px) / 2) !important;
        max-width: calc((100% - 10px) / 2) !important;
        width: calc((100% - 10px) / 2) !important;
        box-sizing: border-box !important;
    }

    .rec-popup-grid .cart-rec-image {
        margin-bottom: 6px !important;
        border-radius: 2px !important;
    }

    .rec-popup-grid .cart-rec-image img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 2 / 3 !important;
        object-fit: cover !important;
    }

    .rec-popup-grid .cart-rec-info {
        margin-bottom: 8px !important;
    }

    .rec-popup-grid .cart-rec-name {
        font-size: 12px !important;
        line-height: 1.35 !important;
        min-height: 32px !important;
        margin-top: 0 !important;
        margin-bottom: 4px !important;
        color: #222 !important;
    }

    .rec-popup-grid .cart-rec-price {
        font-size: 13.5px !important;
        font-weight: 700 !important;
        margin-bottom: 4px !important;
        line-height: 1.25 !important;
    }

    .rec-popup-grid .cart-rec-colors {
        margin-top: 4px !important;
        margin-bottom: 6px !important;
        min-height: 22px !important;
        gap: 6px !important;
    }

    .rec-popup-grid .cart-rec-color-btn .color-circle {
        width: 19px !important;
        height: 19px !important;
    }

    .rec-popup-grid .btn-rec-add {
        height: 38px !important;
        font-size: 11px !important;
        padding: 0 6px !important;
        letter-spacing: 0.6px !important;
    }
}