.popup-container-search {
    width: 1200px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: fixed;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    z-index: 10007;
    max-width: 95vw;
    max-height: calc(100vh - 170px);
}

.popup-container-search.active {
    display: block;
}

/* Tło za popupem - przyciemnione */
.popup-overlay-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10006; 
    display: none;
}

.popup-overlay-bg.active {
    display: block;
}

.search-box {
    position: relative;
    z-index: 10008;
}

.input-container {
    position: relative;
    z-index: 10008;
}

.search-input {
   background-color: rgba(247, 247, 247, 1) !important;
}

.search-icon {
    position: absolute;
    right: 15px; 
    top: 50%;
    transform: translateY(-50%);
    z-index: 10009; 
    pointer-events: none; 
    color: #666; 
    font-size: 20px; 
}

.popup-container-search .popup-header {
    background-color: #f8f9fa;
    padding: 15px 25px;
    border-bottom: 1px solid #eaeaea;
}

.popup-container-search .popup-header h1 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* Content - wysokość ograniczona przez pozycję popupu względem viewportu */
.popup-container-search .popup-content {
    display: flex;
    padding: 0;
    height: 755px;
    max-height: calc(100vh - 225px);
    min-height: 300px;
}

.popup-container-search .left-section {
    flex: 4;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eaeaea;
}

.popup-container-search .featured-products {
    padding: 20px;
    border-bottom: 1px solid #eaeaea;
    flex-shrink: 0;
    min-height: 220px;
}

/* Matching products - kontener ze scrollem */
.popup-container-search .matching-products {
    padding: 20px 20px 0 20px; 
    background-color: #f9f9f9;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 300px;
}

/* Scrollowana lista produktów */
.popup-container-search .matching-products-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 15px;
}

.popup-container-search .products-view-all {
    flex-shrink: 0;
    padding: 15px 0;
    background: #f9f9f9;
    text-align: center;
    border-top: 2px solid #e0e0e0;
}

.popup-container-search .products-view-all .view-all  {
    display: inline-block;
    background: linear-gradient(to left, #e1001d 0%, #03294c 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    min-width: 40%;
}

.popup-container-search .view-all:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.popup-container-search .right-section {
    flex: 2;
    padding: 20px;
    background-color: #f9f9f9;
    border-left: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    min-height: 300px;
}

.popup-container-search .right-section .section-title {
    padding-left: 0;
    margin-left: 0;
    text-indent: 0;
}

.popup-container-search .ctn-popular-categories,
.popup-container-search .brands-section {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.popup-container-search .right-section > .section-title,
.popup-container-search .right-section > div > .section-title {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.popup-container-search .ctn-popular-categories ul {
    padding-left: 0;
    margin-left: 0;
}

.popup-container-search .ctn-popular-categories li {
    padding-left: 0;
    margin-left: 0;
}

.popup-container-search .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eaeaea;
}

.popup-container-search .product-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.popup-container-search .product-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.popup-container-search .product-image {
    width: 150px;
    height: 150px;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
}

#featured-product-container a {
    color: #333;
}

.matching-product-title a {
    color: #333;
}

.matching-product-title a:hover {
    text-decoration: underline;
}

.popup-container-search .product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.popup-container-search .product-details {
    flex: 1;
}

.popup-container-search .product-title {
    font-size: 14px;
    font-weight: normal;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
}

.popup-container-search .product-sku {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.popup-container-search .recomend-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 8px 0px;
}

/* DOSTĘPNOŚĆ PRODUKTÓW - ZACHOWANE */
.popup-container-search .available-tag {
    display: inline-block;
    color: #2e7d32;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.popup-container-search .matching-available-tag {
    display: inline-block;
    color: #2e7d32;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    flex: 0 0 auto;
    text-align: left;
}

.popup-container-search .matching-not-available-tag {
    display: inline-block;
    color: #d32f2f;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    flex: 0 0 auto;
    text-align: left;
}

.popup-container-search .add-to-cart {
    background: linear-gradient(to left, #e1001d 0%, #03294c 100%);
    color: white;
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    border: none;
    text-align: center;
    margin-top: 12px;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    font-family: Poppins, sans-serif;
    width: 100%;
}

.products-view-all a {
    background: linear-gradient(to left, #e1001d 0%, #03294c 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    min-width: 40%;
}

.products-view-all a:hover {
    opacity: 0.9;
}

.popup-container-search .add-to-cart:hover {
    opacity: 0.9;
}

.popup-container-search .close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    transition: all 0.3s;
}

.popup-container-search .product-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* Matching products items */
.popup-container-search .matching-product-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    min-height: 85px;
}

.popup-container-search .matching-product-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.popup-container-search .matching-product-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    padding: 3px;
}

