/* =========================
   WRAPPER
========================= */

.custom-search-wrapper {
    max-width: 1100px;
    margin: 25px auto;
    padding: 10px;
}

/* =========================
   SEARCH INPUT
========================= */

.custom-search-form {
    position: relative;
    display: flex;
}

.custom-search-input {
    width: 100%;
    height: 75px;            /* Zwiększona wysokość (z 60px) */
    border-radius: 24px;     /* Mniejsze zaokrąglenie (z 32px) - rogi są bardziej kwadratowe */
    border: 3px solid #000;  /* Pogrubione obramowanie (z 2px na 4px) */
    padding: 0 80px 0 24px;
    font-size: 24px;         /* Większy tekst wpisywany */
    outline: none;
    transition: border-color 0.2s ease;
}

.custom-search-input:focus {
    border-color: #ff5722;
}

/* =========================
   SEARCH BUTTON
========================= */

.custom-search-btn {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ff5722;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    z-index: 2;
}

.custom-search-btn:hover {
    background: #e64a19;
}

.custom-search-btn .search-icon {
    width: 38px !important;  /* Powiększona ikonka */
    height: 38px !important;
    fill: none;              /* Zmiana na none, żeby kontrolować obrys */
    stroke: #fff;            /* Kolor lupy */
    stroke-width: 2px;       /* POGRUBIENIE LINII LUPY */
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =========================
   INFO TEXT
========================= */

.custom-search-info {
    margin-top: 14px;
    margin-bottom: 10px;
    font-size: 15px;
    color: #555;
    text-align: center;
    transition: opacity 0.2s ease, height 0.2s ease;
}

.custom-search-info.is-hidden {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

/* =========================
   FILTERS GRID
========================= */

.custom-search-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 10px;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.custom-search-filters.is-hidden {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

/* =========================
   CUSTOM COMBOBOX STYLE
========================= */

.custom-filter {
    height: 48px;
    border-radius: 10px;
    border: 1px solid #ccc;
    padding: 0 14px;
    font-size: 15px;
    background-color: #fff;
    cursor: text;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

.custom-filter:focus {
    outline: none;
    border-color: #ff5722;
}

.custom-filter:disabled {
    background-color: #f2f2f2;
    border-color: #ddd;
    color: #999;
    cursor: not-allowed;
    background-image: none;
}

/* =========================
   AUTOCOMPLETE (MEILI)
========================= */

.custom-autocomplete {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* =========================
   AUTOCOMPLETE ITEM (GRID)
========================= */

.custom-autocomplete-item {
    display: grid;
    grid-template-columns: 72px 1fr 240px;
    gap: 14px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.custom-autocomplete-item:last-child {
    border-bottom: none;
}

.custom-autocomplete-item:hover,
.custom-autocomplete-item.active {
    background: #f7f7f7;
}

/* =========================
   LEFT – IMAGE
========================= */

.custom-autocomplete-item .ac-left img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 6px;
    background: #fafafa;
}

/* =========================
   CENTER – PART NUMBER + NAME
========================= */

.custom-autocomplete-item .ac-center {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-autocomplete-item .ac-code {
    font-size: 17px;
    font-weight: 700;
    color: #000;
}

.custom-autocomplete-item .ac-name {
    font-size: 15px;
    color: #555;
    line-height: 1.3;
}

/* =========================
   RIGHT – VEHICLES
========================= */

.custom-autocomplete-item .ac-right {
    font-size: 12px;
    color: #444;
    text-align: right;
    line-height: 1.4;
    white-space: normal;
}

/* =========================
   SELECTED VEHICLE
========================= */

.custom-selected-vehicle {
    margin-top: 15px;
    padding: 14px 18px;
    border-radius: 12px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 15px;
}

.custom-selected-vehicle strong {
    font-weight: 600;
    color: #333;
}

.custom-selected-vehicle span {
    flex: 1;
    color: #555;
}

.custom-selected-vehicle button {
    background: #ff5722;
    border: none;
    color: #fff;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.custom-selected-vehicle button:hover {
    background: #e64a19;
}

.custom-selected-vehicle button:active {
    transform: scale(0.96);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {

    .custom-search-filters {
        grid-template-columns: 1fr;
    }

    .custom-autocomplete-item {
        grid-template-columns: 56px 1fr;
    }

    .custom-autocomplete-item .ac-right {
        display: none;
    }

    .custom-selected-vehicle {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .custom-selected-vehicle button {
        align-self: flex-end;
    }
}


/* =========================================
   DESKTOP OPTIMIZATION (ONLY MIN-WIDTH 769px)
   ========================================= */

@media (min-width: 769px) {
    /* Powiększenie siatki, aby zmieścić większe elementy */
    .custom-autocomplete-item {
        grid-template-columns: 90px 1fr 280px; /* Zwiększono kolumnę zdjęcia i pojazdów */
        padding: 15px 20px; /* Większy odstęp wewnątrz wiersza */
    }

    /* Powiększenie zdjęcia */
    .custom-autocomplete-item .ac-left img {
        width: 80px;
        height: 70px;
    }

    /* Powiększenie numeru części */
    .custom-autocomplete-item .ac-code {
        font-size: 20px; /* Z 17px na 20px */
        margin-bottom: 4px;
    }

    /* Powiększenie nazwy przedmiotu */
    .custom-autocomplete-item .ac-name {
        font-size: 17px; /* Z 13px na 15px */
        color: #333; /* Nieco ciemniejszy kolor dla lepszej czytelności */
    }

    /* Powiększenie pojazdów (prawa strona) */
    .custom-autocomplete-item .ac-right {
        font-size: 14px; /* Z 12px na 14px */
        font-weight: 500;
        color: #222; /* Mocniejszy akcent na pojazd */
    }

/* =========================
   AUTOCOMPLETE (MEILI) - Zaktualizowana wysokość
   ========================= */

.custom-autocomplete {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    z-index: 1000;
    max-height: 550px; /* Zwiększono z 400px do 600px */
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* Opcjonalne: Stylizacja paska przewijania, aby lepiej wyglądał przy 600px */
.custom-autocomplete::-webkit-scrollbar {
    width: 8px;
}

.custom-autocomplete::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 12px;
}

.custom-autocomplete::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 12px;
}

.custom-autocomplete::-webkit-scrollbar-thumb:hover {
    background: #ff5722; /* Kolor pomarańczowy przy najechaniu */
}
}

/* =========================
   MOBILE OPTIMIZATION
   ========================= */

/* =========================================
   POPRAWKA MOBILNA: DYNAMICZNA WYSOKOŚĆ I ODSTĘPY
   ========================================= */

@media (max-width: 768px) {
    .custom-autocomplete-item {
        display: grid;
        /* Definiujemy dwie kolumny: lewa (zdjęcie), prawa (wszystkie teksty) */
        grid-template-columns: 80px 1fr;
        gap: 0 15px; /* 0 odstępu w pionie, 15px w poziomie między zdjęciem a tekstem */
        height: auto !important;
        padding: 12px;
        align-items: start;
    }

    /* ZDJĘCIE - Kolumna 1, rzędy od 1 do 4 (żeby teksty obok mogły się układać) */
    .custom-autocomplete-item .ac-left {
        grid-column: 1;
        grid-row: 1 / span 4;
    }

    /* NUMER CZĘŚCI - Kolumna 2, rząd 1 */
    .custom-autocomplete-item .ac-code {
        grid-column: 2;
        grid-row: 1;
        margin-bottom: 4px;
        line-height: 1.2;
    }

    /* POJAZD - Kolumna 2, rząd 2 (DOKŁADNIE POD NUMEREM) */
    .custom-autocomplete-item .ac-right {
        display: block !important;
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        margin-bottom: 8px;
        line-height: 1.3;
        white-space: normal;
    }

    /* NAZWA - Kolumna 2, rząd 3 (POD POJAZDEM) */
    .custom-autocomplete-item .ac-name {
        grid-column: 2;
        grid-row: 3;
        line-height: 1.4;
        white-space: normal;
    }

    /* Jeśli masz tam kontener ac-center, musimy go "rozbić", żeby nie blokował układu */
    .custom-autocomplete-item .ac-center {
        display: contents; /* To sprawia, że dzieci ac-center zachowują się jak bezpośrednie dzieci gridu */
    }
}


/* =========================
   POGRUBIENIE LINII ODDZIELAJĄCYCH
   ========================= */

.custom-autocomplete-item {
    /* Zmieniono z 1px solid #eee na 2px solid #ddd dla lepszej widoczności */
    border-bottom: 2px solid #ddd !important;
}

/* Usunięcie linii pod ostatnim elementem na liście */
.custom-autocomplete-item:last-child {
    border-bottom: none !important;
}


.search-tagline {
    text-align: center;      /* Środkowanie napisu */
    font-size: 22px;         /* Większy, wyraźny napis */
    font-weight: 800;        /* Bardzo gruby */
    color: #000;             /* Czarny kolor dla powagi */
    margin-bottom: 15px;     /* Odstęp od paska wyszukiwania */
    text-transform: uppercase; /* Opcjonalnie: wielkie litery dla siły przekazu */
}


.ac-warning {
    color: #c62828;        /* czerwony, nie agresywny */
    font-size: 13px;
    margin-top: 4px;
}

.ac-warning span {
    color: #b71c1c;
    font-weight: 500;
}


@media (max-width: 768px) {

    /* Ukryj filtry: Marka / Model / Generacja */
    .custom-search-filters {
        display: none !important;
    }

    /* Zmniejsz tekst hasła nad wyszukiwarką */
    .search-tagline {
        font-size: 14px !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
        text-align: center !important;
    }

}
/* ================================
   HOME PAGE – SEARCH – MOBILE TUNING
================================ */

@media (max-width: 768px) {

  /* Zwęż / wyśrodkuj wrapper */
  body#index .custom-search-wrapper {
    max-width: 99% !important;
    margin: 0 auto !important;
  }

  /* Input – wyższy */
  body#index .custom-search-input {
    height: 48px !important;              /* było 42 */
    font-size: 15px !important;
    padding: 0 52px 0 14px !important;    /* więcej miejsca na przycisk */
    border-radius: 16px !important;
  }

  /* Przycisk (kółko) – przesunięcie w prawo */
  body#index .custom-search-btn {
    width: 50px !important;               /* minimalnie większe */
    height: 50px !important;
    right: -8px !important;                /* 👈 +4px względem poprzedniego */
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  /* Ikona lupki */
  body#index .custom-search-btn .search-icon {
    width: 22px !important;
    height: 22px !important;
  }

  /* Hasło nad wyszukiwarką */
  body#index .search-tagline {
    font-size: 14px !important;
    line-height: 1.35 !important;
    margin-bottom: 2px !important;
    text-align: center !important;
  display: none !important;
  }

  /* Ukryj info text pod wyszukiwarką */
  body#index #vehicleInfoText {
    display: none !important;
  }

  body#index .custom-search-wrapper {
    margin-top: -10px !important;  /* 👈 10px wyżej */
  }

  body:not(#index) .custom-search-wrapper {
    display: none !important;
  }


}

/* =====================================================
   PRZYCISK „POZNAJ OFERTĘ” – TYLKO STRONA GŁÓWNA
   STYL JAK .parallax_button
   ===================================================== */

/* 🔒 DOMYŚLNIE UKRYTY WSZĘDZIE */
#poznaj-oferte {
    display: none !important;
}

