/* Estilos base para todos os tipos de context switcher */
.context-switcher {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    background: transparent;
}

/* Estilos para o text switcher */
.context-switcher-text {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.context-switcher-text .switch-icon-small {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 5px;
}

.context-switcher-text .switch-icon-small svg {
    width: 14px;
    height: 14px;
}

.context-switcher-text .switch-text {
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
}

/* Estilos para o input switcher */
.context-switcher-input {
    width: 100%;
    display: inline-block;
    position: relative;
}

.context-switcher-input input[type="text"] {
    width: 100%;
    padding: 10px !important;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.context-switcher-input input[type="text"]:focus {
    outline: none !important;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) !important;
}

/* Estilos para o spinner */
.context-spinner {
    display: inline-flex;
    margin-left: 8px;
}

.spinner-circle {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Ajuste específico para o spinner dentro do ícone de geolocalização */
.geolocation-icon .spinner-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Estilos para o Twitter Typeahead */
.twitter-typeahead {
    width: 100%;
    display: block;
    position: relative;
}

/* Restaurar a cor cinza claro do input */
.tt-hint,
.tt-input,
.typeahead {
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

/* Remover a borda preta quando o campo está selecionado */
.tt-input:focus,
.typeahead:focus {
    outline: none !important;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) !important;
}

/* Corrigir a cor de fundo do hint */
.tt-hint {
    color: #999;
}

.tt-menu {
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-height: 250px;
    overflow-y: auto;
    position: absolute;
    z-index: 1000;
    margin-top: 2px;
}

.tt-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    position: relative;
}

.tt-suggestion:hover {
    background-color: #f0f0f0;
}

.tt-inactive {
    color: #b0b0b0;
    cursor: not-allowed;
}

.tt-suggestion:not(.tt-inactive) {
    font-weight: bold;
}

.coming-soon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    background-color: rgba(204, 51, 51, 0.1);
    color: #cc3333;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Garantir que as cores configuradas pelo módulo sejam aplicadas */
.context-switcher-text .switch-icon-small svg {
    width: 14px;
    height: 14px;
}

.context-switcher-text .switch-text {
    color: inherit;
}

/* Corrigir a borda feia no campo de busca */
.context-switcher .typeahead-container .tt-input,
.context-switcher .typeahead-container .typeahead,
.context-switcher .typeahead-container .tt-hint,
.context-switcher .typeahead-container-shortcut .tt-input,
.context-switcher .typeahead-container-shortcut .typeahead,
.context-switcher .typeahead-container-shortcut .tt-hint {
    outline: none !important;
}

.context-switcher .typeahead-container .tt-input:focus,
.context-switcher .typeahead-container .typeahead:focus,
.context-switcher .typeahead-container-shortcut .tt-input:focus,
.context-switcher .typeahead-container-shortcut .typeahead:focus {
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) !important;
    outline: none !important;
}

/* Estilos para o ícone de geolocalização */
.geolocation-icon {
    position: absolute;
    cursor: pointer;
    font-size: 16px;
    z-index: 100;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Posicionamento para o Input Switcher */
.context-switcher-input .geolocation-icon,
.context-switcher-geolocation-input .geolocation-icon {
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    cursor: pointer;
    color: #aaa;
    font-size: 16px;
    z-index: 100;
    width: 24px;
    text-align: center;
}

.context-switcher-input .geolocation-icon {
    right: 10px;
}

.context-switcher-input .geolocation-icon:hover,
.context-switcher-geolocation-input .geolocation-icon:hover {
    color: #666;
}

/* Posicionamento para o Text Switcher */
.context-switcher-text .typeahead-container {
    position: relative;
}

.context-switcher-text .typeahead-container .geolocation-icon {
    top: 50%;
    right: 6%;
    transform: translateY(-50%);
}

/* Posicionamento para o Icon Switcher */
.typeahead-container,
.typeahead-container-shortcut {
    position: relative;
}

.typeahead-container .geolocation-icon,
.typeahead-container-shortcut .geolocation-icon {
    top: 50%;
    transform: translateY(-50%);
}

/* Estilos para o mapa de cidades */
.context-switcher-map-container {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px);
    min-height: 300px;
    margin: 0;
    padding: 0;
}

/* Ajustes específicos para o mapa do Google */
#context-switcher-map-text,
#context-switcher-map {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 8px;
    overflow: hidden;
}

.context-switcher-map-info {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

/* Estilos para o balão de informação do mapa */
.city-info-window {
    padding: 10px;
    text-align: center;
    min-width: 180px;
}

.city-info-window .city-title {
    margin: 5px 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Estilo do botão no padrão azul do Google */
.city-enter-button {
    position: relative;
    display: inline-block;
    background-color: #4285F4;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.city-enter-button:hover {
    background-color: #3367D6;
}

.city-enter-button:active {
    background-color: #2A56C6;
}

/* Estilo para o spinner no botão - CORRIGIDO */
.button-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

.city-enter-button.loading {
    pointer-events: none;
}

/* Estilos para sobrescrever elementos do Google Maps */
.gm-style-iw {
    padding: 0 !important;
}

.gm-style-iw-d {
    overflow: hidden !important;
    max-height: none !important;
}

.gm-style-iw-c {
    padding: 12px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 7px 1px rgba(0, 0, 0, 0.2) !important;
}

/* Ocultar o botão de fechar e seu container */
.gm-ui-hover-effect,
.gm-style-iw-chr {
    display: none !important;
}

/* Ocultar o botão "back-top" na página raiz */
body.index .back-top {
    display: none !important;
}

.context-switcher-map-container {
    width: 100%;
    min-width: 300px;
}

/* Estilos para textSwitcher.tpl */
.switch-icon-small {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 5px;
}

.switch-icon-small svg {
    width: 14px;
    height: 14px;
}

#context-switcher-map-text {
    width: 100%;
    height: 300px;
}

/* Estilos para inputSwitcher.tpl */
.context-switcher-input {
    width: 100%;
    display: inline-block;
}

.context-switcher-input input[type="text"] {
    width: 100%;
}

/* Ajuste do mapa com bordas arredondadas */
#context-switcher-map-text {
    border-radius: 8px;
}

