/* --- Reset CSS --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- Globalne Style --- */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    color: #333;
}

/* --- Układ Główny (Dla desktopu w rzędzie) --- */
.main-wrapper {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    display: flex;
    flex-direction: row; /* Wymuś układ w rzędzie */
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 20px;
    flex-grow: 1;
}

/* --- Nagłówek (Header) --- */
header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    border-bottom: 3px solid #007bff;
}

.header-content {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo img {
    height: 50px;
}

.main-nav ul {
    display: flex;
}

.main-nav ul li {
    margin-left: 20px;
}

.main-nav ul li a {
    color: #fff;
    padding: 5px 10px;
    transition: background-color 0.3s ease;
}

.main-nav ul li a:hover {
    background-color: #0056b3;
    border-radius: 4px;
    text-decoration: none;
}

.lang-selector img {
    width: 24px;
    height: 24px;
    margin-left: 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
}

/* --- Sidebar --- */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    align-self: flex-start;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease-in-out;
}

.sidebar.hidden {
    display: none;
}

.sidebar-content {
    position: sticky;
    top: 20px;
}

/* Style for the show sidebar toggle button */
.show-sidebar-toggle-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background-color: #28a745;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

.show-sidebar-toggle-button:hover {
    background-color: #218838;
}

.sidebar-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-section h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #007bff;
}

.sidebar input[type="text"] {
    width: calc(100% - 60px);
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    vertical-align: middle;
}

.sidebar button {
    padding: 8px 12px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    vertical-align: middle;
}

.sidebar button:hover {
    background-color: #0056b3;
}

.sidebar ul {
    padding-left: 15px;
}

.sidebar ul li a {
    display: block;
    padding: 5px 0;
    color: #555;
}

.sidebar ul li a:hover {
    color: #007bff;
    text-decoration: none;
}

.sidebar ul ul {
    padding-left: 25px;
    border-left: 1px dashed #eee;
    margin-top: 5px;
}

.sidebar .filters-section label {
    display: block;
    margin-bottom: 5px;
}

/* --- Główna Zawartość (Content Area) --- */
.main-content {
    flex-grow: 1;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease-in-out;
}

/* --- Stopka (Footer) --- */
footer {
    background: #333;
    color: #fff;
    padding: 1.5rem 0;
    margin-top: 30px;
    text-align: center;
}

.footer-content {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.9em;
}

.footer-content p {
    margin: 5px 0;
}

.footer-nav ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-nav ul li {
    margin: 0 10px;
}

.footer-nav ul li a {
    color: #fff;
    transition: color 0.3s ease;
}

.footer-nav ul li a:hover {
    color: #007bff;
    text-decoration: none;
}

.copyright {
    text-align: right;
}

/* --- Sekcje strony głównej --- */
.featured-products-section {
    padding: 20px 0;
    text-align: center;
}

.featured-products-section h2 {
    margin-bottom: 30px;
    font-size: 2em;
    color: #333;
}

/* --- Układ produktów (za pomocą flexboxa) --- */
.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

/* Domyślnie 3 kolumny, gdy sidebar jest widoczny */
.product-grid .product-card {
    flex: 1 1 calc(33.333% - 13.333px);
    min-width: 280px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Przełączenie na 4 kolumny, gdy sidebar jest ukryty */
.main-wrapper > .sidebar.hidden + .main-content .product-grid .product-card {
    flex: 1 1 calc(25% - 15px);
}

.product-card img {
    max-width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    margin: 0 auto 15px auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

.product-card h3 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #0056b3;
    min-height: 50px;
}

.product-card .catalog-number {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.product-card p {
    font-size: 1em;
    color: #444;
    line-height: 1.5;
    flex-grow: 1;
}

.product-card .button {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    align-self: flex-start;
}

.product-card .button:hover {
    background-color: #0056b3;
}

/* --- Responsywność: Media Queries --- */

/* Dla dużych tabletów i małych desktopów */
@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid .product-card {
        flex: 1 1 calc(50% - 10px); /* 2 kolumny */
    }
    .main-wrapper > .sidebar.hidden + .main-content .product-grid .product-card {
        flex: 1 1 calc(33.333% - 13.333px); /* 3 kolumny bez sidebara */
    }
}

/* Dla tabletów i telefonów */
@media (max-width: 768px) {
    .header-content, .footer-content, .main-wrapper {
        flex-direction: column;
        text-align: center;
    }

    .main-nav ul {
        flex-direction: column;
        margin-top: 15px;
    }

    .main-nav ul li {
        margin: 5px 0;
    }

    .lang-selector {
        margin-top: 15px;
    }

    /* Na małych ekranach sidebar na całą szerokość */
    .sidebar {
        width: 100%;
        padding: 15px;
        margin: 0;
    }

    .sidebar.hidden {
        display: none;
    }

    .main-wrapper {
        gap: 0;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        padding: 15px;
    }

    .footer-nav ul {
        margin-top: 10px;
    }

    /* Na mobile zawsze 1 kolumna */
    .product-grid .product-card {
        flex: 1 1 100%;
        min-width: unset;
    }
}

/* --- Style dla lightboxa --- */
#lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.lightbox-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
}