.popup-container-search .matching-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.popup-container-search .matching-product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 75px;
}

.popup-container-search .matching-product-title {
    font-size: 13px;
    font-weight: normal;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 0 0 34px;
}

.popup-container-search .matching-product-sku {
    font-size: 11px;
    color: #666;
    margin: 1px 0;
    flex: 0 0 auto;
}

.popup-container-search .price-availability-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3px;
    flex: 0 0 auto;
}

.popup-container-search .matching-price {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    flex: 0 0 auto;
    text-align: right;
}

.popup-container-search .ctn-popular-categories {
    margin-bottom: 20px;
}

.popup-container-search .ctn-popular-categories:last-child {
    margin-bottom: 0;
}

.popup-container-search .ctn-popular-categories ul {
    list-style-type: none;
    padding: 0;
}

.popup-container-search .ctn-popular-categories li {
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.popup-container-search .ctn-popular-categories li span {
    font-weight: 500;
}

.popup-container-search .ctn-popular-categories li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.popup-container-search .ctn-popular-categories .category-name {
    font-size: 13px;
    color: #333;
}

/* Scrollbar styling - tylko dla lewej listy produktów */
.popup-container-search .matching-products-scroll::-webkit-scrollbar {
    width: 6px;
}

.popup-container-search .matching-products-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.popup-container-search .matching-products-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.popup-container-search .matching-products-scroll::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.popup-container-search .brands-section {
    margin-top: 0;
}

.popup-container-search .matching-product-item {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSYWNOŚĆ WYSOKOŚCI
 * top: 160px jest stały — popup nigdy nie wejdzie w input.
 * max-height: calc(100vh - 225px) ogranicza popup-content.
 * Poniższe media queries tylko zmniejszają featured-products i obrazki,
 * aby zawartość lepiej mieściła się przy niskiej rozdzielczości pionowej.
 */

@media (max-height: 800px) {
    .popup-container-search .featured-products {
        min-height: 190px;
    }
}

@media (max-height: 700px) {
    .popup-container-search .featured-products {
        min-height: 165px;
        padding: 15px 20px;
    }

    .popup-container-search .product-image {
        width: 120px;
        height: 120px;
    }
}

@media (max-height: 620px) {
    .popup-container-search .featured-products {
        min-height: 140px;
        padding: 12px 20px;
    }

    .popup-container-search .product-image {
        width: 100px;
        height: 100px;
    }

    .popup-container-search .matching-product-image {
        width: 65px;
        height: 65px;
    }

    .popup-container-search .recomend-product-price {
        font-size: 16px;
    }
}

@media (max-height: 520px) {
    .popup-container-search .featured-products {
        min-height: 110px;
        padding: 10px;
    }

    .popup-container-search .product-image {
        width: 80px;
        height: 80px;
    }

    .popup-container-search .matching-product-image {
        width: 55px;
        height: 55px;
    }

    .popup-container-search .section-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .popup-container-search .recomend-product-price {
        font-size: 15px;
    }

    .popup-container-search .matching-price {
        font-size: 14px;
    }

    .popup-container-search .available-tag,
    .popup-container-search .matching-available-tag,
    .popup-container-search .matching-not-available-tag {
        font-size: 10px;
    }
}




/* Wyłącz desktop popup poniżej 992px */
@media (max-width: 992px) {
    .popup-container-search {
        display: none !important;
    }
    
    .popup-container-search.active {
        display: none !important;
    }
    
    .popup-overlay-bg {
        display: none !important;
    }
    
    .popup-overlay-bg.active {
        display: none !important;
    }
}

/* Zmniejsz z-index inputa dla mobile */
@media (max-width: 992px) {
    .search-box {
        z-index: 1;
    }
    
    .input-container {
        z-index: 1;
    }
    
    .search-input {
        z-index: 1;
    }
    
    .search-icon {
        z-index: 2;
    }
}

#view-all-products-link {
    display: none;
}

@media screen and (max-width: 1250px) {
    .popup-container-search {
        width: 1000px;
        max-width: 92vw;
    }
}

@media screen and (max-width: 1050px) {
    .popup-container-search {
        width: 940px;
        max-width: 90vw;
    }
}