/* ✅ WIDOCZNY TYLKO NA HOMEPAGE (DESKTOP + MOBILE) */
body#index #poznaj-oferte {
    display: inline-flex !important;
}

/* =========================
   STYL PRZYCISKU (1:1 jak parallax_button)
   ========================= */

body#index #poznaj-oferte {
    position: relative;
    align-items: center;
    justify-content: center;

    margin-top: 14px;
    padding: 8px 16px !important;

    border: 2px solid #000;
    background: transparent;
    border-radius: 6px !important;

    font-size: 0 !important; /* ukrywamy oryginalny tekst */
    text-decoration: none !important;

    transition: all 0.25s ease;
}

/* TEKST (pseudo-element) */
body#index #poznaj-oferte::after {
    content: "Poznaj naszą całą ofertę";
    display: inline-block;

    font-size: 20px;
    font-weight: 700;
    color: #000;
    line-height: 1;

    transform: translateY(3px);
    transition: color 0.25s ease;
}

/* HOVER */
body#index #poznaj-oferte:hover {
    text-decoration: none;
}

body#index #poznaj-oferte:hover::after {
    color: #F05A26;
}

/* FOCUS / ACTIVE */
body#index #poznaj-oferte:focus,
body#index #poznaj-oferte:active {
    text-decoration: none !important;
    outline: none !important;
}

