/* ============================================================================
 * FOLHA DE ESTILOS PRINCIPAL
 * Projeto: Desafio de Palavras
 * ============================================================================ */

/*--------------------------------------------------------------------------*/
/* ESTILOS GERAIS E DE BASE
/*--------------------------------------------------------------------------*/
html {
    overflow-y: scroll;
}

body {
    font-family: 'Montserrat', 'Trebuchet MS', sans-serif;
    color: #ffffff;
    line-height: 1.6;
    margin: 0;
    
    background-image: 
        linear-gradient(rgba(15, 15, 25, 0.50), rgba(15, 15, 25, 0.50)),
        url('/imagens/fundo.webp'); 
    background-size: cover;
    background-position: center 20%;
    background-attachment: fixed;
    
    display: flex;
    flex-direction: column; 
    align-items: center;
    padding: 20px;
    min-height: 100vh;
}

/*--------------------------------------------------------------------------*/
/* LAYOUT PRINCIPAL E CABEÇALHO
/*--------------------------------------------------------------------------*/
header {
    max-width: 800px;
    width: 100%;
    padding: 0 40px;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.15); 
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

main {
    background-color: rgba(10, 10, 25, 0.75);
    max-width: 800px;
    width: 100%;
    padding: 30px 40px 100px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 100px; 
}

/*--------------------------------------------------------------------------*/
/* ESTILOS DE TEXTO E LOGO
/*--------------------------------------------------------------------------*/

header h1 {
    display: inline-block;
    font-family: 'Trebuchet MS', 'Montserrat', sans-serif;
    font-size: 5em;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 3px 3px 10px rgba(0,0,0,0.8);
    margin: 20px 0 0 0;
    padding: 0;
    line-height: 1;
    text-align: left;
}

header h1 .titulo-vermelho {
    color: #ec0404;
    font-family: inherit;
}

.slogan-container {
    display: flex;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 20px;
}

.slogan-container i {
    font-size: 1.1em;
    color: #1b1b1a;
    margin-right: 5px;
    vertical-align: middle;
}

.slogan-container .slogan {
    font-family: 'Trebuchet MS', 'Montserrat', sans-serif;
    font-size: 0.70em;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 1px 1px 5px rgba(0,0,0,0.5);
    font-style: italic;
    quotes: "“" "”" "‘" "’";
}

.slogan-container .slogan::before {
    content: open-quote;
    font-family: Arial, sans-serif;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    vertical-align: sub;
    margin-right: 5px;
}

.slogan-container .slogan::after {
    content: close-quote;
    font-family: Arial, sans-serif;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    vertical-align: sub;
    margin-left: 5px;
}

#selecao-jogo h2 {
    font-weight: normal;
    font-size: 1.2em;
    text-align: left;
    padding-left: 10px;
    margin-bottom: 20px;
    color: #ccc;
}

/*--------------------------------------------------------------------------*/
/* ÁREA DE JOGO E CONTROLOS
/*--------------------------------------------------------------------------*/
.escondido {
    display: none !important;
}

#botoes-jogos {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-top: 20px;
}

#botoes-jogos button {
    padding: 15px;
    font-size: 13px;
    font-weight: normal;
    color: #ffffff;
    background-color: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    white-space: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    text-transform: none; /* AQUI ESTÁ A ALTERAÇÃO */
}

#botoes-jogos button:hover {
    background-color: #ff0000;
    border-color: #ff0000;
}

#display-texto {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    margin-top: 15px;
    border-radius: 6px;
    min-height: 150px;
    font-family: "Courier New", Courier, monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #f1f1f1;
}

#botao-voltar {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    color: white;
    background-color: #6c757d;
}

#botao-voltar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

#area-feedback {
    margin-top: 20px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#mensagem-feedback {
    text-align: center;
    font-weight: bold;
    min-height: 24px;
    font-size: 1.1em;
    margin: 0;
}

/*--------------------------------------------------------------------------*/
/* RODAPÉ
/*--------------------------------------------------------------------------*/

footer {
    text-align: center;
    margin-top: 40px; 
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer a, footer a:visited {
    color: rgba(255, 255, 255, 0.6); 
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ffffff;
}

/* ============================================================================
 * REGRAS PARA ECRÃS PEQUENOS (DESIGN RESPONSIVO)
 * ============================================================================ */

@media (max-width: 768px) {
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 3.5em; 
        text-align: center;
        display: block;
    }
    
    header h1 .slogan {
        text-align: center;
    }

    #selecao-jogo h2 {
        text-align: center;
        padding-left: 0;
    }

    #botoes-jogos {
        grid-template-columns: repeat(2, 1fr);
    }
    
    main {
        padding: 20px 15px; 
    }
}

/* ============================================================================
 * BARRA DE INPUT FIXA NO FUNDO (OTIMIZADA)
 * ============================================================================ */

#barra-input-fixa {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(15, 15, 25, 0.97) 0%, rgba(10, 10, 20, 0.98) 100%);
    border-top: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
}

