/**
 * Custom Header Type 8 - Barre de recherche en haut style Konect
 * Ce fichier est chargé en dernier pour surcharger les styles Porto sans !important
 */

/* Side Megamenu - Texte blanc comme le reste du header */
.page-header.type8 .sw-megamenu.navigation.side-megamenu {
    color: #fff;
}

.page-header.type8 .sw-megamenu.navigation.side-megamenu li.level0 > a {
    color: #fff;
}

.page-header.type8 .sw-megamenu.navigation.side-megamenu li.level0:hover > a {
    color: #fff;
}

.page-header.type8 .sw-megamenu.navigation.side-megamenu li.level0.active {
    background-color: #08c;
}

.page-header.type8 .sw-megamenu.navigation.side-megamenu li.level0.active > a {
    color: #fff;
}

/* header.links - Texte blanc */
.page-header.type8 .header.panel .header.links,
.page-header.type8 .header.panel .header.links li,
.page-header.type8 .header.panel .header.links li a {
    color: #fff;
}

/* Layout du bandeau supérieur Type 8 - Style Konect */
.page-header.type8 .main-panel-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background-color: #222529;
    padding: 10px 20px;
    box-shadow: none;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header.type8 .main-panel-top .container-fluid {
    max-width: 100%;
    padding: 0;
}

/* Flexbox layout pour le bandeau supérieur */
.page-header.type8 .type8-top-search-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.page-header.type8 .type8-top-search-layout .panel.wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Section gauche - Logo */
.page-header.type8 .type8-top-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.page-header.type8 .type8-top-left .logo {
    max-width: 150px;
    margin: 0;
    padding: 0;
}

.page-header.type8 .type8-top-left .logo img {
    max-height: 40px;
    width: auto;
}

/* Section centrale - Barre de recherche - Centrage fixe par rapport à l'écran */
.page-header.type8 .type8-top-search {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 650px;
    padding: 0 20px;
    z-index: 1002;
}

.page-header.type8 .type8-top-search .search-area-top {
    width: 100%;
}

.page-header.type8 .type8-top-search .block-search {
    width: 100%;
    margin: 0;
    padding: 0;
}

.page-header.type8 .type8-top-search .block-search .block-content {
    width: 100%;
}

.page-header.type8 .type8-top-search .block-search form.minisearch {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.page-header.type8 .type8-top-search .block-search .field.search {
    flex: 1;
    margin: 0;
    padding: 0;
}

.page-header.type8 .type8-top-search .block-search .control {
    width: 100%;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0;
    background: #fff;
    position: relative;
    display: flex;
    align-items: center;
}

/* Icône de recherche */
.page-header.type8 .type8-top-search .block-search .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #888;
    pointer-events: none;
    z-index: 1;
}

.page-header.type8 .type8-top-search .block-search input#search {
    width: 100%;
    height: 44px;
    padding: 10px 15px 10px 45px;
    border: none;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    color: #333;
    box-shadow: none;
}

.page-header.type8 .type8-top-search .block-search input#search:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.page-header.type8 .type8-top-search .block-search input#search::placeholder {
    color: #888;
}

/* Masquer l'autocomplete natif Magento - on utilise Mageplaza */
.page-header.type8 .type8-top-search .block-search .search-autocomplete,
#search_autocomplete {
    display: none !important;
}

