/* components.css */

/* Language Switcher */
.language-switcher {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.lang-button {
    background-color: #555;
    color: #eee;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s, transform 0.1s;
}

.lang-button:hover {
    background-color: #666;
    transform: translateY(-1px);
}

.lang-button.active-lang { /* Esta é a classe que o seu JS precisa adicionar/remover */
    background-color: #00bcd4;
    color: #fff;
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.5);
}

/* Itens de controle (sliders, checkboxes, etc.) */
.control-item {
    display: flex;
    align-items: center;
    gap: 10px; /* Espaço entre label/input/checkbox */
    background-color: #555; /* Fundo mais claro para os itens */
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    width: 100%; /* Ocupa a largura total da sua coluna */
    box-sizing: border-box;
}

.control-item label {
    font-weight: bold;
    color: #ccc;
    white-space: nowrap;
    flex-shrink: 0; /* Impede que a label encolha */
}

/* Range sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%; /* Ocupa o restante do espaço */
    height: 8px;
    background: #666;
    border-radius: 50px; /* Mais redondo para visual moderno */
    outline: none;
    transition: opacity .2s;
    flex-grow: 1; /* Permite que o slider preencha o espaço disponível */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00bcd4;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 188, 212, 0.7);
    transition: background 0.2s, box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #00a0b7;
    box-shadow: 0 0 8px rgba(0, 188, 212, 1);
}

#volume-display, #fadeIn-display, #fadeout-display {
    min-width: 70px;
    text-align: right;
    font-weight: bold;
    color: #00bcd4;
    flex-shrink: 0; /* Impede que o display encolha */
}

/* Checkboxes */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #00bcd4;
    border-radius: 4px;
    background-color: #555;
    cursor: pointer;
    position: relative;
    outline: none;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background-color: #00bcd4;
    border-color: #00bcd4;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Botões da coluna direita ("Carregar Múltiplos Sons", "Parar Todos os Sons") */
.right-column button {
    background-color: #00bcd4;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    width: 100%; /* Faz os botões ocuparem a largura total da coluna */
    box-sizing: border-box;
    margin-bottom: 10px; /* Adicionado para espaçamento entre os botões */
}

/* Ajusta o margin-bottom do último botão na coluna direita para evitar espaçamento excessivo */
.right-column button:last-of-type {
    margin-bottom: 0;
}

.right-column button:hover {
    background-color: #00a0b7;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.right-column button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Células da Soundboard */
.sound-cell {
    width: 100px;
    height: 100px;
    background-color: #555;
    border: 3px solid #666;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s ease-in, border-color 0.3s;
    user-select: none;
    overflow: hidden;
    flex-shrink: 0;
}

.sound-cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.sound-cell.empty {
    background-color: #1a1a1a;
    border-style: dashed;
    border-color: #555;
    color: #777;
    cursor: default;
    transform: none; /* Remove transform hover from empty cells */
    box-shadow: none; /* Remove box-shadow hover from empty cells */
}

.sound-cell.empty:hover {
    transform: none;
    box-shadow: none;
}

.sound-cell.filled {
    background-color: #4a4a4a;
    border-color: #777;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.sound-cell.filled:hover {
    background-color: #5a5a5a;
    border-color: #888;
}

/* Estilo para quando a célula é ativada (pressionada fisicamente ou via teclado, antes de iniciar o som) */
.sound-cell.active {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 188, 212, 0.8), 0 0 30px rgba(0, 188, 212, 0.6);
    background-color: #00bcd4; /* Cor de destaque para o estado ativo (azul ciano) */
    border-color: #00bcd4;
    z-index: 1;
}

/* Se um som estiver cued (Amarelo, como antes) */
.sound-cell.cued {
    border-color: #ffeb3b;
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.7);
    transform: scale(1.02);
}

/* Feedback Visual de Reprodução (Geral - para qualquer som tocando) */
.sound-cell.playing-feedback {
    background-color: #4444CC; /* Fundo azul vibrante como na imagem */
    border-color: #ADFF2F; /* Verde néon para a borda */
    border-width: 5px; /* Borda mais grossa para destaque */
    box-shadow: 0 0 25px rgba(173, 255, 47, 0.9), 0 0 40px rgba(173, 255, 47, 0.7); /* Sombra intensa verde néon */
    transform: scale(1.05); /* Um pouco mais de aumento */
    z-index: 2; /* Garante que a célula a tocar esteja acima de outras */
    position: relative; /* Necessário para o pseudo-elemento ::after */
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, background-color 0.1s ease-out, border-color 0.1s ease-out, border-width 0.1s ease-out; /* Transições suaves para todos os efeitos */
}

/* Efeito de pulsação para qualquer sound-cell que esteja tocando */
.sound-cell.playing-feedback::after {
    content: '';
    position: absolute;
    top: -8px; /* Ajustado para compensar a borda mais grossa */
    left: -8px; /* Ajustado para compensar a borda mais grossa */
    right: -8px; /* Ajustado para compensar a borda mais grossa */
    bottom: -8px; /* Ajustado para compensar a borda mais grossa */
    border: 4px solid rgba(173, 255, 47, 0.6); /* Borda pulsante com a cor verde néon e mais grossa */
    border-radius: 10px; /* Adapta-se ao border-radius da célula */
    animation: pulse-green-neon 1.3s infinite ease-out; /* Animação de pulsação ligeiramente mais rápida */
    z-index: -1; /* Garante que a pulsação fique atrás do conteúdo da célula */
}

