/* RESET E CONFIGURAÇÕES GERAIS */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* BARRA FIXA NO TOPO */ 
#ticker-topo { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; 
    height: 48px !important;
    background: linear-gradient(135deg, #0b1c2d 0%, #0a2742 100%); 
    color: #fff; 
    font-family: 'Segoe UI', Arial, sans-serif; 
    display: flex; align-items: center; 
    overflow: hidden; 
    z-index: 999; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
}

/* DATA E ATUALIZAÇÃO - APENAS PARA DESKTOP */
#data {
    padding: 0 16px;
    font-size: 13px;
    white-space: nowrap;
    color: #a8c6ff;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: 500;
    min-width: 180px;
}

/* ÁREA DE ROLAGEM */
#ticker-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* EFEITO DE DESBOTAMENTO NAS EXTREMIDADES */
#ticker-wrapper::before,
#ticker-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    width: 48px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

#ticker-wrapper::before {
    left: 0;
    background: linear-gradient(to right, #0b1c2d 0%, transparent 100%);
}

#ticker-wrapper::after {
    right: 0;
    background: linear-gradient(to left, #0b1c2d 0%, transparent 100%);
}

/* TICKER CONTÍNUO */
#ticker {
    display: flex;
    width: max-content;
    white-space: nowrap;
    align-items: center;
    animation: scroll 100s linear infinite;
    padding-left: 20px;
    height: 100%;
}

/* PAUSA NA ANIMAÇÃO AO PASSAR O MOUSE */
#ticker:hover {
    animation-play-state: paused;
}

/* ============= ESTILOS PARA LOGOTIPOS ============= */

/* Container do logo */
.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 35px;
    height: 100%;
    padding: 0 10px;
    vertical-align: middle;
}

/* Imagem do logo */
.ticker-logo {
    height: 32px; /* Altura para desktop */
    width: auto; /* Mantém proporção */
    max-width: 180px; /* Limita largura máxima */
    min-width: 60px; /* Largura mínima */
    object-fit: contain; /* Mantém proporção sem distorcer */
    display: block;
    filter: brightness(1.15) contrast(1.1); /* Melhora visibilidade no fundo escuro */
    transition: all 0.3s ease;
    vertical-align: middle;
}

/* Classe específica para logo de câmbio */
.ticker-logo.logo-cambio {
    height: 34px; /* Ajuste fino se necessário */
}

/* Classe específica para logo de clima */
.ticker-logo.logo-clima {
    height: 36px; /* Ajuste fino se necessário */
}

/* Efeito hover nos logos */
.logo-container:hover .ticker-logo {
    opacity: 0.85;
    transform: scale(1.05);
}

/* Fallback visual se imagem não carregar */
.logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    height: 32px;
    min-width: 100px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* Efeito hover no fallback */
.logo-fallback:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

/* ============= ITEM DO TICKER (ORIGINAL) ============= */

.ticker-item { 
    display: inline-flex; 
    align-items: center; 
    margin-right: 40px; 
    font-size: 14px; 
    padding: 4px 12px; 
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 4px; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    transition: all 0.2s ease; 
    height: 32px; 
}

.ticker-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* DESTAQUES PARA DIFERENTES TIPOS DE DADOS */
.ticker-item.cambio {
    border-left: 3px solid #4CAF50;
}

.ticker-item.clima-hoje {
    border-left: 3px solid #2196F3;
}

.ticker-item.clima-previsao {
    border-left: 3px solid #FF9800;
}

