/* ===== IMPORTAÇÕES ===== */
@import url('layouts/start-screen.css');
@import url('layouts/game-screen.css');
@import url('layouts/results-screen.css');
@import url('components/header.css');

/* ===== ESTILOS GLOBAIS DO JOGO ===== */
.game-container {
    min-height: 60vh;
}

@media (max-width: 1024px) {
    .game-container {
        min-height: 50vh;
    }
}

/* ===== ANIMAÇÕES GLOBAIS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes text-pop {
    0% { transform: scale(0.9); opacity: 0; }
    70% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 4px 12px rgba(255, 116, 20, 0.2); }
    50% { box-shadow: 0 4px 20px rgba(255, 116, 20, 0.4); }
    100% { box-shadow: 0 4px 12px rgba(255, 116, 20, 0.2); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== CLASSES DE UTILIDADE ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.text-pop {
    animation: text-pop 0.3s ease-out;
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

.gradient-text {
    background: linear-gradient(
        160deg,
        #ec7fde 0%,
        #ffa312 55%,
        #ff7414 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% auto;
    animation: gradient-shift 3s ease infinite;
}

/* ===== ESTILOS ESPECÍFICOS DO T-3 ===== */
.input-section {
    margin: 1.5rem 0; /* Reduzido de 2rem */
}

.input-container {
    max-width: 400px;
    margin: 0 auto;
    position: relative;
}

#word-input {
    border: 2px solid var(--bs-primary);
    border-radius: 16px;
    padding: 1rem 1.25rem; /* Reduzido de 1.25rem 1.5rem */
    font-size: 1.5rem;
    transition: all 0.3s ease;
    background: var(--bs-body-bg);
    text-transform: uppercase;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    height: auto; /* Garantir altura automática */
    min-height: 60px; /* Altura mínima */
}

#word-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.15);
    transform: translateY(-3px);
}

#word-input.shake {
    border-color: var(--bs-danger);
    animation: shake 0.5s ease-in-out;
}

/* Seção de dicas modernizada */
.hint-section {
    text-align: center;
    margin-top: 1.5rem; /* Reduzido de 2rem */
}

.hint-button-container {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

#reveal-hint,
#skip-question,
#back-to-skipped {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  white-space: nowrap;
    font-size: 1rem; 
    border-radius: 12px;
    padding: 0.75rem 1.25rem; /* Reduzido de 0.875rem 1.5rem */
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 116, 20, 0.2);
    border: none;
    position: relative;
    overflow: hidden;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Botão Revelar Letra com gradiente */
#reveal-hint {
    background: linear-gradient(
        160deg,
        #ec7fde 0%,
        #ffa312 55%,
        #ff7414 100%
    );
}

#reveal-hint::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 55%,
        rgba(255, 255, 255, 0.1) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

#reveal-hint:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 116, 20, 0.3);
}

#reveal-hint:hover:not(:disabled)::before {
    opacity: 1;
}

#reveal-hint:disabled {
    background: var(--bs-light);
    border-color: var(--bs-border-color);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

#reveal-hint.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: linear-gradient(
        160deg,
        #ec7fde 20%,
        #ffa312 55%,
        #ff7414 100%
    );
}

#reveal-hint.pulse {
    animation: pulse-glow 1s ease-in-out;
}

#hint-timer-text {
    font-size: 1em; /* Reduzido de 0.9em */
    font-weight: 500;
    opacity: 0.9;
    margin-left: 4px; /* Reduzido de 8px */
}

/* Remover classes de cor padrão do Bootstrap */
#reveal-hint.btn-warning {
    background: linear-gradient(
        160deg,
        #ec7fde 0%,
        #ffa312 55%,
        #ff7414 100%
    );
    border-color: transparent;
}

#reveal-hint.btn-light {
    background: var(--bs-light);
    color: var(--bs-gray-500);
}

/* Feedback Container */
.feedback-container {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    margin-top: 0.25rem; /* Reduzido de 0.5rem */
    z-index: 10;
}

.input-feedback {
    font-size: 0.9rem; /* Reduzido de 1rem */
    font-weight: 600;
    padding: 0.5rem 1rem; /* Reduzido de 0.75rem 1.5rem */
    border-radius: 10px; /* Reduzido de 12px */
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
    min-width: 180px; /* Reduzido de 200px */
    text-align: center;
    white-space: nowrap;
}

.input-feedback.text-success {
    background: rgba(var(--bs-success-rgb), 0.1);
    border: 1px solid rgba(var(--bs-success-rgb), 0.3);
    color: var(--bs-success);
}

