/* PrzydasieRecombee - Frontend Styles */

.przydasie-recommendations {
    margin: 2em 0;
    clear: both;
}

.przydasie-recommendations h2 {
    margin-bottom: 1em;
    font-size: 1.5em;
}

.przydasie-recommendations ul.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5em;
    list-style: none;
    padding: 0;
    margin: 0;
}

.przydasie-recommendations ul.products li.product {
    margin: 0;
    padding: 0;
    width: 100%;
    float: none;
}

@media (max-width: 768px) {
    .przydasie-recommendations ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1em;
    }
}

@media (max-width: 480px) {
    .przydasie-recommendations ul.products {
        grid-template-columns: 1fr;
    }
}

/* Slider mode - disable grid, let Slick.js handle layout */
.related.products.przydasie-recommendations ul.products {
    display: block;
    grid-template-columns: none;
    gap: 0;
}

.related.products.przydasie-recommendations {
    margin: 0;
}

/* Cart page - full width container */
.woocommerce-cart .przydasie-recommendations {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2em 15px;
}

/* ============================================================
   Add-to-cart popup modal
   ============================================================ */

/* Hide xoo-wsc side cart when our popup is open */
body.przydasie-cart-popup-open .xoo-wsc-modal,
body.przydasie-cart-popup-open .xoo-wsc-container,
body.przydasie-cart-popup-open .xoo-wsc-opac {
    display: none !important;
    visibility: hidden !important;
}

.przydasie-cart-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.przydasie-cart-popup.is-open {
    display: block;
}

.przydasie-cart-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: przydasieOverlayIn 0.2s ease;
}

@keyframes przydasieOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.przydasie-cart-popup__content {
    position: absolute;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 560px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow-y: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: przydasieModalIn 0.25s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

@keyframes przydasieModalIn {
    from { opacity: 0; transform: translate(-50%, -46%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.przydasie-cart-popup__close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b8bbf;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.przydasie-cart-popup__close:hover {
    color: #001a4d;
    background: #e8eef8;
}

.przydasie-cart-popup__added-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: #1e549e;
    margin-bottom: 16px;
}

.przydasie-cart-popup__added-product {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #d0ddf0;
    margin-bottom: 16px;
}

.przydasie-cart-popup__added-product-image {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    background: #edf2fb;
}

.przydasie-cart-popup__added-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.przydasie-cart-popup__added-product-info {
    flex: 1;
    min-width: 0;
}

.przydasie-cart-popup__added-product-name {
    margin: 0 0 4px;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    color: #001a4d;
    white-space: normal;
}

.przydasie-cart-popup__added-product-price {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e549e;
}

.przydasie-cart-popup__actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.przydasie-cart-popup__actions .button {
    flex: 1;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}

.przydasie-cart-popup__continue {
    background: #fff !important;
    color: #12b300 !important;
    border: 1px solid #12b300 !important;
}

.przydasie-cart-popup__continue:hover {
    background: #f0fbe9 !important;
}

.przydasie-cart-popup__go-to-cart {
    background: #12b300 !important;
    color: #fff !important;
    border: 1px solid #12b300 !important;
}

.przydasie-cart-popup__go-to-cart:hover {
    background: #0e9400 !important;
    color: #fff !important;
}

/* Recommendations section */

.przydasie-cart-popup__recommendations-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 14px;
    color: #001a4d;
}

.przydasie-cart-popup__recommendations-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.przydasie-cart-popup__rec-item {
    border: 1px solid #d0ddf0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f5f8fd;
    transition: box-shadow 0.15s;
}

.przydasie-cart-popup__rec-item:hover {
    box-shadow: 0 2px 10px rgba(0, 58, 140, 0.12);
}

.przydasie-cart-popup__rec-item a.przydasie-cart-popup__rec-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.przydasie-cart-popup__rec-image {
    aspect-ratio: 1;
    overflow: hidden;
    background: #edf2fb;
}

.przydasie-cart-popup__rec-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.przydasie-cart-popup__rec-info {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.przydasie-cart-popup__rec-name {
    font-size: 0.78rem;
    line-height: 1.3;
    color: #001a4d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.przydasie-cart-popup__rec-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e549e;
    margin-top: auto;
}

.przydasie-cart-popup__rec-add {
    margin: 0 8px 8px;
    width: calc(100% - 16px);
    text-align: center;
    padding: 7px 8px;
    font-size: 0.78rem;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #12b300;
    background: #fff;
    color: #12b300;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.przydasie-cart-popup__rec-add:hover {
    background: #12b300;
    color: #fff;
}

.przydasie-cart-popup__rec-add.loading {
    opacity: 0.6;
    pointer-events: none;
}

.przydasie-cart-popup__rec-add.added {
    background: #12b300;
    color: #fff;
    border-color: #12b300;
    pointer-events: none;
    cursor: default;
}

/* Loading spinner */

.przydasie-cart-popup__recommendations-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
}

.przydasie-cart-popup__loading-text {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.przydasie-cart-popup__spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #d4f0cd;
    border-top-color: #12b300;
    border-radius: 50%;
    animation: przydasieSpin 0.7s linear infinite;
}

@keyframes przydasieSpin {
    to { transform: rotate(360deg); }
}

/* Mobile - bottom sheet */

@media (max-width: 600px) {
    .przydasie-cart-popup__content {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        transform: none;
        border-radius: 16px 16px 0 0;
        max-height: 88vh;
        animation: przydasieSheetIn 0.28s ease;
    }

    @keyframes przydasieSheetIn {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .przydasie-cart-popup__recommendations-list {
        grid-template-columns: repeat(3, 1fr);
    }
}
