
/* ===== VARIÁVEIS CSS ===== */
:root {
    /* Cores principais */
    --cor-fundo: rgba(0, 0, 0, 0.75);
    --cor-elemento: #ffffff12;
    --cor-elemento-hover: #ffffff20;
    --cor-texto: #ffffff;
    --cor-texto-secundario: #ffffff80;

    /* Cores de destaque */
    --cor-destaque: #4a9eff;
    --cor-destaque-hover: #6bb3ff;
    --cor-microfone: #ff6b6b;

    /* Bordas */
    --borda-padrao: 15px;
    --borda-grande: 25px;

    /* Transições */
    --transicao: 0.3s ease;
    --transicao-lenta: 0.5s ease;
}

/* ===== RESET ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}

/* ===== BODY ===== */
body {
    background-image: url("./img/mapa.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===== CAIXA PRINCIPAL - GLASSMORPHISM ===== */
.caixa-maior {
    background: var(--cor-fundo);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 450px;
    border-radius: var(--borda-grande);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
}

.caixa-maior:hover {
    transform: translateY(-5px);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.6),
        0 10px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ===== TEXTAREA ===== */
.input-texto {
    width: 100%;
    min-height: 130px;
    border: 2px solid transparent;
    outline: none;
    background: linear-gradient(145deg, #ffffff12, #ffffff08);
    border-radius: var(--borda-padrao);
    color: var(--cor-texto);
    font-size: 16px;
    padding: 18px;
    resize: vertical;
    transition: all var(--transicao);
    line-height: 1.6;
}

.input-texto::placeholder {
    color: var(--cor-texto-secundario);
}

.input-texto:focus {
    border-color: var(--cor-destaque);
    background: linear-gradient(145deg, #ffffff18, #ffffff10);
    box-shadow:
        0 0 0 4px rgba(74, 158, 255, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Scrollbar customizada */
.input-texto::-webkit-scrollbar {
    width: 8px;
}

.input-texto::-webkit-scrollbar-track {
    background: transparent;
}

.input-texto::-webkit-scrollbar-thumb {
    background: var(--cor-destaque);
    border-radius: 10px;
}

.input-texto::-webkit-scrollbar-thumb:hover {
    background: var(--cor-destaque-hover);
}

/* ===== ÁREA DE CONTROLE ===== */
.controle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

/* ===== SELECT DE IDIOMA ===== */
.idioma {
    flex: 1;
    padding: 14px 44px 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    outline: none;

    background-color: rgba(255, 255, 255, 0.08);
    color: var(--cor-texto);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transicao);

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5l6.5 6 6.5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 14px;
}

.idioma:hover {
    border-color: var(--cor-destaque);
    background-color: rgba(255, 255, 255, 0.12);
}

.idioma:focus,
.idioma:focus-visible {
    border-color: var(--cor-destaque);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.25);
}

/* OPTIONS SEM BUG */
.idioma option {
    background-color: #ffffff;
    color: #000000;
    font-size: 14px;
}


/* ===== BOTÕES - BASE ===== */
button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transicao);
    position: relative;
    overflow: hidden;
}

button img {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: all var(--transicao);
    position: relative;
    z-index: 2;
}

button:active {
    transform: scale(0.92);
}

/* ===== BOTÃO TRADUZIR - NEON EFFECT ===== */
button:first-of-type {
    background: linear-gradient(135deg, #4a9eff, #2d7dd2);
    box-shadow:
        0 4px 15px rgba(74, 158, 255, 0.4),
        0 0 30px rgba(74, 158, 255, 0.2);
}

/* Efeito de brilho deslizante */
button:first-of-type::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.35),
            transparent);
    transition: left var(--transicao-lenta);
    z-index: 1;
}

button:first-of-type:hover::before {
    left: 100%;
}

button:first-of-type:hover {
    box-shadow:
        0 6px 25px rgba(74, 158, 255, 0.6),
        0 0 50px rgba(74, 158, 255, 0.4);
    transform: scale(1.1) translateY(-2px);
}

button:first-of-type:hover img {
    transform: rotate(15deg) scale(1.1);
}