.input-feedback.text-danger {
    background: rgba(var(--bs-danger-rgb), 0.1);
    border: 1px solid rgba(var(--bs-danger-rgb), 0.3);
    color: var(--bs-danger);
}

.input-feedback.text-info {
    background: rgba(var(--bs-info-rgb), 0.1);
    border: 1px solid rgba(var(--bs-info-rgb), 0.3);
    color: var(--bs-info);
}

/* Remove qualquer fundo branco estranho */
.input-feedback:empty {
    display: none !important;
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(182px, 1fr)); /* Reduzido de 200px */
    gap: 0.75rem; /* Reduzido de 1rem */
    margin-top: 1.5rem; /* Reduzido de 2rem */
}

.word-item {
    background: var(--bs-body-bg);
    border: 2px solid var(--bs-border-color);
    border-radius: 10px; /* Reduzido de 12px */
    padding: 1rem 0.75rem; /* Reduzido de 1.5rem 1rem */
    text-align: center;
    transition: all 0.3s ease;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); /* Reduzido de 8px */
}

.word-item.found {
    border-color: var(--bs-success);
    background: linear-gradient(135deg, rgba(var(--bs-success-rgb), 0.1), rgba(var(--bs-success-rgb), 0.05));
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(var(--bs-success-rgb), 0.2); /* Reduzido de 15px */
}

.word-underscores {
    letter-spacing: 0.1em;
    line-height: 1.4; /* Reduzido de 1.6 */
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
    background: transparent !important;
    font-size: 1.1rem; /* Adicionado para controle de tamanho */
}

.word-text {
    animation: text-pop 0.5s ease-out;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--bs-success);
    font-size: 1rem; /* Adicionado para consistência */
}

/* ===== ESTILOS PARA LETRAS REVELADAS ===== */

/* Letras reveladas INICIALMENTE (cor primária) */
.revealed-letter.initial-reveal {
    color: var(--bs-primary) !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(var(--bs-primary-rgb), 0.2);
    animation: none !important;
}

/* Letras reveladas pelo BOTÃO (gradiente) */
.revealed-letter.hint-reveal {
    background: linear-gradient(
        160deg,
        #ec7fde 0%,
        #ffa312 55%,
        #ff7414 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
    font-weight: 800 !important;
    text-shadow: 0 2px 4px rgba(255, 116, 20, 0.3);
    position: relative;
}

/* Efeito de brilho nas letras reveladas pelo botão */
.revealed-letter.hint-reveal::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        #ffa312,
        transparent
    );
    border-radius: 2px;
    opacity: 0.7;
}

/* Garantir que todas as letras reveladas mantenham seus estilos */
.word-item .revealed-letter {
    animation: none;
}

/* Garantir que letras reveladas não percam estilo */
.word-item[data-word] .revealed-letter.initial-reveal {
    color: var(--bs-primary) !important;
}

.word-item[data-word] .revealed-letter.hint-reveal {
    background: linear-gradient(
        160deg,
        #ec7fde 0%,
        #ffa312 55%,
        #ff7414 100%
    ) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
}

/* Sobrescrever qualquer estilo que possa estar removendo a cor */
.word-underscores .revealed-letter.initial-reveal {
    color: var(--bs-primary) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.word-underscores .revealed-letter.hint-reveal {
    background: linear-gradient(
        160deg,
        #ec7fde 0%,
        #ffa312 55%,
        #ff7414 100%
    ) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Estilo base para todas as letras reveladas */
.revealed-letter {
    font-weight: 700;
    transition: all 0.3s ease;
}

/* Garante que todas as palavras reveladas tenham a mesma cor */
.word-item.found .word-text {
    color: var(--bs-success) !important;
    font-weight: 700;
}

/* Espaços - Correção para remover qualquer fundo branco */
.space-character {
    color: transparent !important;
    background: transparent !important;
    border: none !important;
    margin: 0 0.2em !important;
    padding: 0 !important;
}

.progress-animation {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.1), rgba(var(--bs-success-rgb), 0.1));
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem; /* Adicionado padding reduzido */
}

.progress-animation .spinner-border {
    width: 1rem; /* Reduzido de 1.25rem */
    height: 1rem;
}

.progress-text {
    font-weight: 600;
    font-size: 0.9rem; /* Adicionado tamanho de fonte */
}

/* Efeitos de foco modernos */
.btn:focus {
    box-shadow: 0 0 0 3px rgba(255, 116, 20, 0.25);
}

#reveal-hint:focus {
    box-shadow: 0 0 0 3px rgba(255, 116, 20, 0.25);
}

/* Remover qualquer background branco não intencional */
.card-flush,
.card-body,
.app-content,
.app-container {
    background: transparent !important;
}

