/* ==========================================================================
   1. VARIÁVEIS E TEMAS (LIGHT/DARK)
   ========================================================================== */
:root {
    --bg: #f8fafc;
    --kb-base: #f1f5f9;
    --key-bg: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --key-shadow: #cbd5e1;
    --accent: #3b82f6;
    --border-color: #e2e8f0;
    --header-bg: #1e293b;
    --panel-bg: #f1f5f9;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --kb-base: #1e293b;
    --key-bg: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --key-shadow: #020617;
    --accent: #60a5fa;
    --border-color: #334155;
    --header-bg: #020617;
    --panel-bg: #1e293b;
}

/* ==========================================================================
   2. RESET E BASE
   ========================================================================== */
body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: background 0.3s, color 0.3s;
    margin: 0;
}

.main-header {
    background: var(--header-bg);
    color: white;
    padding: 3rem 0;
    text-align: center;
    border-radius: 0 0 40px 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* ==========================================================================
   3. ESTRUTURA DO TECLADO (CENTRALIZAÇÃO)
   ========================================================================== */
.keyboard-base {
    background: var(--kb-base);
    padding: 30px;
    border-radius: 24px;
    border: 8px solid var(--kb-base);
    display: flex;
    justify-content: center;
    margin: 20px auto;
    max-width: fit-content;
    box-shadow: 0 20px 50px rgba(0,0,0,0.05);
}

.keyboard-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    padding: 10px;
}

.main-section { min-width: 780px; }
.command-section { min-width: 150px; }
.numpad-section { min-width: 200px; }

.key-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

/* ==========================================================================
   4. ESTILO DAS TECLAS
   ========================================================================== */
.key, .key_un {
    background: var(--key-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    height: 50px;
    min-width: 45px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--key-shadow) !important;
    transition: all 0.05s ease;
    user-select: none;
    text-decoration: none;
}

/* Estados Dinâmicos (JS) */
.key_highlight {
    background: var(--accent) !important;
    color: white !important;
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--key-shadow) !important;
}

.key_pressed {
    background: #10b981 !important; /* Verde */
    color: white !important;
    transform: translateY(3px);
    box-shadow: 0 1px 0 #059669 !important;
}

.key_pressed_m {
    background: #6366f1 !important; /* Roxo */
    color: white !important;
    transform: translateY(3px);
    box-shadow: 0 1px 0 #4f46e5 !important;
}

/* ==========================================================================
   5. LARGURAS E AJUSTES ABNT2
   ========================================================================== */
.backspace { width: 95px; background: #fef2f210 !important; }
.tab { min-width: 65px; }
.caps { min-width: 85px; }
.enter { width: 105px; background: #f0fdf410 !important; }
.shift-l { width: 80px; }
.shift-r { width: 130px !important; min-width: 130px; }
.ctrl, .alt { min-width: 65px; }
.space { width: 400px; }
.spacer-sm { width: 20px; }

/* Numpad Especifico */
.numpad-flex { display: flex; gap: 6px; }
.numpad-side { display: flex; flex-direction: column; gap: 6px; }
.key-0 { width: 96px !important; }
.key-enter-num { height: 106px !important; }
#key194 { background: var(--key-bg); }

/* Ícones */
.key i { font-size: 1.1rem; color: var(--text-muted); }

/* ==========================================================================
   6. STATUS BAR E PAINEL TÉCNICO
   ========================================================================== */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--key-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
    border-bottom: none;
}

.btn-reset {
    background: #ef4444;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 8px;
    font-weight: 600;
    transition: 0.2s;
    cursor: pointer;
}
.btn-reset:hover { background: #dc2626; }

.tech-info-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    padding: 10px 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-family: 'JetBrains Mono', monospace;
}

.tech-info-panel b { color: var(--accent); font-weight: 600; }
.tech-info-panel span { border-right: 1px solid var(--border-color); padding-right: 15px; }
.tech-info-panel span:last-child { border-right: none; }

.pulse { transform: scale(1.05); color: var(--accent); transition: transform 0.1s; }

.main-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 50px;
    background: var(--bg);
}