/* =========================
   MOBILE – MNIEJSZY TEKST
   ========================= */

@media (max-width: 768px) {
    body#index #poznaj-oferte::after {
        font-size: 16px;
        transform: translateY(2px);
    }

    body#index #poznaj-oferte {
        padding: 7px 14px !important;
    }
}



/* =====================================================
   📱 MOBILE – STICKY SEARCH (STYL TYLKO PO SCROLLU)
   ===================================================== */
@media (max-width: 768px) {

  /* BAZA – ZAWSZE */
  body#index .custom-search-wrapper {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;

    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;

    width: 100% !important;
    transition: background .2s ease, box-shadow .2s ease, padding .2s ease;
  }

  /* ✅ TYLKO GDY JS DODA KLASĘ */
  body#index .custom-search-wrapper.is-sticky {
    background: #ffffff !important;          /* ⬜ biały pasek */
    box-shadow: 0 4px 12px rgba(0,0,0,.08);   /* 🌫️ cień */
    padding: 8px 0 !important;                /* oddech */
  }



}


@media (max-width: 768px) {

  /* PODSTRONY – pokaż wyszukiwarkę */
  body:not(#index) .custom-search-wrapper {
    display: block !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;

    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.08) !important;
    padding: 8px 12px !important;
  }

}


/* DOMYŚLNIE – desktop: 80% wysokości okna */
@media (min-width: 769px) {
  .custom-autocomplete {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* WYJĄTEK – HOME + NIE sticky → tylko 50vh */
@media (min-width: 769px) {
  body#index .custom-search-wrapper:not(.is-sticky) .custom-autocomplete {
    max-height: 60vh;
  }
}


/* =========================================
   MOBILE – TYTUŁ (ac-name) ZAWSZE NA SAMEJ GÓRZE
   ========================================= */

/* =====================================================
   MOBILE – KOLEJNOŚĆ: TYTUŁ → NR GŁÓWNY → NASZE NUMERY → POJAZD
   ===================================================== */

@media (max-width: 768px) {

    /* Pozwalamy dzieciom ac-center brać udział w gridzie */
    .custom-autocomplete-item .ac-center {
        display: contents;
    }

    /* TYTUŁ – ZAWSZE PIERWSZY */
    .custom-autocomplete-item .ac-name {
        grid-column: 2;
        grid-row: 1;
        font-weight: 600;
        margin-bottom: 4px;
    }

    /* NUMER GŁÓWNY CZĘŚCI (partLine1) */
    .custom-autocomplete-item .ac-code {
        grid-column: 2;
        grid-row: 2;
        margin-bottom: 4px;
    }

    /* NASZE DODATKOWE NUMERY CZĘŚCI (partLine2Html) */
    .custom-autocomplete-item .ac-code + .ac-code {
        grid-column: 2;
        grid-row: 3;
        font-weight: 400;
        opacity: 0.85;
        margin-bottom: 6px;
    }

    /* POJAZD – DOPIERO POD NUMERAMI */
    .custom-autocomplete-item .ac-right {
        display: block !important;
        grid-column: 2;
        grid-row: 4;
        text-align: left;
        line-height: 1.3;
        margin-bottom: 6px;
    }

    /* OSTRZEŻENIA – NA SAMYM DOLE */
    .custom-autocomplete-item .ac-warning {
        grid-column: 2;
        grid-row: 5;
    }
}

/* =========================================
   MOBILE – TYTUŁ JAK NA DESKTOPIE
   ========================================= */

@media (max-width: 768px) {

    .custom-autocomplete-item .ac-name {
        color: #000 !important;        /* czarny jak na desktopie */
        font-weight: 700 !important;   /* dokładnie to samo pogrubienie */
        font-size: 15px;               /* jak desktop (jeśli chcesz mniejsze, zmień na 14px) */
        line-height: 1.3;
        margin-bottom: 4px;
    }

}

@media (min-width: 769px) {

    .custom-autocomplete-item .ac-name {
       
        font-size: 17px !important;    
     
    }

}


/* =========================
   AUTOCOMPLETE – NO RESULTS (FULL WIDTH)
========================= */

.custom-autocomplete-item.no-results-item {
    display: block !important;          /* ⬅️ wyłącz GRID */
    width: 100% !important;
    box-sizing: border-box;
    cursor: default;
}

.custom-autocomplete-item.no-results-item .ac-center {
    width: 100%;
}

.custom-autocomplete-item.no-results-item .ac-center,
.custom-autocomplete-item.no-results-item .ac-name {
    text-align: center;
}
/* =========================
   AUTOCOMPLETE – NO RESULTS (CENTER BOTH)
========================= */

.custom-autocomplete-item.no-results-item {
    display: flex !important;
    align-items: center;        /* ⬆⬇ wyśrodkowanie pionowe */
    justify-content: center;    /* ⬅➡ wyśrodkowanie poziome */
    min-height: 30px;           /* wysokość paska (dopasuj jeśli chcesz) */
}

.custom-autocomplete-item.no-results-item .ac-center {
    width: 100%;
    text-align: center;
}

/* =========================
   MOBILE ONLY – NO RESULTS VISIBILITY FIX
========================= */
@media (max-width: 768px) {

    .custom-autocomplete {
        z-index: 10000 !important;
    }

    .custom-autocomplete-item.no-results-item {
        position: relative;
        z-index: 10001 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-height: 40px;          /* trochę mniejsze na telefon */
        background: #fff5f5;
    }

}

