/* ==========================================================
 * GlosTV Search — Mobile  v1.1.0
 *
 * CHANGELOG v1.1.0
 * ─────────────────
 * • Arquivo COMPLETAMENTE reescrito. A versão anterior era uma
 *   cópia do desktop (classes .glostv-search-*) e não estilizava
 *   nenhum elemento mobile (.glostv-mob-*), além de duplicar
 *   seletores globais que vazavam para o tema.
 * • Todos os seletores agora usam .glostv-mob-* conforme o HTML
 *   gerado pelo shortcode [glostv_search_mobile].
 * • Sem hover effects pesados (touch-first).
 * • Focus neutro, sem laranja.
 * ========================================================== */


/* ── 1  Custom properties (escopadas) ──────────────────────── */

.glostv-mob-search-container,
.glostv-mob-suggestions {
    --glostv-accent:       #ff6b00;
    --glostv-accent-dark:  #e55d00;
    --glostv-accent-light: #ff8c00;
    --glostv-focus-ring:   0 0 0 3px rgba(0, 0, 0, 0.06);
    --glostv-radius:       22px;
    --glostv-height:       44px;
}


/* ── 2  Container ──────────────────────────────────────────── */

.glostv-mob-search-container {
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 1000;
}


/* ── 3  Search box ─────────────────────────────────────────── */

.glostv-mob-search-container .glostv-mob-search-box {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}


/* ── 4  Input ──────────────────────────────────────────────── */

.glostv-mob-search-container .glostv-mob-search-input {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: var(--glostv-height);
    margin: 0;
    padding: 10px 88px 10px 18px;
    border: 1px solid #e6e6e6;
    border-radius: var(--glostv-radius);
    font-size: 16px;
    line-height: 1.2;
    color: #222;
    background: #fff;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glostv-mob-search-container .glostv-mob-search-input:focus {
    border-color: #bbb;
    box-shadow: var(--glostv-focus-ring);
    outline: none;
}

.glostv-mob-search-container .glostv-mob-search-input:focus-visible {
    border-color: #999;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.10);
}


/* ── 5  Clear button ───────────────────────────────────────── */

.glostv-mob-search-container .glostv-mob-clear-button {
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%) scale(0.7);
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    background: #d0d0d0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 3;
    outline: none;
    box-shadow: none;
    transition: background 0.25s ease,
                transform 0.25s ease,
                opacity   0.25s ease,
                visibility 0.25s ease;
}

.glostv-mob-search-container .glostv-mob-clear-button.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glostv-mob-search-container .glostv-mob-clear-button:active {
    background: var(--glostv-accent);
    transform: translateY(-50%) scale(0.92);
}

.glostv-mob-search-container .glostv-mob-clear-button:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.glostv-mob-search-container .glostv-mob-clear-button svg {
    stroke: #666;
    pointer-events: none;
}


/* ── 6  Search button ──────────────────────────────────────── */

.glostv-mob-search-container .glostv-mob-search-button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 34px;
    margin: 0;
    padding: 0;
    background: var(--glostv-accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.10);
    outline: none;
    transition: transform 0.2s ease;
}

.glostv-mob-search-container .glostv-mob-search-button:active {
    transform: translateY(-50%) scale(0.93);
}

.glostv-mob-search-container .glostv-mob-search-button:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0, 0, 0, 0.3);
}


/* ── 7  Overlay ────────────────────────────────────────────── */

.glostv-mob-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 99998;
    display: none;
}

.glostv-mob-overlay.active {
    display: block;
}


/* ── 8  Suggestions dropdown ───────────────────────────────── */

.glostv-mob-suggestions {
    box-sizing: border-box;
    position: fixed;
    left: 0;
    top: 0;
    width: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    border: 1px solid #e0e0e0;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.glostv-mob-suggestions.active {
    display: block;
    animation: glostvMobSlideDown 0.25s ease;
}


/* ── 9  Suggestion item ────────────────────────────────────── */

.glostv-mob-suggestions .glostv-mob-suggestion-item {
    box-sizing: border-box;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    position: relative;
    transition: background 0.15s ease;
}

.glostv-mob-suggestions .glostv-mob-suggestion-item:last-child {
    border-bottom: none;
}

/* Active (touch) — fundo sutil, sem animações pesadas */
.glostv-mob-suggestions .glostv-mob-suggestion-item:active {
    background: rgba(255, 107, 0, 0.06);
}

/* Keyboard nav */
.glostv-mob-suggestions .glostv-mob-suggestion-item.is-active {
    background: rgba(255, 107, 0, 0.06);
}

.glostv-mob-suggestions .glostv-mob-suggestion-item.is-active .glostv-mob-suggestion-title {
    color: var(--glostv-accent);
}

.glostv-mob-suggestions .glostv-mob-suggestion-item:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.2);
    outline-offset: -2px;
}


/* ── 10  Imagem ────────────────────────────────────────────── */

.glostv-mob-suggestions .glostv-mob-suggestion-img {
    width: 64px;
    height: 48px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
    background: #f3f3f3;
    display: block;
}


/* ── 11  Conteúdo ──────────────────────────────────────────── */

.glostv-mob-suggestions .glostv-mob-suggestion-content {
    flex: 1;
    min-width: 0;
}

.glostv-mob-suggestions .glostv-mob-suggestion-category {
    font-size: 10px;
    color: var(--glostv-accent);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.glostv-mob-suggestions .glostv-mob-suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.35;
}


/* ── 12  Highlight ─────────────────────────────────────────── */

.glostv-mob-suggestions .glostv-mob-highlight {
    background: #fff3cd;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: #856404;
}


/* ── 13  "Ver todos" ───────────────────────────────────────── */

.glostv-mob-suggestions .glostv-mob-view-all {
    padding: 14px 16px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    background: #fff;
}

.glostv-mob-suggestions .glostv-mob-view-all a {
    color: var(--glostv-accent);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.glostv-mob-suggestions .glostv-mob-view-all a:active {
    color: var(--glostv-accent-dark);
}


/* ── 14  Loading / Erro ────────────────────────────────────── */

.glostv-mob-suggestions .glostv-mob-loading {
    padding: 24px;
    text-align: center;
    color: #666;
    background: #fff;
    font-size: 14px;
}

.glostv-mob-suggestions .glostv-mob-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--glostv-accent);
    border-radius: 50%;
    animation: glostvMobSpin 0.8s linear infinite;
    margin: 0 auto 8px;
}

.glostv-mob-suggestions .glostv-mob-no-results {
    padding: 30px 16px;
    text-align: center;
    color: #999;
    background: #fff;
    font-size: 14px;
}


/* ── 15  Scrollbar ─────────────────────────────────────────── */

.glostv-mob-suggestions::-webkit-scrollbar {
    width: 4px;
}

.glostv-mob-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.glostv-mob-suggestions::-webkit-scrollbar-thumb {
    background: var(--glostv-accent);
    border-radius: 10px;
}


/* ── 16  Keyframes ─────────────────────────────────────────── */

@keyframes glostvMobSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes glostvMobSpin {
    to { transform: rotate(360deg); }
}


/* ── 17  Reduced motion ────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .glostv-mob-search-container .glostv-mob-search-input,
    .glostv-mob-search-container .glostv-mob-search-button,
    .glostv-mob-search-container .glostv-mob-clear-button,
    .glostv-mob-suggestions,
    .glostv-mob-suggestions .glostv-mob-suggestion-item {
        transition-duration: 0.01ms;
        animation-duration:  0.01ms;
    }
}