/* ÍCONES */
.icon {
    margin-right: 8px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

/* ============= ALTERAÇÃO: FUNDO PARA ÍCONES DE CLIMA ============= */
/* LINHAS ALTERADAS: Adicionado background azul claro aos ícones de clima */
.ticker-item .icon img {
    height: 20px !important;
    width: 20px !important;
    filter: none !important;
    margin: 0 !important;
    /* padding: 0 !important; REMOVIDO para permitir padding personalizado */
    /*background-color: #e3f2fd; /* ADICIONADO: Azul claro para fundo */
    border-radius: 50%; /* ADICIONADO: Deixa redondo */
    padding: 3px; /* ADICIONADO: Espaçamento interno */
    transition: all 0.3s ease; /* ADICIONADO: Transição suave */
}

/* ADICIONADO: Efeito hover para ícones de clima */
.ticker-item:hover .icon img {
    /*background-color: #bbdefb; /* Azul um pouco mais forte no hover */
    transform: scale(1.05);
}

/* ADICIONADO: Ícones de clima hoje (mais destacado) */
.ticker-item.clima-hoje .icon img {
    /*background-color: #bbdefb; /* Azul mais forte para "hoje" */ /* ========================================== cor icones ============================ */
    padding: 4px;
}

/* ADICIONADO: Ícones de previsão (mais suave) */
.ticker-item.clima-previsao .icon img {
    /*background-color: #e3f2fd; /* Azul claro para previsão */ /* ========================================== cor icones ============================ */
}

/* ============= FIM DAS ALTERAÇÕES ============= */

/* VALORES DESTACADOS */
.ticker-item strong {
    color: #e3f2fd;
    font-weight: 600;
    margin-right: 5px;
}

.ticker-item .valor {
    color: #bbdefb;
    font-weight: 500;
}

.ticker-item .destaque {
    color: #FFD54F;
    font-weight: 600;
}

/* SEPARADORES */
.separador {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 8px;
}

/* INDICADOR DE CARREGAMENTO */
#loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #a8c6ff;
    font-style: italic;
}

/* MENSAGEM DE ERRO */
.erro {
    color: #ff6b6b !important;
    border-left: 3px solid #ff6b6b !important;
}

/* ANIMAÇÃO DO TICKER */
@keyframes scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ============= PARA TELAS MENORES QUE 768px ============= */
@media (max-width: 768px) {
    /* 1. RESETA COMPLETAMENTE O #data */
    #data {
        all: unset !important;
        display: none !important;
    }
    
    /* 2. CORRIGE A BARRA PRINCIPAL */
    #ticker-topo {
        height: 42px !important;
        min-height: 42px;
        max-height: 42px;
        align-items: stretch !important;
    }
    
    /* 3. TICKER-WRAPPER OCUPA TODO ESPAÇO */
    #ticker-wrapper {
        flex: 1 1 auto !important;
        height: 42px !important;
        min-height: 42px;
        align-self: stretch !important;
    }
    
    /* 4. CONTEÚDO DO TICKER ALINHADO */
    #ticker {
        height: 100% !important;
        align-items: center !important;
        padding-left: 10px;
    }
    
    /* 5. LOGOTIPOS PARA MOBILE */
    .logo-container {
        margin-right: 20px;
        height: 42px;
        padding: 0 6px;
    }
    
    .ticker-logo {
        height: 26px !important;
        max-width: 120px;
        min-width: 50px;
    }
    
    .ticker-logo.logo-cambio {
        height: 28px !important;
    }
    
    .ticker-logo.logo-clima {
        height: 30px !important;
    }
    
    .logo-fallback {
        font-size: 10px;
        padding: 4px 10px;
        min-width: 70px;
        height: 26px;
        letter-spacing: 1px;
    }
    
    /* 6. ITENS PROPORCIONAIS */
    .ticker-item {
        height: 28px !important;
        line-height: 28px !important;
        margin-right: 15px !important;
        font-size: 12px !important;
        padding: 3px 8px !important;
    }
    
    /* 7. CORPO DA PÁGINA */
    body {
        padding-top: 42px !important;
    }
    
    /* 8. REDUZ OS EFEITOS DE DESBOTAMENTO */
    #ticker-wrapper::before,
    #ticker-wrapper::after {
        width: 40px;
    }
    
    /* 9. AJUSTA SEPARADORES */
    .separador {
        margin: 0 5px;
    }
    
    /* 10. AJUSTA ÍCONES */
    .icon {
        margin-right: 5px;
        font-size: 14px;
    }
    
    /* ADICIONADO: Ajustes para ícones de clima em mobile */
    .ticker-item .icon img {
        height: 18px !important;
        width: 18px !important;
        padding: 2px !important;
    }
    
    .ticker-item.clima-hoje .icon img {
        padding: 3px !important;
    }
}

