/* LM Responsive Search - Improved
   Highly specific and isolated styles to avoid theme overrides (Astra compatibility)
*/

/* Use a unique namespace */
.lm-search-widget--isolated * {
    box-sizing: border-box !important;
}

/* Container alignment - center horizontally and vertically within widget area */
.lm-search-widget--isolated {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 8px 0 !important;
}

/* Field wrapper */
.lm-search-widget--isolated .lm-search-field-wrapper {
    position: relative !important;
    width: 100% !important;
    max-width: 900px !important;
}

/* Reset only for elements inside our widget to avoid global resets */
.lm-search-widget--isolated .lm-search-input,
.lm-search-widget--isolated .lm-search-btn,
.lm-search-widget--isolated .lm-search-suggestions {
    all: unset !important;
    box-sizing: border-box !important;
}

/* Input: reapply desired styles */
.lm-search-widget--isolated .lm-search-input {
    display: block !important;
    width: 100% !important;
    height: 50px !important;
    padding: 12px 52px 12px 16px !important; /* space for icon */
    border-radius: 8px !important;
    border: 1px solid #D5D5D5 !important;
    background: #ffffff !important;
    color: #222 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    outline: none !important;
}

/* Placeholder */
.lm-search-widget--isolated .lm-search-input::placeholder {
    color: #BFBFBF !important;
    opacity: 1 !important;
}

/* Focus */
.lm-search-widget--isolated .lm-search-input:focus {
    border-color: #1E88E5 !important;
    box-shadow: 0 0 0 4px rgba(30,136,229,0.08) !important;
}

/* Button (icon) */
.lm-search-widget--isolated .lm-search-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 6px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
}

/* SVG inside button uses currentColor so we control it here */
.lm-search-widget--isolated .lm-search-btn .lm-search-icon {
    width: 18px !important;
    height: 18px !important;
    color: #2a2a2a !important;
    stroke: currentColor !important;
    fill: none !important;
}

/* Hover */
.lm-search-widget--isolated .lm-search-btn:hover .lm-search-icon {
    color: #000 !important;
}

/* Suggestions box */
.lm-search-widget--isolated .lm-search-suggestions {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: calc(100% + 6px) !important;
    background: #fff !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important;
    z-index: 99999 !important;
    border-radius: 6px !important;
    max-height: 320px !important;
    overflow: auto !important;
    display: none !important;
}

/* Suggestion item */
.lm-search-widget--isolated .lm-suggestion-item {
    padding: 10px 14px !important;
    cursor: pointer !important;
    border-bottom: 1px solid rgba(0,0,0,0.03) !important;
}
.lm-search-widget--isolated .lm-suggestion-item:last-child {
    border-bottom: none !important;
}
.lm-search-widget--isolated .lm-suggestion-item:hover,
.lm-search-widget--isolated .lm-suggestion-item:focus {
    background: #f7f7f7 !important;
}

/* Make suggestions visible when JS toggles attribute */
.lm-search-widget--isolated .lm-suggestions-visible {
    display: block !important;
}
/* Responsive adjustments */
@media (max-width: 768px) {
    .lm-search-widget--isolated .lm-search-input {
        height: 46px !important;

        /* Ajuste para evitar zoom en iOS (fuente mínimo 16px) */
        font-size: 16px !important;

        /* Ajuste de padding para mantener la misma estética */
        padding: 10px 46px 10px 12px !important;
    }
    .lm-search-widget--isolated .lm-search-btn {
        right: 10px !important;
        width: 32px !important;
        height: 32px !important;
    }
}

@media (max-width: 420px) {
    .lm-search-widget--isolated .lm-search-input {
        height: 44px !important;

        /* Evitar zoom en pantallas muy pequeñas */
        font-size: 16px !important;

        /* Mantener estética original del input */
        padding-right: 44px !important;
    }
    .lm-search-widget--isolated .lm-search-btn {
        right: 8px !important;
    }
}
/* --- Evitar zoom en iOS SOLO con CSS --- */

/* 1) El input debe tener SIEMPRE font-size ≥ 16px en móvil */
.lm-search-widget--isolated .lm-search-input {
    font-size: 16px !important;
}

/* 2) También todos los elementos “padres” deben tener font-size ≥ 16px,
      porque iOS hace zoom si HEREDA un tamaño más pequeño */
.lm-search-widget--isolated,
.lm-search-widget--isolated * {
    font-size: 16px;
}

/* 3) Ajuste extra para Safari iOS */
@supports (-webkit-touch-callout: none) {
    .lm-search-widget--isolated .lm-search-input {
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }
}
/* iOS anti-zoom */
.lm-search-widget--isolated .lm-search-input {
    font-size: 16px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lm-search-widget--isolated .lm-search-input {
        height: 46px !important;
        padding: 10px 46px 10px 12px !important;
        font-size: 16px !important; /* ← CORREGIDO */
    }
    .lm-search-widget--isolated .lm-search-btn {
        right: 10px !important;
        width: 32px !important;
        height: 32px !important;
    }
}

@media (max-width: 420px) {
    .lm-search-widget--isolated .lm-search-input {
        height: 44px !important;
        padding-right: 44px !important;
        font-size: 16px !important; /* ← CORREGIDO */
    }
    .lm-search-widget--isolated .lm-search-btn {
        right: 8px !important;
    }
}
