/* ===============================================
   Seletor de Idiomas - MSB Tecnologia
   =============================================== */

/* Container principal do seletor */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000001;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(166, 205, 67, 0.2);
    padding: 8px;
    transition: all 0.3s ease;
}

.language-selector:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Botão atual selecionado */
.language-selector .current-language {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #a6cd43;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: none;
    transition: all 0.3s ease;
    min-width: 80px;
    justify-content: center;
}

.language-selector .current-language:hover {
    background: #8bc34a;
    transform: scale(1.02);
}

/* Bandeira */
.language-flag {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Bandeiras específicas */
.flag-pt { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 14'%3E%3Crect width='20' height='14' fill='%23009B3A'/%3E%3Cpolygon points='0,7 8.5,2 8.5,12' fill='%23FEDF00'/%3E%3Ccircle cx='8.5' cy='7' r='2.5' fill='%23002776' stroke='%23FEDF00' stroke-width='0.3'/%3E%3Cpath d='M7,7 Q8.5,6.2 10,7 Q8.5,7.8 7,7' fill='%23009B3A'/%3E%3C/svg%3E"); }
.flag-en { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3Crect width='60' height='30' fill='%23012169'/%3E%3Cg stroke='%23FFF' stroke-width='6'%3E%3Cpath d='m0,0 60,30 m0,-30 L0,30'/%3E%3C/g%3E%3Cg stroke='%23C8102E' stroke-width='4'%3E%3Cpath d='m0,0 60,30 m0,-30 L0,30'/%3E%3C/g%3E%3Cg stroke='%23FFF' stroke-width='10'%3E%3Cpath d='M30,0 v30 M0,15 h60'/%3E%3C/g%3E%3Cg stroke='%23C8102E' stroke-width='6'%3E%3Cpath d='M30,0 v30 M0,15 h60'/%3E%3C/g%3E%3C/svg%3E"); }
.flag-fr { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%23002654'/%3E%3Crect x='1' width='1' height='2' fill='%23FFF'/%3E%3Crect x='2' width='1' height='2' fill='%23CE1126'/%3E%3C/svg%3E"); }

/* Seta indicativa */
.language-selector .current-language::after {
    content: '▼';
    font-size: 10px;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.language-selector.open .current-language::after {
    transform: rotate(180deg);
}

/* Menu dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(166, 205, 67, 0.2);
    padding: 8px;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.language-selector.open .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Opções de idioma */
.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.language-option:hover {
    background: #f8f9fa;
    color: #162e5b;
    transform: translateX(3px);
}

.language-option.active {
    background: #a6cd43;
    color: white;
}

.language-option .language-name {
    font-weight: 600;
}

.language-option .language-code {
    font-size: 12px;
    opacity: 0.8;
    margin-left: auto;
}

/* Mobile responsivo */
@media (max-width: 768px) {
    .language-selector {
        top: 15px;
        right: 15px;
        padding: 6px;
    }
    
    .language-selector .current-language {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 70px;
    }
    
    .language-flag {
        width: 18px;
        height: 18px;
    }
    
    .language-dropdown {
        min-width: 110px;
    }
    
    .language-option {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Animação de entrada */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-selector {
    animation: slideInFromTop 0.5s ease-out;
}

/* Estados de carregamento */
.language-selector.loading .current-language {
    opacity: 0.7;
    pointer-events: none;
}

/* Indicador de idioma ativo */
.language-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .language-selector {
        background: rgba(22, 46, 91, 0.95);
        border-color: rgba(166, 205, 67, 0.3);
    }
    
    .language-selector:hover {
        background: rgba(22, 46, 91, 1);
    }
    
    .language-dropdown {
        background: #162e5b;
        border-color: rgba(166, 205, 67, 0.3);
    }
    
    .language-option {
        color: #fff;
    }
    
    .language-option:hover {
        background: rgba(166, 205, 67, 0.1);
    }
}

/* Acessibilidade */
.language-selector:focus-within {
    outline: 2px solid #a6cd43;
    outline-offset: 2px;
}

.language-option:focus {
    outline: 2px solid #a6cd43;
    outline-offset: -2px;
}

/* Transições suaves para mudança de idioma */
.fade-transition {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fade-transition.show {
    opacity: 1;
}

/* Loading state durante tradução */
.translating .language-selector {
    pointer-events: none;
}

.translating .language-selector .current-language::after {
    content: '⟳';
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}