/* ============= PARA TELAS BEM PEQUENAS (ATÉ 480px) ============= */
@media (max-width: 480px) {
    #ticker-topo {
        height: 38px !important;
    }
    
    #ticker-wrapper {
        height: 38px !important;
    }
    
    .logo-container {
        margin-right: 12px;
        height: 38px;
        padding: 0 4px;
    }
    
    .ticker-logo {
        height: 22px !important;
        max-width: 90px;
        min-width: 40px;
    }
    
    .ticker-logo.logo-cambio {
        height: 24px !important;
    }
    
    .ticker-logo.logo-clima {
        height: 26px !important;
    }
    
    .logo-fallback {
        font-size: 9px;
        padding: 3px 8px;
        min-width: 55px;
        height: 22px;
        letter-spacing: 0.8px;
    }
    
    .ticker-item {
        height: 26px !important;
        font-size: 11px !important;
        margin-right: 10px !important;
        padding: 2px 6px !important;
    }
    
    body {
        padding-top: 38px !important;
    }
    
    #ticker-wrapper::before,
    #ticker-wrapper::after {
        width: 25px;
    }
    
    .icon {
        margin-right: 4px;
        font-size: 12px;
    }
    
    /* ADICIONADO: Ajustes para ícones de clima em telas muito pequenas */
    .ticker-item .icon img {
        height: 16px !important;
        width: 16px !important;
        padding: 1px !important;
    }
}

/* ============= AJUSTES ESPECÍFICOS PARA TICKER COM LOGOS ============= */

/* Garante que todos os itens fiquem alinhados verticalmente */
#ticker > * {
    display: inline-flex;
    align-items: center;
    height: 100%;
}

/* Espaçamento extra entre seções (logo + conteúdo) */
.logo-container + .ticker-item:first-of-type {
    margin-left: 5px;
}

/* Ajuste fino para animação com logos */
#ticker {
    gap: 0; /* Remove gap se existir */
}

/* Remove bordas e fundos específicos dos logos para ficar limpo */
.logo-container,
.ticker-logo,
.logo-fallback {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Restaura estilos específicos apenas para fallback */
.logo-fallback {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* ADICIONADO: Remove qualquer fundo adicional de ícones que não sejam de clima */
/* Isso garante que apenas os ícones de clima tenham o fundo azul */
.ticker-item:not(.clima-hoje):not(.clima-previsao) .icon img {
    background-color: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* ============= ESTILOS DE DEBUG (OPCIONAL) ============= */
/* Remova ou comente estas linhas após testes */
.debug-border {
    /* border: 1px solid red !important; */
}

.debug-bg {
    /* background: rgba(255, 0, 0, 0.1) !important; */
}

/* ============= ANIMAÇÃO SUAVE PARA CARREGAMENTO ============= */
@keyframes fadeInLogo {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-container,
.ticker-item {
    animation: fadeInLogo 0.3s ease-out;
}

/* ============= VELOCIDADE DA ANIMAÇÃO POR DISPOSITIVO ============= */
/* Ajuste conforme necessário com base no número de itens */
#ticker {
    animation-duration: 100s; /* Desktop */
}

@media (max-width: 768px) {
    #ticker {
        animation-duration: 120s; /* Tablet - mais lento devido a menos espaço */
    }
}

@media (max-width: 480px) {
    #ticker {
        animation-duration: 140s; /* Mobile - mais lento ainda */
    }
}