/* assets/css/search.css v 1.1 */

/* === WRAPPER === */
.tp-rest-menu-search-wrapper {
    position: fixed;
    z-index: 999998; /* Sotto il carrello takeaway (9999999) ma sopra il resto */
    right: 30px;
    top: 170px; /* Default: sotto il carrello. JS lo ricalcola dinamicamente */
    font-family: inherit;
}

/* === PULSANTE TOGGLE (LENTE) === */
.tp-rest-menu-search-toggle {
    width: 60px;
    height: 60px;
    background: #ffffff;
    border: 2px solid var(--tp-rt-primary-color, #e74c3c);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
    color: var(--tp-rt-primary-color, #e74c3c);
}

.tp-rest-menu-search-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.tp-rest-menu-search-toggle.is-active {
    background: var(--tp-rt-primary-color, #e74c3c);
    color: #ffffff;
}

.tp-rest-menu-search-toggle svg {
    pointer-events: none;
}

/* === PANNELLO RICERCA === */
.tp-rest-menu-search-panel {
    position: absolute;
    top: 0;
    right: 70px; /* A sinistra del pulsante lente */
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.tp-rest-menu-search-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

/* === INPUT === */
.tp-rest-menu-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tp-rest-menu-search-icon {
    position: absolute;
    left: 12px;
    pointer-events: none;
}

.tp-rest-menu-search-input {
    width: 100%;
    padding: 10px 36px 10px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 25px !important;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.tp-rest-menu-search-input:focus {
    border-color: var(--tp-rt-primary-color, #e74c3c);
}

.tp-rest-menu-search-input::placeholder {
    color: #aaa;
}

/* Rimuovi la X nativa del browser sul campo search */
.tp-rest-menu-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* === PULSANTE CHIUDI === */
.tp-rest-menu-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.tp-rest-menu-search-clear:hover {
    background: #f0f0f0;
    color: var(--tp-rt-primary-color, #e74c3c);
}

/* === STATUS === */
.tp-rest-menu-search-status {
    text-align: center;
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    min-height: 20px;
}

/* === SPINNER === */
.tp-rest-menu-search-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid var(--tp-rt-primary-color, #e74c3c);
    border-radius: 50%;
    animation: tpSearchSpin 0.8s linear infinite;
}

@keyframes tpSearchSpin {
    to { transform: rotate(360deg); }
}

/* === MESSAGGIO NESSUN RISULTATO === */
.tp-rest-menu-search-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.tp-rest-menu-search-empty p {
    font-size: 16px;
    margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .tp-rest-menu-search-wrapper {
        right: 10px;
    }

    .tp-rest-menu-search-toggle {
        width: 60px;
        height: 60px;
    }

    .tp-rest-menu-search-toggle svg {
        width: 30px;
        height: 30px;
    }

    /* Pannello: posizione calcolata dinamicamente dal JS, qui solo larghezza */
    .tp-rest-menu-search-panel {
        width: 280px;
    }
}

@media (max-width: 600px) {
    #tp-rt-floating-cart ~ .tp-rest-menu-search-wrapper,
    .tp-rest-menu-search-wrapper {
        right: 10px;
    }
}