/* Mageplaza Search Autocomplete Dropdown */
.page-header.type8 .type8-top-search .autocomplete-suggestions {
    position: fixed;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 610px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1003;
    max-height: 400px;
    overflow-y: auto;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .mpsearch-list {
    padding: 0;
    margin: 0;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .mpsearch-list-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .mpsearch-list-item:hover {
    background-color: #f5f5f5;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .result-wrapper {
    display: flex;
    align-items: center;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .result-thumbnail {
    display: none;
}

/* Masquer les images (thumbnails) dans l'autocomplete Mageplaza - garder le prix visible */
.autocomplete-suggestions .suggestion-left,
.autocomplete-suggestions .result-thumbnail {
    display: none !important;
}

/* Style du prix dans l'autocomplete */
.autocomplete-suggestions .product-price {
    display: block !important;
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

/* Option "Rechercher [terme]" en haut de l'autocomplete */
.autocomplete-suggestions .mpsearch-search-all {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background-color: #f8f8f8;
}

.autocomplete-suggestions .mpsearch-search-all .mpsearch-search-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #222529;
    text-decoration: none;
    font-size: 14px;
}

.autocomplete-suggestions .mpsearch-search-all .mpsearch-search-link:hover {
    color: #0066cc;
}

.autocomplete-suggestions .mpsearch-search-all .mpsearch-search-link i {
    font-size: 16px;
    color: #666;
}

.autocomplete-suggestions .mpsearch-search-all .mpsearch-search-link strong {
    font-weight: 600;
}

/* Headers de groupe dans l'autocomplete */
.autocomplete-suggestions .autocomplete-group {
    padding: 10px 15px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.autocomplete-suggestions .autocomplete-group:not(:first-child) {
    border-top: 1px solid #ddd;
    margin-top: 5px;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .result-sub-content .name {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}

.page-header.type8 .type8-top-search .autocomplete-suggestions .result-sub-content .product-price {
    font-size: 13px;
    color: #222529;
    font-weight: 600;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li:last-child {
    border-bottom: none;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li a,
.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li span {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li:hover,
.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li.selected {
    background-color: #f5f5f5;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li .amount {
    float: right;
    color: #888;
    font-size: 12px;
}

.page-header.type8 .type8-top-search .block-search .search-autocomplete ul li .qs-option-name {
    font-weight: 500;
}

/* Bouton de recherche - masqué */
.page-header.type8 .type8-top-search .block-search .actions,
.page-header.type8 .type8-top-search .block-search button,
.page-header.type8 .type8-top-search .block-search .action.search,
.page-header.type8 .type8-top-search form.minisearch .actions,
.page-header.type8 .type8-top-search form.minisearch button {
    display: none;
    visibility: hidden;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    left: -9999px;
}

/* Masquer le sélecteur de catégories */
.page-header.type8 .type8-top-search .search-category {
    display: none;
}

/* Masquer le lien recherche avancée */
.page-header.type8 .type8-top-search .nested {
    display: none;
}

/* Section droite - Connexion et panier */
.page-header.type8 .type8-top-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-header.type8 .type8-top-right .my-account {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    background-color: transparent;
    border: 1px solid #fff;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.page-header.type8 .type8-top-right .my-account:hover {
    background-color: #fff;
    color: #222529;
}

.page-header.type8 .type8-top-right .my-account:hover i {
    color: #222529;
}

.page-header.type8 .type8-top-right .my-account i {
    font-size: 16px;
    color: #fff;
    transition: color 0.3s ease;
}

.page-header.type8 .type8-top-right .label-login {
    display: inline;
    color: inherit;
}

/* Flèche dropdown */
.page-header.type8 .type8-top-right .type8-dropdown-arrow {
    font-size: 10px;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.page-header.type8 .type8-account-wrapper.logged-in .type8-account-menu.active ~ .my-account .type8-dropdown-arrow,
.page-header.type8 .type8-account-wrapper .type8-account-menu.active + .my-account .type8-dropdown-arrow {
    transform: rotate(180deg);
}

/* Wrapper du compte */
.page-header.type8 .type8-account-wrapper {
    position: relative;
}

/* Menu déroulant du compte */
.page-header.type8 .type8-account-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    padding: 8px 0;
    list-style: none;
    z-index: 1002;
}

.page-header.type8 .type8-account-menu.active {
    display: block;
}

.page-header.type8 .type8-account-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
}

.page-header.type8 .type8-account-menu li {
    margin: 0;
    padding: 0;
}

.page-header.type8 .type8-account-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.page-header.type8 .type8-account-menu li a:hover {
    background-color: #f5f5f5;
    color: #222529;
}

.page-header.type8 .type8-account-menu li a i {
    font-size: 16px;
    color: #666;
    width: 20px;
    text-align: center;
}

.page-header.type8 .type8-account-menu li a:hover i {
    color: #222529;
}

/* Séparateur avant déconnexion */
.page-header.type8 .type8-account-menu .type8-logout-item {
    border-top: 1px solid #eee;
    margin-top: 8px;
    padding-top: 8px;
}

.page-header.type8 .type8-account-menu .type8-logout-item a {
    color: #e74c3c;
}

.page-header.type8 .type8-account-menu .type8-logout-item a:hover {
    background-color: #fef2f2;
}

.page-header.type8 .type8-account-menu .type8-logout-item a i {
    color: #e74c3c;
}

/* Mini panier */
.page-header.type8 .type8-top-right .minicart-wrapper {
    margin-left: 10px;
}

.page-header.type8 .type8-top-right .minicart-wrapper .action.showcart {
    color: #fff;
}

.page-header.type8 .type8-top-right .minicart-wrapper .minicart-icon {
    font-size: 24px;
    color: #fff;
}

.page-header.type8 .type8-top-right .minicart-wrapper .counter.qty {
    background-color: #e74c3c;
}

/* Masquer le texte "Cart" du minicart */
.page-header.type8 .type8-top-right .minicart-wrapper .text {
    display: none;
}

/* Masquer la recherche dans la sidebar */
.page-header.type8 .header-main .sidebar-search-hidden {
    display: none;
}

/* Masquer le logo dans la sidebar (il est dans la barre du haut) */
.page-header.type8 .header-main .header-left .logo {
    display: none;
}

/* Ajustement de la sidebar pour ne pas être couverte par le header fixe */
.page-header.type8 .header-main {
    margin-top: 64px;
}

/* Ajustement du contenu du site notice (bandeau promo) */
.page-header.type8 ~ .site-notice,
.site-notice {
    margin-top: 64px;
}

/* Responsive - Tablette */
@media (max-width: 991px) {
    .page-header.type8 .type8-top-search {
        max-width: 400px;
    }

    .page-header.type8 .type8-top-right .label-login {
        display: none;
    }

    .page-header.type8 .type8-top-right .my-account {
        padding: 10px 12px;
    }

    .page-header.type8 .type8-top-left .logo img {
        max-height: 35px;
    }
}

/* Filtres de catégorie dans l'autocomplete */
.autocomplete-suggestions .mpsearch-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 15px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.autocomplete-suggestions .mpsearch-filter {
    display: inline-block;
    padding: 6px 14px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.autocomplete-suggestions .mpsearch-filter:hover {
    border-color: #222529;
    color: #222529;
}

.autocomplete-suggestions .mpsearch-filter.active {
    background-color: #222529;
    border-color: #222529;
    color: #fff;
}

/* Responsive - Mobile */
@media (max-width: 767px) {
    .page-header.type8 .main-panel-top {
        padding: 8px 10px;
    }

    .page-header.type8 .type8-top-search-layout .panel.wrapper {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .page-header.type8 .type8-top-left {
        order: 1;
    }

    .page-header.type8 .type8-top-left .logo img {
        max-height: 30px;
    }

    .page-header.type8 .type8-top-search {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
        margin: 10px 0 0 0;
        padding: 0;
        z-index: auto;
    }

    .page-header.type8 .type8-top-right {
        order: 2;
        margin-left: auto;
    }

    .page-header.type8 .header-main {
        margin-top: 110px;
    }
}