/* Correção específica para o quadrado branco */
.words-grid .word-item .word-underscores {
    background: transparent !important;
}

.words-grid .word-item .word-text {
    background: transparent !important;
}

/* Garantir que o feedback esteja sempre visível quando ativo */
.input-feedback:not(:empty) {
    display: inline-block !important;
}

/* Melhorias para acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Estilos para garantir consistência visual */
.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Responsividade melhorada */
@media (max-width: 768px) {
    .words-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* Reduzido */
        gap: 0.5rem; /* Reduzido */
    }
    
    .word-item {
        min-height: 80px; /* Reduzido de 100px */
        padding: 0.75rem 0.5rem; /* Reduzido */
        border-radius: 8px; /* Reduzido */
    }
    
    .input-container {
        max-width: 320px;
    }
    
    #word-input {
        font-size: 1.25rem;
        padding: 0.875rem 1rem; /* Reduzido */
        border-radius: 12px;
        min-height: 55px; /* Reduzido */
    }
    
    .word-underscores {
        letter-spacing: 0.08em; /* Reduzido em mobile */
        font-size: 1rem !important;
    }
    
    .hint-section {
        margin-top: 1.25rem; /* Reduzido */
    }
    
    .hint-button-container {
        width: 100%;
        max-width: 280px;
    }
    
    #reveal-hint {
        width: 100%;
        justify-content: center;
        padding: 0.625rem 1rem; /* Reduzido */
    }
    
    .input-feedback {
        font-size: 0.85rem; /* Reduzido */
        padding: 0.5rem 0.875rem; /* Reduzido */
        min-width: 160px; /* Reduzido */
    }
    
    .feedback-container {
        margin-top: 0.2rem; /* Reduzido */
    }
    
    /* Ajustar tamanho das letras reveladas em mobile */
    .revealed-letter.initial-reveal,
    .revealed-letter.hint-reveal {
        font-size: 1.1em !important;
    }
}

@media (max-width: 480px) {
    .game-t5 .words-grid {
        grid-template-columns: minmax(0, 260px) !important; /* 1 coluna */
        justify-content: center !important;                 /* centraliza a coluna */
    }

    .game-t5 .word-item {
        width: 100%;
        margin: 0 auto;
    }

    .words-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.3rem; /* Reduzido */
        margin-top: 1rem;
    }
    
    .word-item {
        min-height: 60px; /* Reduzido de 90px */
        padding: 0.625rem 0.375rem; /* Reduzido */
    }
    
    .input-container {
        max-width: 280px;
    }
    
    #word-input {
        font-size: 1.1rem;
        padding: 0.75rem 0.875rem; /* Reduzido */
        min-height: 50px; /* Reduzido */
    }
    
    .word-underscores {
        letter-spacing: 0.06em; /* Ainda mais reduzido em telas pequenas */
        font-size: 0.85rem !important;
    }
    
    .input-feedback {
        font-size: 0.8rem; /* Reduzido */
        padding: 0.375rem 0.75rem; /* Reduzido */
        min-width: 140px; /* Reduzido */
    }
    
    .revealed-letter.initial-reveal,
    .revealed-letter.hint-reveal {
        font-size: 1em !important;
    }
    
    .hint-section {
        margin-top: 1rem; /* Reduzido */
    }
    
    #reveal-hint {
        padding: 0.5rem 0.875rem; /* Reduzido */
        font-size: 0.95rem; /* Reduzido */
    }
}

/* Ajustes finos para o layout mobile */
@media (max-width: 576px) {
    .hint-button-container {
        flex-direction: column;
        gap: 0.5rem; /* Reduzido */
    }
    
    #reveal-hint {
        order: 1;
    }
    
    .input-container {
        max-width: 100%;
    }
    
    #word-input {
        max-width: 100%;
    }
    
    .input-section {
        margin: 1rem 0; /* Reduzido */
    }
}

/* Garantir que os elementos de texto não tenham fundo branco */
.text-gray-900,
.text-gray-600,
.text-white,
.text-primary,
.text-success,
.text-warning,
.text-danger {
    background: transparent !important;
}

/* Remover qualquer sombra ou fundo indesejado nos elementos de quiz */
.quiz-hero,
.hero-background,
.hero-content,
.quiz-badge,
.stats-grid,
.start-actions {
    background: transparent !important;
}

/* Correção para garantir que o feedback desapareça completamente quando vazio */
#input-feedback:empty {
    opacity: 0;
    visibility: hidden;
    display: none !important;
}

/* Estilo para quando o feedback está ativo */
#input-feedback:not(:empty) {
    opacity: 1;
    visibility: visible;
    display: inline-block !important;
}