/* ===== BOTÃO MICROFONE ===== */
button:last-of-type {
    background: linear-gradient(145deg, #ffffff18, #ffffff08);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

button:last-of-type:hover {
    background: linear-gradient(145deg, #ff6b6b30, #ff6b6b15);
    border-color: var(--cor-microfone);
    box-shadow:
        0 0 20px rgba(255, 107, 107, 0.3),
        0 5px 15px rgba(255, 107, 107, 0.2);
    transform: scale(1.1);
}

button:last-of-type:hover img {
    opacity: 1;
}

/* Animação de gravando */
button:last-of-type.gravando {
    animation: pulse 1.5s infinite;
    border-color: var(--cor-microfone);
    background: linear-gradient(145deg, #ff6b6b30, #ff6b6b15);
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(255, 107, 107, 0);
    }
}

/* ===== BOTÃO LOADING ===== */
button.carregando {
    pointer-events: none;
    opacity: 0.7;
}

button.carregando img {
    animation: girar 1s linear infinite;
}

@keyframes girar {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== ÁREA DE RESULTADO ===== */
.resultado {
    padding: 22px;
    background: linear-gradient(145deg, #ffffff12, #ffffff06);
    border-radius: var(--borda-padrao);
    border-left: 4px solid var(--cor-destaque);
    min-height: 100px;
    transition: all var(--transicao);
    position: relative;
    overflow: hidden;
}

/* Linha decorativa animada */
.resultado::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0%;
    background: linear-gradient(180deg, #4a9eff, #6bb3ff, #4a9eff);
    transition: height var(--transicao-lenta);
}

.resultado:hover::before {
    height: 100%;
}

.resultado:hover {
    background: linear-gradient(145deg, #ffffff18, #ffffff0a);
    transform: translateX(5px);
}

/* ===== TÍTULO DA TRADUÇÃO ===== */
.titulo-traducao {
    color: var(--cor-texto-secundario);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.titulo-traducao::before {
    content: '◆';
    color: var(--cor-destaque);
    font-size: 8px;
}

/* ===== TEXTO DA TRADUÇÃO ===== */
.traducao {
    color: var(--cor-texto);
    font-size: 18px;
    line-height: 1.7;
    word-wrap: break-word;
}

/* Animação quando a tradução aparece */
.traducao.mostrar {
    animation: fadeInUp var(--transicao-lenta) ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Efeito de digitação */
.traducao.digitando::after {
    content: '|';
    animation: piscar 0.8s infinite;
    color: var(--cor-destaque);
    margin-left: 2px;
}

@keyframes piscar {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .caixa-maior {
        padding: 20px;
        border-radius: 20px;
    }

    .caixa-maior:hover {
        transform: none;
    }

    .controle {
        flex-wrap: wrap;
        gap: 10px;
    }

    .idioma {
        width: 100%;
        flex: none;
        order: 1;
    }

    button {
        width: 48px;
        height: 48px;
    }

    button:first-of-type {
        order: 2;
        flex: 1;
        border-radius: 12px;
        width: auto;
    }

    button:last-of-type {
        order: 3;
    }

    .input-texto {
        font-size: 15px;
        min-height: 110px;
        padding: 15px;
    }

    .traducao {
        font-size: 16px;
    }

    .resultado {
        padding: 18px;
    }
}

@media (max-width: 360px) {
    .caixa-maior {
        padding: 16px;
    }

    .controle {
        gap: 8px;
    }

    button {
        width: 44px;
        height: 44px;
    }

    button img {
        width: 20px;
        height: 20px;
    }
}

/* ===== ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== SELEÇÃO DE TEXTO ===== */
::selection {
    background: var(--cor-destaque);
    color: var(--cor-texto);
}

::-moz-selection {
    background: var(--cor-destaque);
    color: var(--cor-texto);
}

/* ===== FOCUS VISIBLE (Acessibilidade) ===== */
button:focus-visible,
.idioma:focus-visible,
.input-texto:focus-visible {
    outline: 3px solid var(--cor-destaque);
    outline-offset: 3px;
}

/* ===== ESTADO DESABILITADO ===== */
button:disabled,
.idioma:disabled,
.input-texto:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== TOOLTIP CUSTOMIZADO ===== */
button[title] {
    position: relative;
}

button[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: var(--cor-texto);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

button[title]:hover::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
    z-index: 100;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== ESTADO VAZIO DO RESULTADO ===== */
.traducao:empty::before {
    content: 'A tradução aparecerá aqui...';
    color: var(--cor-texto-secundario);
    font-style: italic;
}

/* ===== ESTADO DE ERRO ===== */
.resultado.erro {
    border-left-color: #ff6b6b;
}

.resultado.erro .traducao {
    color: #ff6b6b;
}

/* ===== ESTADO DE SUCESSO ===== */
.resultado.sucesso {
    border-left-color: #4ecdc4;
}

.resultado.sucesso::before {
    background: linear-gradient(180deg, #4ecdc4, #45b7aa, #4ecdc4);
}


.credits {
    margin-top: 24px;
    padding: 16px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: center;
}

.credits-content {
    text-align: center;
}

.credits p {
    color: #888;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.credits a {
    color: #EBF4DD;
    text-decoration: none;
    font-weight: 700;
    position: relative;
    transition: color 0.3s ease;
}

.credits a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #EBF4DD;
    transition: width 0.3s ease;
}

.credits a:hover::after {
    width: 100%;
}

.credits a:hover {
    color: #fff;
}

.github-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    transition: transform 0.3s ease;
}