/* Ajustes para o container de typeahead */
.typeahead-container,
.typeahead-container-shortcut {
    width: 100%;
    flex: 0 0 auto;
    margin-bottom: 15px;
}

/* Ajustes para o container do Google Maps */
.gm-style {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
}

/* Forçar altura total para elementos internos do mapa */
.context-switcher-map-container>div {
    height: 100% !important;
}

.elementor-column-wrap .elementor-widget-wrap>.elementor-widget.context-switcher-icon {
    width: 28px;
    height: 28px;
}

.context-switcher-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

.elementor-element.context-switcher-geolocation-input {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.elementor-element.context-switcher-geolocation-input input {
    touch-action: manipulation;
    overflow: visible;
    font: inherit;
    margin: 0;
}

.elementor-element.context-switcher-geolocation-input .context-switcher-input {
    width: 100%;
    margin: 0 auto;
}

.elementor-element.context-switcher-geolocation-input .typeahead-container,
.elementor-element.context-switcher-geolocation-input .typeahead-container-shortcut {
    width: 100%;
    display: flex;
    justify-content: center;
}

.elementor-element.context-switcher-geolocation-input .geolocation-icon {
    top: 50%;
    transform: translateY(-50%);
}

.elementor-element.context-switcher-geolocation-input .form-control {
    color: #7a7a7a;
    background: #f5f5f5;
    display: block;
    width: 100%;
}

.elementor-element.context-switcher-geolocation-input .typeahead {
    width: 100%;
}

.elementor-element.context-switcher-geolocation-input .typeahead,
.elementor-element.context-switcher-geolocation-input .tt-input {
    padding: 10px;
    border: 1px solid #ddd !important;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    background-color: #f5f5f5 !important;
}

.elementor-element.context-switcher-geolocation-input .elementor-widget-container {
    width: 100%;
}

.elementor-element.context-switcher-geolocation-input .twitter-typeahead {
    width: 730px;
}

/* Estilos para a modal de altura total */
.modal-full-height {
    height: 90vh;
    margin: 5vh auto;
    max-height: 90vh;
    display: flex;
    align-items: center;
}

/* Ajusta o conteúdo da modal para ocupar toda a altura disponível */
.modal-full-height .modal-content {
    height: 100%;
    width: 95%;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
}

/* Faz o corpo da modal expandir para ocupar o espaço restante */
.modal-full-height .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Garante que o mapa ocupe todo o espaço disponível */
.modal-full-height .context-switcher-map-container {
    flex: 1;
    height: calc(100% - 60px);
    min-height: 300px;
    position: relative;
}

/* Mobile: modal ocupa 100% da tela e sem borda arredondada */
@media (max-width: 575px) {
    .modal-full-height {
        height: 100vh !important;
        margin: 0 !important;
        max-height: 100vh !important;
        width: 100vw !important;
        align-items: stretch;
    }

    .modal-full-height .modal-content {
        height: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
    }

    .modal-full-height .modal-dialog {
        margin: 0 !important;
        max-width: 100vw !important;
    }
}

.elementor-column-gap-default>.elementor-row>.elementor-column>.elementor-element-populated {
    padding: 0;
    margin: 0;
}

/* Garante que o mapa dentro da modal ocupe todo o espaço disponível */
.modal-full-height #context-switcher-map-text {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* Garante alinhamento correto do header da modal */
.modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 15px;
}

.modal-header .modal-title {
    margin-bottom: 0;
    font-size: 1.25rem;
    line-height: 1.2;
}

.modal-header .close {
    margin-left: auto !important;
    padding: 0 !important;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
    width: auto !important;
    height: auto !important;
    display: inline-block !important;
    box-shadow: none !important;
    position: static !important;
}

.modal-header .close:hover {
    opacity: 1;
}

.modal-header .close span {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    display: inline;
    width: auto;
    height: auto;
    text-align: center;
}

.modal-dialog {
    max-width: 100vw;
    width: 100%;
    margin: 1.75rem auto;
}

@media (max-width: 575px) {
    .modal-dialog {
        margin: 0;
    }
}

#icon-switcher.elementor-widget,
.icon-switcher.elementor-widget {
    width: unset !important;
    max-width: unset !important;
}

/* Estilos para o botão de retorno flutuante */
#context-switcher-return-button {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#context-switcher-return-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#context-switcher-return-button img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

@media (min-width: 769px) {
    #context-switcher-return-button {
        display: flex;
    }
}