/**
 * Styles pour TNTSearch
 * Fichier: modules/sldtntsearch/views/css/tntsearch.css
 */

/* Container principal */
.tntsearch-wrapper {
    position: relative;
    max-width: 550px;
    width: 100%;
    margin: 0 auto!important;
    height: 55px;
}
#header .tntsearch-wrapper {
    z-index: 1000;
}
@media (max-width: 768px) {
    #header .tntsearch-wrapper {
        display: none;
    }
    html.search-bar-open{
        overflow: hidden;
    }
    html.search-bar-open #header .tntsearch-wrapper {
        display: block;
        position: absolute;
    }
    html.search-bar-open #header .is-sticky .tntsearch-wrapper {
        width: calc(100% - 30px);
        left: 15px;
        height: 40px;
    }
}

/* Formulaire de recherche */
.tntsearch-form {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px #00463c solid;
    border-radius: 10px;
    padding: 0px;
    transition: all 0.3s ease;
    height: 100%;
}
#header .tntsearch-form{
    border: none;
}

.tntsearch-form:focus-within {
}

/* Input de recherche */
.tntsearch-input {
    display: flex;
    width: 100%;
    border: none;
    outline: none;
    padding: 10px 15px 10px 56px;
    height: 100%;
    font-size: 15px;
    background: transparent;
    color: #1E1E1E;
}

.tntsearch-input::placeholder {
    color: #1E1E1E;
}

/* Bouton de recherche */
.tntsearch-button {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    border: none;
    width: 55px;
    height: 100%;
    color: #00463c;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.tntsearch-button:hover {
    background: transparent;
    color: #fe6628;
}

.tntsearch-button i {
    font-size: 27px;
}

/* Bouton fermer */
.tntsearch-button-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #00463c;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    &.show{
        display: flex;
    }
}
@media (max-width: 768px) {
    html.search-bar-open #header .is-sticky .tntsearch-button-close {
        top: 5px;
    }
}

.tntsearch-button-close:hover {
    background: #fe6628;
    color: #ffffff;
}

.tntsearch-button-close i {
    font-size: 13px;
}

/* Loading spinner */
.tntsearch-loading {
    position: absolute;
    right: 55px;
    top: 50%;
    transform: translateY(-50%);
}

.tntsearch-loading i {
    color: #00463c;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Container des résultats */
.tntsearch-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1001;
}
@media (max-width: 768px) {
    .tntsearch-results {
        max-height: 70dvh;
    }
}

/* Header des résultats */
.tntsearch-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background: #f8f8f8;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-count-popup {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.close-results {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.3s ease;
}

.close-results:hover {
    color: #333;
}

/* Liste des résultats */
.tntsearch-results-list {
    padding: 0;
    margin: 0;
}

/* Headers de section */
.tntsearch-section-header {
    padding: 10px 15px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    z-index: 9;
}

.tntsearch-section-header.type-product {
    border-bottom: 1px solid #00463c;
}
.tntsearch-section-header.type-cms {
    border-bottom: 1px solid #fe6628;
}
.tntsearch-section-header.type-blog {
    border-bottom: 1px solid #a1cd91;
}

.tntsearch-section-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tntsearch-section-header.type-product h4{
    color: #00463c;
}
.tntsearch-section-header.type-cms h4{
    color: #fe6628;
}
.tntsearch-section-header.type-blog h4{
    color: #a1cd91;
}

.section-count {
    color: #999;
    font-weight: 400;
}

/* Item générique */
.tntsearch-item {
    border-bottom: 1px solid #eee;
    transition: background 0.2s ease;
}

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

.tntsearch-item:hover {
    background: #f9f9f9;
}

.item-link {
    display: flex;
    padding: 12px 15px;
    text-decoration: none;
    color: inherit;
    gap: 12px;
    align-items: center;
}

/* Image/Icône */
.item-image,
.item-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: #f8f8f8;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-icon i {
    font-size: 28px;
    color: #999;
}

/* Infos de l'item */
.item-info {
    flex: 1;
    min-width: 0;
}

.item-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: #999;
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.item-name {
    margin: 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-price {
    margin: 4px 0 0 0;
    font-size: 15px;
    font-weight: 700;
    color: #00463c;
}

/* Styles spécifiques par type */
.tntsearch-product .item-type {
    background: #00463c;
}

.tntsearch-cms .item-type {
    background: #fe6628;
}

.tntsearch-cms .item-icon {
    background: #fff0e9;
}

.tntsearch-cms .item-icon i {
    color: #fe6628;
}

.tntsearch-blog .item-type {
    background: #a1cd91;
}

.tntsearch-blog .item-icon {
    background: #e3f0de;
}

.tntsearch-blog .item-icon i {
    color: #a1cd91;
}

/* Aucun résultat */
.tntsearch-no-results {
    padding: 30px 15px;
    text-align: center;
}

.tntsearch-no-results p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Scrollbar personnalisée */
.tntsearch-results::-webkit-scrollbar {
    width: 8px;
}

.tntsearch-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.tntsearch-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.tntsearch-results::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive */
@media (max-width: 768px) {
    /*
    .tntsearch-wrapper {
        max-width: 100%;
        padding: 0 10px;
    }

    .tntsearch-results {
        max-height: 400px;
    }

    .item-image,
    .item-icon {
        width: 45px;
        height: 45px;
    }

    .item-name {
        font-size: 13px;
    }

    .item-price {
        font-size: 14px;
    }

    .tntsearch-section-header {
        top: 45px;
    }
    */
}

/* Animation d'entrée */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tntsearch-results {
    animation: slideDown 0.2s ease-out;
}