.stats-badge {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 10px 25px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.stats-badge i {
    color: var(--accent);
}

.footer-text {
    max-width: 750px;
    margin: 0 auto;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.text-accent {
    color: var(--accent);
}

.social-icon {
    font-size: 1.3rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.social-icon:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

.version-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.6;
}

.how-to-use-mini .badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

/* Ajuste de cores para alinhar com o JS */
.bg-warning { background-color: var(--accent) !important; color: white !important; } /* Laranja/Azul Ativo */
.bg-success { background-color: #10b981 !important; } /* Verde Pressionado */
.bg-info { background-color: #6366f1 !important; } /* Roxo Multi-Função */

.step-item {
    border-left: 2px solid var(--border-color);
    padding-left: 12px;
}

/* Pílulas de instrução lateral */
.key-pill {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

.pill-active { background: var(--accent); } /* Azul dinâmico */
.pill-success { background: #10b981; }      /* Verde sucesso */
.pill-special { background: #6366f1; }      /* Roxo modificado */

.alert-danger-soft {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
    border-radius: 8px;
}

[data-theme="dark"] .alert-danger-soft {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

.border-dashed {
    border: 2px dashed var(--border-color);
}

/* Cores suaves para os cards dentro do modal */
.bg-light-active { background: rgba(59, 130, 246, 0.05); }
.bg-light-success { background: rgba(16, 185, 129, 0.05); }
.bg-light-indigo { background: rgba(99, 102, 241, 0.05); }
.bg-indigo { background-color: #6366f1; }

/* --- Adaptação Refinada para Modo Noturno --- */
[data-theme="dark"] .modal-content {
    background-color: #1a1d21; /* Tom levemente acima do preto puro para dar profundidade */
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1); /* Borda sutil para separar do fundo */
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

[data-theme="dark"] .modal-header { 
    background: #212529; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .modal-footer { 
    background: #212529; 
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Garante que o botão de fechar (X) seja visível no escuro */
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Destaque para teclas de atalho (KBD) */
[data-theme="dark"] kbd { 
    background: #333; 
    color: #60a5fa; /* Azul claro para destacar atalhos */
    border: 1px solid #444;
}

/* --- Cores de Instrução (Roxo/Indigo) --- */
.bg-indigo {
    background-color: #6366f1 !important; 
    color: white !important;
}

/* Fundo suave para os cards de instrução */
.bg-light-indigo {
    background-color: rgba(99, 102, 241, 0.1) !important;
}

/* Ajuste específico para visibilidade no modo escuro */
[data-theme="dark"] .bg-light-indigo,
[data-theme="dark"] .bg-light-active,
[data-theme="dark"] .bg-light-success {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

/* Melhora o texto descritivo no escuro */
[data-theme="dark"] .text-muted {
    color: #94a3b8 !important; /* Cinza azulado claro para melhor leitura */
}

/* Alinhamento do Conteúdo do Header */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 20px; /* Espaço entre a imagem e o texto */
    text-align: left;
}

.header-logo {
    width: 65px; /* Tamanho ideal para reconhecimento */
    height: 65px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    object-fit: contain;
}

.logo-text h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

/* Ajuste do Botão de Tema no Header */
.main-header .btn-theme {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.main-header .btn-theme:hover {
    background: var(--accent);
    transform: scale(1.1);
}

/* Responsividade para Celulares */
@media (max-width: 768px) {
    .logo-wrapper {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
}
.touch-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    touch-action: none; /* Impede o scroll durante o teste */
}

.touch-box {
    aspect-ratio: 1 / 1;
    background: var(--key-bg);
    transition: background 0.1s;
}

.touch-box.touched {
    background: #10b981 !important; /* Verde Sucesso */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.social-icon#btn-share {
    position: relative;
    animation: pulse-share 3s infinite;
}

@keyframes pulse-share {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); color: var(--accent); }
    100% { transform: scale(1); }
}

/* Garante que o cursor mude para 'mãozinha' */
a[href="javascript:void(0)"] {
    cursor: pointer;
}
#btn-share {
    cursor: pointer !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#btn-share:active {
    transform: scale(0.9);
}

.star-input {
    display: flex;
    flex-direction: row-reverse;
}
.star-input input { display: none; }
.star-input label {
    font-size: 1.5rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: 0.2s;
}
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label {
    color: #fbbf24; /* Amarelo ouro */
}

/* Modo Escuro */
[data-theme="dark"] .star-input label { color: #475569; }
[data-theme="dark"] .feedback-item { border-bottom: 1px solid rgba(255,255,255,0.1); }

/* SweetAlert2 Dark Mode Adjustment */
[data-theme="dark"] .swal2-popup {
    background-color: #1a1d21 !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .swal2-title, 
[data-theme="dark"] .swal2-html-container {
    color: #f8fafc !important;
}

[data-theme="dark"] .swal2-confirm {
    background-color: #6366f1 !important;
}
.media-display {
    border: 1px solid rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .media-display {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1);
}

.media-display i {
    font-size: 0.85rem;
}

.btn-reacao {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.2s;
}
.btn-reacao:hover {
    color: #6366f1;
}
.text-indigo { color: #6366f1 !important; }
.border-indigo { border-color: #6366f1 !important; }

.bg-light-indigo {
    background-color: rgba(99, 102, 241, 0.08) !important;
    border-radius: 12px;
}

[data-theme="dark"] .bg-light-indigo {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.text-main {
    color: var(--text-main);
}
.bg-light-indigo {
    background-color: rgba(99, 102, 241, 0.05);
}

[data-theme="dark"] .bg-light-indigo {
    background-color: rgba(255, 255, 255, 0.03);
}

.border-primary {
    border-color: #6366f1 !important;
}

.ms-4 {
    margin-left: 1.5rem !important;
}