/* Estilos específicos para o Caça Palavras */
.word-search-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
}

.word-search-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.word-search-puzzle-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.word-search-words-list {
    order: 2;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}
#word-search-word-list .word-item{
   float: left;
   padding: 5px;
}

#word-search-words{
    width: 100%;
}

.word-search-grid-container {
    overflow: auto;
    max-width: 100%;
    max-height: 60vh;
    margin: 0 auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#word-search-grid {
    display: grid;
    gap: 2px;
    margin: 0 auto;
}

#word-search-grid .cell {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    background: white;
    border: 1px solid #ddd;
    user-select: none;
    transition: all 0.3s ease;
}

.cell.highlight {
    /*background-color: #b3e5fc;
    transition: background-color 0.2s;
    */

    background-color: #fff59d !important; /* Amarelo durante seleção */
    color: #000;
    transition: all 0.2s ease;
}

.cell.found {
    background-color: #a5d6a7 !important; /* Verde para palavras encontradas */
    color: #1b5e20;
    font-weight: bold;
}

.cell.invalid {
    background-color: #ffcdd2;
    animation: shake 0.5s;
}

.word-item.found {
    text-decoration: line-through !important;
    color: #28a745 !important;
    background-color: #d4edda !important;
}

.word-search-stats {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.word-search-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

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

    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-2px); }
    40%, 80% { transform: translateX(2px); }
}




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

/* Desktop */
@media (min-width: 769px) {

    .word-search-container {
        padding: 4px;
    }

   /* .word-search-puzzle-area {
        flex-direction: row;
    }
   */
    
    .word-search-words-list {
        flex: 1;
        min-width: 200px;
        order: 1;
    }
    
    .word-search-grid-container {
        flex: 2;
        order: 2;
    }
    
    #word-search-grid {
        grid-template-columns: repeat(15, 30px);
    }

    .result-container {
        padding: 0.5rem;
    }
    .result-container h3{
        font-size: 14px;
    }

    .word-search-container {
        padding: 4px;
    }
}

/* Mobile */
@media (max-width: 768px) {

    .word-search-container {
        padding: 4px;
    }

    #word-search-grid {
        grid-template-columns: repeat(10, 23px);
    }

    .word-search-grid-container {
       max-height: 65vh;
    }
    
    #word-search-grid .cell {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    .word-search-puzzle-area {
        flex-direction: column;
    }

    .result-container {
        padding: 0.5rem;
    }
    .result-container h3{
        font-size: 14px;
    }
}

@media print {
    body * {
        visibility: hidden;
    }
    .word-search-container, .word-search-container * {
        visibility: visible;
    }
    .word-search-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .word-search-actions {
        display: none;
    }
}