.barra-conteudo {
    max-width: 100%; /* Usa largura máxima disponível */
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.barra-input-grupo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.barra-input-grupo label {
    font-size: 14px;
    color: #ccc;
    white-space: nowrap;
    font-weight: 500;
}

#barra-input-posicao {
    flex-shrink: 0;
}

.barra-palavra-grupo {
    flex-shrink: 0; /* Não encolhe */
    width: 350px; /* Largura fixa razoável */
}

#barra-posicao {
    width: 55px; /* Reduzido - suficiente para 3 dígitos */
    padding: 12px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background-color: rgba(50, 50, 60, 0.8);
    color: #fff;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

#barra-palavra {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background-color: rgba(50, 50, 60, 0.8);
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

#barra-posicao:focus,
#barra-palavra:focus {
    outline: none;
    border-color: #ff0000;
    background-color: rgba(60, 60, 70, 0.9);
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

#barra-botao-enviar {
    padding: 12px 20px; /* Reduzido de 30px para 20px */
    border: none;
    border-radius: 6px;
    color: white;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
    flex-shrink: 0; /* Não encolhe */
}

#barra-botao-enviar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.5);
    background: linear-gradient(135deg, #ff2222 0%, #dd0000 100%);
}

#barra-botao-enviar:active {
    transform: translateY(0);
}

#barra-botao-enviar i {
    font-size: 14px;
}

/* Botão de Toggle de Som */
.botao-som {
    padding: 12px 15px;
    border: none;
    border-radius: 6px;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 50px;
}

.botao-som:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.botao-som:active {
    transform: translateY(0);
}

.botao-som.desativado {
    background: rgba(150, 150, 150, 0.3);
    color: rgba(255, 255, 255, 0.5);
}

.botao-som.desativado:hover {
    background: rgba(150, 150, 150, 0.4);
}

/* Ajuste no main para evitar que o conteúdo fique escondido pela barra */
main {
    margin-bottom: 100px;
}

/* ============================================================================
 * TOAST NOTIFICATION (FEEDBACK VISUAL)
 * ============================================================================ */

#toast-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 25px 35px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90%;
    min-width: 300px;
}

#toast-notification.toast-visivel {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

#toast-notification.toast-escondido {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.toast-conteudo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast-icone {
    font-size: 40px;
    flex-shrink: 0;
    animation: toastBounce 0.6s ease-out;
}

.toast-mensagem {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.4;
    text-align: left;
}

/* Animação do ícone */
@keyframes toastBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Responsivo - Mobile */
@media (max-width: 480px) {
    #toast-notification {
        min-width: 0;
        max-width: 85%;
        padding: 20px 25px;
    }
    
    .toast-conteudo {
        flex-direction: column; /* Layout vertical no mobile */
        text-align: center;
        gap: 12px;
    }
    
    .toast-icone {
        font-size: 45px; /* Maior no mobile já que fica em cima */
    }
    
    .toast-mensagem {
        font-size: 15px;
        text-align: center; /* Centralizado no mobile */
        line-height: 1.5;
    }
}

/* ============================================================================
 * RESPONSIVIDADE DA BARRA FIXA
 * ============================================================================ */

/* Tablets */
@media (max-width: 768px) {
    #barra-input-fixa {
        padding: 12px 15px;
    }
    
    .barra-conteudo {
        gap: 10px;
    }
    
    .barra-palavra-grupo {
        width: 280px; /* Reduzido para tablet */
    }
    
    #barra-posicao {
        width: 50px; /* Ainda mais compacto no tablet */
        padding: 10px 8px;
        font-size: 15px;
    }
    
    #barra-palavra {
        padding: 10px 12px;
        font-size: 15px;
    }
    
    #barra-botao-enviar {
        padding: 10px 16px; /* Mais compacto */
        font-size: 14px;
    }
    
    .barra-input-grupo label {
        font-size: 13px;
    }
}

/* Telemóveis */
@media (max-width: 480px) {
    #barra-input-fixa {
        padding: 10px 8px;
    }
    
    .barra-conteudo {
        gap: 8px;
        flex-wrap: nowrap; /* ✅ NÃO quebra linha! */
    }
    
    #barra-input-posicao {
        flex-shrink: 0;
    }
    
    .barra-palavra-grupo {
        flex: 1; /* ✅ Cresce para preencher espaço */
        min-width: 0; /* ✅ Permite encolher se necessário */
    }
    
    #barra-posicao {
        width: 45px; /* ✅ Pequeno - só 3 dígitos */
        padding: 10px 6px;
        font-size: 16px;
    }
    
    #barra-palavra {
        width: 100%;
        padding: 10px 12px;
        font-size: 16px;
    }
    
    #barra-botao-enviar {
        padding: 10px 12px; /* ✅ Só o necessário */
        font-size: 14px;
        flex-shrink: 0;
        width: auto; /* ✅ NÃO ocupa 100%! */
    }
    
    .botao-som {
        padding: 10px 12px;
        font-size: 16px;
        min-width: 45px;
    }
    
    .barra-input-grupo label {
        font-size: 12px;
    }
}