/**
 * Bloc Recherche Produit - Styles
 *
 * @package MediaPilote
 */

/* Import des polices */

.block-recherche-produit {
    position: relative;
    background-color: #f6f6f1;
    padding: 150px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 45px;
    isolation: isolate;
    z-index: 1;
}

@media (max-width: 1000px){
    .block-recherche-produit + .wp-block-spacer{
        display: none;
    }
}

.block-recherche-produit__container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 45px;
    z-index: 1002;
    position: relative;
}

.block-recherche-produit__header {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.block-recherche-produit__title {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 1050px){
    .block-recherche-produit__title {
        flex-direction: column;
    }
       
}

.block-recherche-produit__title-text {
    font-family: 'Figtree', sans-serif;
    font-weight: 700;
    font-size: 35px;
    line-height: 1;
    color: #000000;
    text-transform: uppercase;
    margin: 0;
    white-space: nowrap;
}

/* Dropdown styles */
.block-recherche-produit__dropdown {
    position: relative;
    z-index: 1002;
}

.block-recherche-produit__dropdown-trigger {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-family: 'Figtree', sans-serif;
    font-weight: 700;
    font-size: 35px;
    line-height: 1;
    color: #8a8a88;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.block-recherche-produit__dropdown-trigger:hover {
    color: #1d1d1b;
}

.block-recherche-produit__dropdown-text {
    padding-top: 3px;
    line-height: 1;
}

/* Barre clignotante pour l'effet de machine à écrire */
.typing-cursor {
    display: inline-block;
    width: 1px;
    height: 1em;
    animation: blink 1s infinite;
    vertical-align: middle;
    top: -3px;
    position: relative;
    margin-left: 10px;
    margin-right: 10px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.block-recherche-produit__dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: #ffe04b;
    border-radius: 60px;
    padding: 3px 0 0 0;
    transition: transform 0.3s ease;
}

.block-recherche-produit__dropdown-icon svg {
    width: 10.982px;
    height: 10.982px;
    color: #1d1d1b;
}

.block-recherche-produit__dropdown-trigger[aria-expanded="true"] .block-recherche-produit__dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown menu - Liste des choix */
.block-recherche-produit__dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001; /* Niveau 2 : Menu déroulant */
    min-width: 300px;
    /* Empêcher le scroll automatique */
    scroll-behavior: auto;
    /* Empêcher la sélection de texte */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.block-recherche-produit__dropdown-menu.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.block-recherche-produit__dropdown-item {
    padding: 0;
}

.block-recherche-produit__dropdown-option {
    display: block;
    padding: 12px 20px;
    color: #1d1d1b;
    text-decoration: none;
    font-family: 'Figtree', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.2;
    background: transparent;
    transition: background-color 0.2s ease;
    /* Empêcher le scroll automatique */
    scroll-behavior: auto;
    /* Empêcher la sélection de texte */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Empêcher le focus outline qui peut causer des problèmes de scroll */
    outline: none;
}

.block-recherche-produit__dropdown-option:hover {
    color: #000000;
}

/* CTA Button */
.block-recherche-produit__cta {
    z-index: 1;
    position: relative;
}

.block-recherche-produit__cta-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffe04b;
    color: #1d1d1b;
    text-decoration: none;
    font-family: 'Figtree', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1;
    text-transform: uppercase;
    padding: 30px;
    height: 70px;
    border-radius: 60px;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(255, 224, 75, 0.3);
}

.block-recherche-produit__cta-button:hover {
    background-color: #f0d800;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 224, 75, 0.4);
}

/* Backdrop - Arrière-plan sombre */
.block-recherche-produit__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000; /* Niveau 1 : Arrière-plan */
    pointer-events: none;
}

.block-recherche-produit__backdrop.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Responsive */

@media (max-width: 992px){
    .block-recherche-produit__title {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .block-recherche-produit__dropdown-trigger {
        font-size: 3vw;
        justify-content: center;
        text-align: center;
    }
    
    .block-recherche-produit__dropdown-text {
        white-space: normal;
        word-wrap: break-word;
        max-width: 100%;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .block-recherche-produit {
        padding: 80px 20px;
        gap: 30px;
    }
    
    .block-recherche-produit__header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        width: 100%;
    }
    
    .block-recherche-produit__title {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        max-width: 100%;
    }
    
    .block-recherche-produit__title-text {
        font-size: 3vw;
        white-space: normal;
        word-wrap: break-word;
        text-align: center;
        max-width: 100%;
    }
    
    .block-recherche-produit__dropdown {
        width: 100%;
        max-width: 100%;
    }
    
    .block-recherche-produit__dropdown-trigger {
        font-size: 3vw;
        justify-content: center;
        text-align: center;
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .block-recherche-produit__dropdown-text {
        white-space: normal;
        word-wrap: break-word;
        text-align: center;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .block-recherche-produit__dropdown-icon {
        flex-shrink: 0;
    }
    
    .block-recherche-produit__cta-button {
        padding: 20px 30px;
        height: auto;
        min-height: 60px;
        font-size: 14px;
    }
    
    .block-recherche-produit__dropdown-menu {
        min-width: 250px;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
        max-width: calc(100vw - 40px);
        width: calc(100vw - 40px);
    }
    
    .block-recherche-produit__dropdown-menu.is-active {
        transform: translateX(-50%) translateY(0);
    }
    
    .block-recherche-produit__dropdown-option {
        text-align: center;
        padding: 15px 20px;
        font-size: 16px;
        white-space: normal;
        word-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .block-recherche-produit {
        padding: 60px 15px;
        gap: 25px;
    }
    
    .block-recherche-produit__title-text {
        font-size: 24px;
        line-height: 1.2;
        padding: 0 5px;
    }
    
    .block-recherche-produit__dropdown-trigger {
        font-size: 24px;
        padding: 0 5px;
        gap: 6px;
    }
    
    .block-recherche-produit__dropdown-text {
        font-size: 22px;
        line-height: 1.2;
        padding: 0 8px;
    }
    
    .block-recherche-produit__dropdown-icon {
        width: 26px;
        height: 26px;
        flex-shrink: 0;
    }
    
    .block-recherche-produit__cta-button {
        padding: 15px 25px;
        font-size: 13px;
        width: 100%;
        max-width: 280px;
    }
    
    .block-recherche-produit__dropdown-menu {
        min-width: calc(100vw - 30px);
        width: calc(100vw - 30px);
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
    }
    
    .block-recherche-produit__dropdown-menu.is-active {
        transform: translateX(-50%) translateY(0);
    }
    
    .block-recherche-produit__dropdown-option {
        padding: 12px 15px;
        font-size: 15px;
        text-align: center;
    }
}

/* Styles pour éviter le débordement du texte */
.block-recherche-produit__dropdown-text {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
}

/* Styles pour le formulaire */
.block-recherche-produit__form {
    width: 100%;
}

/* Styles pour le bouton de soumission */
.btn.btn-primary {
    transition: all 0.3s ease;
}

.btn.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
    color: #666;
}

.btn.btn-primary.is-active {
    opacity: 1;
    cursor: pointer;
}

.btn.btn-primary.is-active:hover {
    transform: translateY(-2px);
}

/* Ajustement de la barre clignotante pour mobile */
@media (max-width: 768px) {
    .typing-cursor {
        margin-left: 5px;
        margin-right: 5px;
        top: -2px;
    }
}

@media (max-width: 480px) {
    .typing-cursor {
        margin-left: 3px;
        margin-right: 3px;
        top: -1px;
    }
}