@keyframes pulse-green-neon {
    0% {
        transform: scale(1);
        opacity: 1;
        border-width: 4px; /* Começa com a espessura da borda do after */
    }
    50% {
        transform: scale(1.1); /* Pulsa um pouco mais */
        opacity: 0.6;
        border-width: 7px; /* Aumenta a espessura da borda na pulsação */
    }
    100% {
        transform: scale(1);
        opacity: 1;
        border-width: 4px;
    }
}

/* Se um som estiver a tocar E cued (prioriza o feedback de 'playing-feedback') */
.sound-cell.playing-feedback.cued {
    border-color: #ADFF2F !important; /* Prioriza o verde néon */
    box-shadow: 0 0 15px rgba(173, 255, 47, 0.7), 0 0 15px #ffeb3b; /* Combina sombras de playing (verde néon) e cued (amarelo) */
    background-color: #4444CC !important; /* Prioriza o fundo azul da célula a tocar */
}


/* Display da Tecla */
.key-display {
    font-size: 1.2em;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    position: absolute;
    top: 5px;
    left: 8px;
    padding: 2px 5px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    z-index: 10;
}

/* Nome do Som */
.sound-name {
    font-size: 0.6em; /* Já ajustado para 0.6em */
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%;
    text-align: left; /* ALINHADO À ESQUERDA */
    padding-top: 20px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    /* justify-content: center; REMOVIDO */
}

.sound-name:focus {
    outline: 2px solid #00bcd4;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

/* Botões de controle dentro da célula (Delete, Loop, Replace) */
.delete-button,
.loop-button,
.replace-sound-button {
    position: absolute;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.1s;
    line-height: 1;
    z-index: 20;
    padding: 0;
}

.delete-button {
    top: 5px;
    right: 5px;
    color: #ff4d4d;
}

.delete-button:hover {
    background-color: rgba(255, 77, 77, 0.7);
    color: #fff;
    transform: scale(1.1);
}

.loop-button {
    bottom: 5px;
    left: 5px;
    color: #4CAF50;
}

.loop-button .material-symbols-outlined {
    font-size: 1.1em;
}

.loop-button:hover {
    background-color: rgba(76, 175, 80, 0.7);
    color: #fff;
    transform: scale(1.1);
}

.loop-button.active { /* Cor para o botão de loop ativo */
    background-color: #4CAF50;
    color: #fff;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.replace-sound-button {
    bottom: 5px;
    right: 5px;
    color: #2196F3;
}

.replace-sound-button .material-symbols-outlined {
    font-size: 1.1em;
}

.replace-sound-button:hover {
    background-color: rgba(33, 150, 243, 0.7);
    color: #fff;
    transform: scale(1.1);
}

/* Container e botão de ajuda */
.help-button-container {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.help-button-container #toggle-help-button {
    background-color: #00bcd4;
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.help-button-container #toggle-help-button:hover {
    background-color: #00a0b7;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.help-button-container #toggle-help-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Help Text */
.help-text {
    background-color: #444;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
    text-align: left;

    max-height: 0; /* Inicia escondido */
    overflow: hidden;
    opacity: 0;
    pointer-events: none;

    /* Transição para mostrar/esconder */
    transition: max-height 0.7s ease-in-out, opacity 0.5s ease-in-out, padding 0.7s ease-in-out, margin-top 0.7s ease-in-out;
}

.help-text.visible {
    max-height: 1000px; /* Certifique-se que este valor é maior que o conteúdo máximo esperado */
    padding: 20px;
    margin-top: 30px;
    opacity: 1;
    pointer-events: auto;
    /* Mantenha a transição suave aqui */
    transition: max-height 0.7s ease-in-out, opacity 0.5s ease-in-out, padding 0.7s ease-in-out, margin-top 0.7s ease-in-out;
}
.help-text h3 {
    color: #00bcd4;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.help-text ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-text li {
    margin-bottom: 8px;
    line-height: 1.4;
    color: #ccc;
    font-size: 0.95em;
}

.help-text li strong {
    color: #fff;
}

.help-text kbd {
    background-color: #555;
    border: 1px solid #777;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: #eee;
    white-space: nowrap;
}

/* NOVOS ESTILOS PARA GESTÃO DE SESSÕES AQUI */
/* Estilos para a lista de sessões dentro do popup */
#session-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
    max-height: 200px; /* Limita a altura da lista e adiciona scroll */
    overflow-y: auto;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #444;
}

#session-list li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    color: #eee; /* Cor do texto padrão da lista */
}

#session-list li:last-child {
    border-bottom: none;
}

#session-list li:hover {
    background-color: #666;
}

#session-list li.selected {
    background-color: #00bcd4;
    color: #fff;
}

.delete-session-button {
    background-color: #dc3545; /* Cor vermelha para apagar */
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    margin-left: 10px;
    transition: background-color 0.2s;
    flex-shrink: 0; /* Garante que o botão não encolha */
}

.delete-session-button:hover {
    background-color: #c82333;
}
