/************************************************** desktop search ***************************/
#header .header-top .search-widget { float: left; min-width: auto; }
.tvcmsheader-search.search-widget form input[type=text] { border: none; }
.tvcmsheader-search .tvcms-select-category { display: none; }
.lang-rtl #header .tvsearch-header-display-wrappper { right: auto; left: 0; }
#pagenotfound .page-not-found .search-widget .tvsearch-header-display-wrappper { position: inherit; opacity: 1; visibility: visible; transform: none; }
.tvsearch-top-wrapper.open .tvsearch-header-display-wrappper { display: block; }
.tvsearch-top-wrapper .tvsearch-close { display: none; }
.tvsearch-top-wrapper.open .tvheader-search-display-icon { display: none; }
.tvsearch-header-display-wrappper form { display: flex; z-index: 10; border: 1px solid #eee; background-color: #fff; }
.tvheader-top-search-wrapper { background-color: #fff; }
.search-widget form button[type=submit] { cursor: pointer; }
.tvcmsheader-search.search-widget form button[type=submit] { padding: 0; background-color: transparent; border: none; top: 0; position: inherit; }
.tvcmssearch-wrapper { position: relative; cursor: pointer; }
#_desktop_search .tvcmsheader-search .tvserach-name { display: none; }
.tvcmsheader-search form input::placeholder { opacity: 1; }

/* ===============================================================
   RICH SEARCH DROPDOWN — Worten-style
   Cor de marca: #1860A3 (azul Espírito Rebelde)
   2026-06-16
   =============================================================== */

/* Backdrop escurece página + permite clicar fora para fechar (handle via JS) */
.tvsearch-rich-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9000;
    animation: tvSearchFadeIn 0.18s ease-out;
}
@keyframes tvSearchFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tvSearchSlideDown { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Dropdown sai do header — posição FIXED relativa ao viewport */
body.search-open .tvsearch-result {
    position: fixed !important;
    top: var(--tvsearch-top, 95px) !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: calc(100vh - var(--tvsearch-top, 95px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #fff !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22) !important;
    border-radius: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    z-index: 9001 !important;
    margin: 0 !important;
    animation: tvSearchSlideDown 0.18s ease-out;
}
@keyframes tvSearchSlideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.tvcmssearch-dropdown.tvsearch-rich {
    max-width: 1400px;
    margin: 0 auto;
}
.tvsearch-result:empty { display: none; }
.tvsearch-header-display-wrappper { position: relative; }

.tvcmssearch-dropdown.tvsearch-rich {
    padding: 28px 32px 24px 32px;
    border-bottom: none;
    background: #fff;
    position: relative;
}

.tvsearch-rich .tvsearch-dropdown-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: #666;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}
.tvsearch-rich .tvsearch-dropdown-close:hover { background: #f0f0f0; color: #1860A3; }
.tvsearch-rich .tvsearch-dropdown-close i { font-size: 22px; }

.tvsearch-rich-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.8px;
    margin: 0;
    padding: 0;
}

/* ============ Categorias (pills) ============ */
.tvsearch-rich-categories {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #ececec;
}
.tvsearch-rich-categories .tvsearch-rich-heading { margin-bottom: 12px; }
.tvsearch-rich-cat-pills {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tvsearch-rich-cat-pills li { margin: 0; padding: 0; }
.tvsearch-rich-cat-pills a {
    display: inline-block;
    padding: 7px 14px;
    background: #f3f7fb;
    color: #1860A3;
    border: 1px solid #d9e4ee;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.tvsearch-rich-cat-pills a:hover {
    background: #1860A3;
    color: #fff;
    border-color: #1860A3;
    transform: translateY(-1px);
    text-decoration: none;
}

/* ============ Produtos main + recommended (header) ============ */
.tvsearch-rich-products { margin-bottom: 22px; }
.tvsearch-rich-products:last-child { margin-bottom: 0; }

.tvsearch-rich-products-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.tvsearch-rich-count {
    color: #1860A3;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    margin-left: 4px;
}
.tvsearch-rich-badge {
    background: #1860A3;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.6px;
}

/* ============ Grid produtos matched — auto-fit (responsivo natural) ============ */
.tvsearch-rich-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

/* ============ Card produto ============ */
.tvsearch-rich-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    background: #fff;
}
.tvsearch-rich-card:hover {
    box-shadow: 0 8px 18px rgba(24, 96, 163, 0.18);
    transform: translateY(-3px);
    border-color: #1860A3;
    color: inherit;
    text-decoration: none;
}

.tvsearch-rich-card-img {
    position: relative;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9eef4 100%);
    overflow: hidden;
}
.tvsearch-rich-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Imagem partida → placeholder com ícone Material */
.tvsearch-rich-card-img.no-img img { display: none; }
.tvsearch-rich-card-img.no-img {
    background: linear-gradient(135deg, #eef4fa 0%, #dde7f1 100%);
}
.tvsearch-rich-card-img.no-img::after {
    content: "\e3f4"; /* photo_size_select_actual */
    font-family: "Material Icons";
    font-size: 36px;
    color: #1860A3;
    opacity: 0.35;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-weight: normal;
}

.tvsearch-rich-discount {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #1860A3;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 3px;
    letter-spacing: 0.6px;
    box-shadow: 0 2px 5px rgba(24, 96, 163, 0.3);
}

.tvsearch-rich-card-body {
    padding: 8px 10px 10px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.tvsearch-rich-card-name {
    font-size: 11.5px;
    line-height: 1.3;
    color: #2a2a2a;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 30px;
    font-weight: 500;
}
.tvsearch-rich-card-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}
.tvsearch-rich-card-price .price {
    font-size: 13.5px;
    font-weight: 700;
    color: #1860A3;
}
.tvsearch-rich-card-price .regular-price {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
}
/* Card recomendados — mesma escala que grid (compacto) */
.tvsearch-rich-card-rec .tvsearch-rich-card-name { font-size: 11.5px; }
.tvsearch-rich-card-rec .tvsearch-rich-card-price .price { font-size: 13.5px; }

.tvsearch-rich-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ============ Carrossel produtos recomendados ============ */
.tvsearch-rich-carousel {
    position: relative;
    margin: 0 -8px;
    padding: 0 36px;
}
.tvsearch-rich-carousel-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 4px 0 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #1860A3 #f0f0f0;
}
.tvsearch-rich-carousel-track::-webkit-scrollbar { height: 4px; }
.tvsearch-rich-carousel-track::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 2px; }
.tvsearch-rich-carousel-track::-webkit-scrollbar-thumb { background: #1860A3; border-radius: 2px; }

.tvsearch-rich-card-rec {
    flex: 0 0 calc(16.666% - 12px);
    scroll-snap-align: start;
    min-width: 0;
}

.tvsearch-rich-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #d9e4ee;
    background: #fff;
    color: #1860A3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.tvsearch-rich-carousel-arrow:hover { background: #1860A3; color: #fff; border-color: #1860A3; }
.tvsearch-rich-carousel-arrow i { font-size: 22px; }
.tvsearch-rich-carousel-prev { left: 0; }
.tvsearch-rich-carousel-next { right: 0; }
.tvsearch-rich-carousel-arrow[disabled] { opacity: 0.35; cursor: not-allowed; }

/* ============ CTA "Ver todos" ============ */
.tvsearch-rich-more { margin-top: 20px; text-align: center; }
.tvsearch-rich-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: #1860A3;
    color: #fff !important;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
    box-shadow: 0 4px 10px rgba(24, 96, 163, 0.25);
}
.tvsearch-rich-more-btn i { font-size: 18px; line-height: 1; }
.tvsearch-rich-more-btn:hover {
    background: #144C82;
    color: #fff !important;
    box-shadow: 0 6px 14px rgba(24, 96, 163, 0.35);
    transform: translateY(-1px);
}

/* ============ FAQ link bar ============ */
.tvsearch-rich-faq {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #ececec;
}
.tvsearch-rich-faq-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f7fafd;
    border: 1px solid #d9e4ee;
    border-radius: 8px;
    color: #1860A3 !important;
    text-decoration: none !important;
    font-size: 14px;
    transition: background 0.15s, border-color 0.15s;
}
.tvsearch-rich-faq-link:hover { background: #1860A3; color: #fff !important; border-color: #1860A3; }
.tvsearch-rich-faq-link:hover .tvsearch-rich-faq-icon,
.tvsearch-rich-faq-link:hover .tvsearch-rich-faq-text strong,
.tvsearch-rich-faq-link:hover .tvsearch-rich-faq-chevron { color: #fff !important; }
.tvsearch-rich-faq-icon { font-size: 22px; color: #1860A3; flex-shrink: 0; }
.tvsearch-rich-faq-text { flex: 1; line-height: 1.4; }
.tvsearch-rich-faq-text strong { display: block; color: #2a2a2a; font-weight: 600; margin-bottom: 2px; }
.tvsearch-rich-faq-chevron { font-size: 20px; color: #aaa; flex-shrink: 0; }

/* ============ Tablet (≤1100px) ============ */
@media (max-width: 1100px) {
    .tvsearch-rich-products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .tvsearch-rich-card-rec { flex: 0 0 calc(25% - 11px); }
}

/* ============ Tablet (≤992px) ============ */
@media (max-width: 992px) {
    .tvcmssearch-dropdown.tvsearch-rich { padding: 24px 24px 20px 24px; }
    .tvsearch-rich-products-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .tvsearch-rich-card-rec { flex: 0 0 calc(25% - 10.5px); }
}

/* ============ Tablet pequeno (≤768px) ============ */
@media (max-width: 768px) {
    .tvcmssearch-dropdown.tvsearch-rich { padding: 20px 18px 18px 18px; }
    .tvsearch-rich-products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .tvsearch-rich-card-rec { flex: 0 0 calc(33.333% - 9.4px); }
    .tvsearch-rich-card-name { font-size: 12px; min-height: 32px; }
    .tvsearch-rich-card-rec .tvsearch-rich-card-name { font-size: 12px; }
    .tvsearch-rich-card-price .price { font-size: 14px; }
    .tvsearch-rich-card-rec .tvsearch-rich-card-price .price { font-size: 14px; }
    .tvsearch-rich-cat-pills a { font-size: 12px; padding: 6px 12px; }
    .tvsearch-rich-more-btn { padding: 10px 22px; font-size: 13px; }
    .tvsearch-rich-carousel { padding: 0 30px; }
    .tvsearch-rich-carousel-arrow { width: 30px; height: 30px; }
    .tvsearch-rich-carousel-arrow i { font-size: 18px; }
    .tvsearch-rich-faq-link { padding: 10px 12px; font-size: 13px; }
}

/* ============ Mobile (≤576px) ============ */
@media (max-width: 576px) {
    .tvcmssearch-dropdown.tvsearch-rich { padding: 16px 14px 16px 14px; }
    .tvsearch-rich-products-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .tvsearch-rich-card-rec { flex: 0 0 calc(50% - 7px); }
    .tvsearch-rich-products-header { flex-wrap: wrap; gap: 6px; }
    .tvsearch-rich-categories { margin-bottom: 16px; padding-bottom: 14px; }
}

/* ============ Mobile small (≤380px) ============ */
@media (max-width: 380px) {
    .tvcmssearch-dropdown.tvsearch-rich { padding: 14px 10px; }
    .tvsearch-rich-products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .tvsearch-rich-card-rec { flex: 0 0 calc(50% - 6px); }
}

/* ============ Legacy mobile search template compat ============ */
.tvsearch-dropdown-total-wrapper { margin: 0 0 15px 0; }
.tvsearch-dropdown-img-block { height: auto; width: 30%; overflow: hidden; }
.tvsearch-dropdown-content-box { text-align: left; width: 70%; padding-left: 10px; }
.tvsearch-dropdown-title { display: block; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; margin-bottom: 10px; }
.tvheader-top-search { width: 100%; }
.tvsearch-dropdown-close-wrapper { margin-bottom: 35px; }

/* RTL */
.lang-rtl .tvsearch-rich-cat-pills { direction: rtl; }
.lang-rtl .tvsearch-dropdown-total { direction: ltr; }
.lang-rtl .tvsearch-dropdown-content-box { padding-right: 10px; padding-left: 0; text-align: right; }
.lang-rtl .tvsearch-rich-discount { left: auto; right: 8px; }
.lang-rtl .tvsearch-rich .tvsearch-dropdown-close { right: auto; left: 14px; }
.lang-rtl .tvsearch-rich-carousel-prev { left: auto; right: 0; }
.lang-rtl .tvsearch-rich-carousel-next { right: auto; left: 0; }

@media(max-width: 575px) {
    .tvcmssearch-wrapper { position: inherit; }
    .search-widget form input[type=text] { min-width: auto; }
}

/* ER8-search-dropdown (Issue #3 / MR !45 do Doutor Paulo): o dropdown rich tinha
   height fixo enorme (~1479px) que deixava grande fundo branco vazio quando havia
   poucos resultados. Passa a caber no conteúdo (auto), com max-height + scroll para
   listas longas. Vale em todas as resoluções. */
.tvcmssearch-dropdown { height: auto !important; max-height: min(72vh, 560px) !important; overflow-y: auto !important; }
.tvsearch-result { height: auto !important; }