.lightbox-close-btn:hover {
    color: #ccc;
}

.product-details .product-image img {
    max-width: 500px;
    height: auto;
    cursor: pointer;
}
/* Style dla sidebara i kategorii */
.sidebar .category-list h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-color-dark);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.categories-root,
.subcategories {
    list-style-type: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.subcategories {
    padding-left: 1.25rem;
    max-height: 0; /* Domyślnie podkategorie są ukryte */
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.subcategories.open {
    max-height: 500px; /* Wartość wystarczająco duża, aby pomieścić wszystkie podkategorie */
}

.category-item {
    position: relative;
    padding: 0.25rem 0;
    color: var(--text-color-medium);
}

.category-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding-right: 2rem;
}

/* Nowy styl podświetlenia dla kategorii */
.category-item a {
    color: var(--text-color-dark);
    display: block;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.category-item a:hover {
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

.category-item.has-children {
    font-weight: bold;
}

/

/* Dodajemy margines dla linków, aby nie nachodziły na plusik */
.category-item.has-children > a {
    padding-left: 1.5rem;
}

.expand-toggle::before {
    content: '+';
    display: block;
}

.category-item.has-children > a {
    font-weight: bold; /* Pogrubienie tylko rodziców */
}
/* --- Poprawki dla drzewa kategorii --- */
.category-list h3 {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.categories-root,
.subcategories {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.subcategories {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.subcategories.open {
    max-height: 500px;
    padding-left: 1rem; /* Wcięcie dla podkategorii */
}

.category-item {
    position: relative;
    padding: 0.25rem 0;
}

/* Styl dla kategorii z podkategoriami (klikanej) */
.category-item.has-children > a {
    display: block;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    cursor: pointer;
}

/* Zapewniamy, że hover działa */
.category-item.has-children > a:hover {
    background-color: #0056b3;
    text-decoration: none;
}

/* Styl dla plusika wewnątrz klikalnego przycisku */
.category-item.has-children .expand-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Styl dla kategorii końcowych (parter) */
.category-item:not(.has-children) a {
    display: block;
    color: var(--text-color-dark);
    font-weight: normal;
    padding: 0.5rem 1rem;
    text-decoration: none;
}

.category-item:not(.has-children) a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}
/* Poprawka koloru tekstu dla klikalnych kategorii */
.category-item.has-children > a {
    color: #fff;
}
/* Poprawka koloru tekstu dla linków w drzewie kategorii */
.sidebar .category-list a {
    color: var(--text-color-dark); /* Ustawia kolor na ciemny */
}

/* Opcjonalnie: poprawa wyglądu dla kategorii z podkategoriami */
.category-item.has-children a {
    font-weight: bold;
}
/* Poprawka koloru tekstu dla linków w drzewie kategorii */
.sidebar .category-list a {
    color: var(--text-color-dark); /* Ustawia kolor na ciemny */
}

/* Opcjonalnie: poprawa wyglądu dla kategorii z podkategoriami */
.category-item.has-children a {
    font-weight: bold;
}
/* Wymuszenie koloru tekstu w menu kategorii, aby był widoczny */
.sidebar .category-list a {
    color: var(--text-color-dark) !important;
}
/* Nowy, bardziej precyzyjny styl podświetlenia dla kategorii */
.sidebar .category-list .category-item a:hover {
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
}
/* Styl dla kategorii z podkategoriami (niebieski tekst, białe tło) */
.category-item.has-children > a {
    color: #fff;
    font-weight: bold;
    background-color: var(--primary-color);
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

/* Styl po najechaniu na kategorię z podkategoriami */
.category-item.has-children > a:hover {
    background-color: #0056b3; /* Ciemniejszy odcień primary-color */
    text-decoration: none;
}

/* Styl dla kategorii końcowych (czarny tekst, bez tła) */
.category-item:not(.has-children) a {
    color: var(--text-color-dark);
    font-weight: normal;
    background-color: transparent;
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Styl po najechaniu na kategorię końcową */
.category-item:not(.has-children) a:hover {
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
}
/* --- Style dla breadcrumbs --- */
.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.breadcrumbs a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.breadcrumbs a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.breadcrumbs .active {
    color: #333;
    font-weight: bold;
}
/* Style dla sidebara */
.sidebar {
    /* ... inne style ... */
}

.sidebar .category-list {
    /* ... inne style ... */
    line-height: 1.0; /* Zmniejszamy interlinie dla zagęszczenia tekstu */
}

/* Lub, jeśli chcesz dostosować tylko elementy listy */
.sidebar .category-item {
    line-height: 1.0; /* Zmniejszamy interlinie dla elementów li */
    margin-bottom: 0.2rem; /* Opcjonalnie: dodajemy mały odstęp na dole */
}

/* Możesz też zmniejszyć padding dla linków, aby były bliżej siebie */
.sidebar .category-item a {
    padding: 0.2rem 0; /* Zmniejszamy odstępy w górę i dół */
    display: block;
}
/* Style dla ceny i przycisku "Zapytaj o cenę" */
.product-price-section {
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #004d99; /* Ciemnoniebieski */
}

.product-price .price-value {
    font-weight: bold;
    color: #004d99;
}

.product-price .price-info {
    font-size: 0.8rem;
    font-weight: normal;
    color: #004d99;
}

.button-price-request {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #004d99; /* Zmieniony kolor przycisku */
    color: white;
    font-weight: bold;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    text-align: center;
    margin-top: 1rem;
}

.button-price-request:hover {
    background-color: #003366; /* Ciemniejszy niebieski na hover */
}
/* Stylizacja Pop-upu Formularza Kontaktowego */
.popup-overlay {
    display: none; /* To powinno go ukrywać domyślnie, ale coś jest nie tak */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    width: 90%;
    max-width: 500px;
    animation: fadeIn 0.3s ease-out; /* Animacja pojawiania się */
}

.popup-content h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.popup-content form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.popup-content form input[type="text"],
.popup-content form input[type="email"],
.popup-content form textarea {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.popup-content form textarea {
    resize: vertical; /* Pozwala na zmianę wysokości */
    min-height: 100px;
}

.popup-content form input[type="text"]:focus,
.popup-content form input[type="email"]:focus,
.popup-content form textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

.popup-content .button {
    width: 100%;
    padding: 12px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.2s ease;
}

.popup-content .button:hover {
    background-color: #0056b3;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-button:hover {
    color: #333;
}

/* Animacja Fade In dla pop-upu */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Użyj tej klasy do wyświetlania pop-upu za pomocą JavaScript */
.popup-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex; /* lub block, zależnie od ustawienia */
}
.error {
  border: 1px solid red;
  background-color: #ffe6e6;
}

.error-message {
  color: red;
  font-size: 12px;
  margin-left: 5px;
}
.product-actions {
    /* Ustawienie przycisków w jednym rzędzie i z odstępami */
    display: flex;
    gap: 20px; /* Określa odstęp między elementami */
    align-items: center; /* Wyrównuje elementy w pionie */
}
/* Stylizacja dla obrazka na karcie produktu */
.product-details .product-image {
  width: 300px;  /* Ustawia stałą szerokość kontenera na 300 pikseli */
  height: 300px; /* Ustawia stałą wysokość kontenera na 300 pikseli */
  overflow: hidden; /* Ukrywa wszystko, co wykracza poza te wymiary */
  display: flex; /* Używa flexbox do wyśrodkowania obrazka */
  justify-content: center;
  align-items: center;
}

/* Stylizacja dla samego obrazka wewnątrz kontenera */
.product-details .product-image img {
  max-width: 100%; /* Obrazek będzie miał maksymalnie 100% szerokości kontenera */
  max-height: 100%; /* Obrazek będzie miał maksymalnie 100% wysokości kontenera */
  object-fit: contain; /* Zapewnia, że obrazek zmieści się w kontenerze, zachowując proporcje */
}
.contact-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.contact-form-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

.contact-form-container form {
    display: flex; /* Użyjemy flexbox, aby ułatwić pionowy układ */
    flex-direction: column; /* Ustawiamy kierunek na kolumnę */
}

.contact-form-container label {
    margin-top: 15px; /* Dodaj odstęp nad etykietami */
    font-weight: bold;
    color: #333;
}

.contact-form-container input[type="text"],
.contact-form-container input[type="email"],
.contact-form-container textarea {
    width: 100%; /* Rozciągnij pola na całą szerokość */
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.g-recaptcha {
    margin-top: 15px; /* Dodaj odstęp nad reCAPTCHA */
    margin-bottom: 15px;
}

.contact-form-container button {
    width: 100%; /* Rozciągnij przycisk na całą szerokość */
    padding: 12px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.contact-form-container button:hover {
    background-color: #0056b3;
}