@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

body {
    background-color: #09090b;
    color: #e5e7eb;
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

/* Overlay Inicial */
#bypassOverlay {
    position: fixed;
    inset: 0;
    background: #09090b;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#bypassOverlay h2 {
    color: #4ade80;
    font-size: 2rem;
    margin-bottom: 5px;
    font-weight: 800;
}

#startBtn {
    background: #4ade80;
    color: #0d0d0f;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    margin-top: 20px;
    transition: 0.2s;
}

#startBtn:hover {
    transform: scale(1.05);
}

/* Layout Base */
.dashboard {
    display: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #18181b;
    padding: 15px 30px;
    border-bottom: 1px solid #27272a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.brand h2 {
    margin: 0;
    font-size: 14px;
    letter-spacing: 2px;
    color: #a1a1aa;
}

#aiIndicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e83f5b;
    transition: 0.3s;
}

@keyframes pulse {
    0% {
        opacity: .6;
        box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 20px rgba(74, 222, 128, 0.8);
    }

    100% {
        opacity: .6;
        box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
    }
}

.controls-group {
    display: flex;
    gap: 10px;
    background: #000;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid #27272a;
    align-items: center;
}

.aiIcon {
    cursor: pointer;
    user-select: none;
    color: #52525b;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 18px;
    transition: 0.2s;
}

.aiIcon:hover {
    color: #e5e7eb;
    background: #27272a;
}

.aiIcon.active {
    color: #4ade80;
}

.aiIcon.dnd-mode {
    color: #fbbf24;
}

/* Grid Dashboard */
.layout-grid {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
}

.channels-column {
    flex: 2;
    overflow-y: auto;
    padding-right: 10px;
}

.logs-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #111;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #27272a;
}

.section-header {
    font-size: 11px;
    font-weight: 800;
    color: #71717a;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

/* Cards Dinâmicos e Animação de Pulso */
#channelsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* Colorização Integrada aos Cards */
/* Colorização Integrada aos Cards */
.card {
    background: var(--bg-tint, #121214); /* Fundo colorido translúcido */
    border: 1px solid #27272a;
    border-top: 4px solid var(--glow-color, #27272a);
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover { border-color: var(--glow-color); }

/* --- ANIMAÇÕES DE REPRODUÇÃO (PULSO DE BRILHO) --- */
/* --- ANIMAÇÕES DE REPRODUÇÃO (PULSO CHAMATIVO) --- */
@keyframes cardPulse {
    0% { box-shadow: 0 0 5px rgba(0, 0, 0, 0); }
    50% { 
        box-shadow: 0 0 50px var(--pulse-color), inset 0 0 20px var(--pulse-color); 
        border-color: var(--glow-color); 
    }
    100% { box-shadow: 0 0 5px rgba(0, 0, 0, 0); }
}

.card.playing-now {
    animation: cardPulse 1.5s infinite ease-in-out; /* Pulso mais rápido (1.5s) */
    background: #18181b !important;
}

@keyframes logPulse {
    0% { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0); }
    50% { 
        box-shadow: inset 10px 0 40px var(--pulse-color); 
        border-left-color: var(--glow-color); 
    }
    100% { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0); }
}

.active-log {
    animation: logPulse 1.5s infinite ease-in-out;
    background: #18181b;
    border-left-width: 4px;
}

/* Correção do Pop-up Modo Cérebro */
#waBrainPopup {
    display: none;
    position: absolute;
    top: 38px;
    left: -50px; /* NOVO: Move o popup para a esquerda para não ser cortado pela tela */
    background: #121214;
    border: 1px solid var(--glow-color, #27272a);
    border-top: 3px solid var(--glow-color, #e83f5b);
    padding: 15px;
    border-radius: 12px;
    width: 250px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
    z-index: 9999; /* NOVO: Elevação máxima para sobrepor colunas */
    flex-direction: column;
    gap: 15px;
}
@keyframes cardGlow {
    0% {
        box-shadow: 0 0 5px rgba(0, 0, 0, 0);
    }

    50% {
        box-shadow: 0 0 20px var(--glow-color);
    }

    100% {
        box-shadow: 0 0 5px rgba(0, 0, 0, 0);
    }
}



/* Card Header e Botões de Ação */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.card-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-btn {
    background: #09090b;
    color: #71717a;
    border: 1px solid #27272a;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}

.card-btn:hover {
    border-color: #52525b;
    color: #e5e7eb;
}

.card-btn.muted {
    color: #e83f5b;
    border-color: #e83f5b;
    background: rgba(232, 63, 91, 0.1);
}

.card-btn.delete:hover,
.card-btn.stop:hover {
    color: #e83f5b;
    border-color: #e83f5b;
}

.card-content {
    transition: opacity 0.2s;
    margin-bottom: 10px;
}

.card-content.muted {
    opacity: 0.4;
    pointer-events: none;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #27272a;
    padding-top: 12px;
    margin-top: 5px;
}

.queue-badge {
    background: #27272a;
    color: #a1a1aa;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}

.queue-badge.active {
    background: #4ade80;
    color: #000;
}

.aiLabel {
    font-size: 10px;
    color: #a1a1aa;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type=range] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: #3f3f46;
    border-radius: 2px;
    outline: none;
    margin-bottom: 15px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--glow-color, #52525b); /* NOVO: Herda a cor do respectivo canal */
    cursor: pointer;
    transition: 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--glow-color);
}

/* Switch do Modo Cérebro */
.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3f3f46;
    transition: .4s;
    border-radius: 16px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: #a1a1aa;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #e83f5b;
}

input:checked+.slider:before {
    transform: translateX(12px);
    background-color: #fff;
}

.switch-group {
    flex-wrap: wrap;
}

/* Evita corte lateral */
/* Fila e Logs */
#progress-container {
    width: 100%;
    height: 6px;
    background: #27272a;
    border-radius: 3px;
    margin-bottom: 15px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: #4ade80;
    transition: width 0.1s linear;
}

.log-area {
    flex: 1;
    background: #000;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid #27272a;
}

.log-time {
    color: #52525b;
    font-weight: bold;
    margin-right: 6px;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

/* Playable Logs */
.log-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    border-left: 2px solid transparent;
}

.log-item.active-log {
    background: #18181b;
    border-left-color: #4ade80;
}

.log-item:hover {
    background: #18181b;
}

.log-play-btn {
    background: none;
    border: none;
    color: #4ade80;
    cursor: pointer;
    font-size: 14px;
    margin-right: 8px;
    padding: 0;
    outline: none;
    transition: 0.2s;
    width: 20px;
    text-align: center;
}

.log-play-btn:hover {
    transform: scale(1.2);
    color: #fff;
}

.log-play-btn.playing {
    color: #e83f5b;
}

.log-content {
    flex: 1;
    line-height: 1.4;
    color: #d4d4d8;
}

.log-text-preview {
    color: #71717a;
    font-style: italic;
    display: block;
    margin-top: 2px;
}

.voice-select {
    background: #09090b;
    border: 1px solid #27272a;
    color: #a1a1aa;
    border-radius: 6px;
    padding: 6px;
    width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    outline: none;
    margin-bottom: 15px;
    cursor: pointer;
}

.voice-select:hover {
    border-color: #3f3f46;
}

.test-btn {
    background: #27272a;
    color: #e5e7eb;
    border: none;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    letter-spacing: 1px;
}

.test-btn:hover {
    background: #3f3f46;
}

/* Ícones SVG embutidos para evitar emojis quebrados */
.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}


/* Layout Responsivo para Celulares */
@media (max-width: 768px) {
    .layout-grid {
        flex-direction: column;
        overflow-y: auto;
        padding: 10px;
    }

    .channels-column,
    .logs-column {
        flex: unset;
        width: 100%;
        box-sizing: border-box;
        padding-right: 0;
    }

    .logs-column {
        min-height: 400px;
        margin-top: 10px;
    }

    .header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .controls-group {
        width: 100%;
        justify-content: space-between;
    }

    .brand h2 {
        font-size: 12px;
    }
}


/* --- UI/UX DO NOVO HISTÓRICO RICO E LOADER --- */

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #a1a1aa;
    font-size: 11px;
    font-weight: bold;
    gap: 15px;
    letter-spacing: 1px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #27272a;
    border-top: 3px solid #4ade80;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.new-log-style {
    display: flex;
    flex-direction: column;
    background: #121214;
    border: 1px solid #27272a;
    border-left: 3px solid transparent;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.new-log-style.active-log {
    background: #18181b;
    box-shadow: inset 0 0 20px rgba(74, 222, 128, 0.05);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #27272a;
}

.log-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-badge-rich {
    font-size: 9px;
    font-weight: 900;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.log-time-rich {
    font-size: 11px;
    color: #71717a;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

.group-tag {
    background: #3f3f46;
    color: #e5e7eb;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.rich-play-btn {
    background: #27272a;
    border: none;
    color: #e5e7eb;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    outline: none;
}

.rich-play-btn svg {
    width: 12px;
    height: 12px;
}

.rich-play-btn:hover {
    background: #4ade80;
    color: #000;
    transform: scale(1.1);
}

.rich-play-btn.playing {
    background: #e83f5b;
    color: #fff;
}

.log-body {
    font-size: 12px;
    line-height: 1.5;
    color: #d4d4d8;
    font-style: italic;
    word-break: break-word;
}


/* --- INBOX RICA: FILTROS, AVATARES E MENU DE AÇÕES --- */

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filter-pill {
    background: #18181b;
    border: 1px solid #27272a;
    color: #a1a1aa;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.filter-pill:hover {
    border-color: #52525b;
    color: #e5e7eb;
}

.filter-pill.active {
    background: #e5e7eb;
    color: #000;
    border-color: #e5e7eb;
}

.log-item.hidden-by-filter {
    display: none !important;
}

/* Ajuste do Card para receber o menu flutuante no topo-centro */
.new-log-style {
    display: flex;
    flex-direction: column;
    background: #121214;
    border: 1px solid #27272a;
    border-left: 3px solid transparent;
    border-radius: 8px;
    padding: 12px;
    padding-top: 25px;
    /* Espaço seguro para o menu flutuante */
    margin-bottom: 10px;
    transition: all 0.2s;
    position: relative;
}

.new-log-style.active-log {
    background: #18181b;
    box-shadow: inset 0 0 20px rgba(74, 222, 128, 0.05);
}

.log-header {
    justify-content: flex-start;
    gap: 12px;
    position: relative;
    width: 100%;
    display: flex;
}

/* Barra de Ações Centralizada no Topo */
.log-action-bar {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: all 0.2s ease;
    background: #18181b;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #3f3f46;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.new-log-style:hover .log-action-bar {
    opacity: 1;
    top: -5px;
}

.action-icon {
    background: transparent;
    border: none;
    color: #a1a1aa;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    padding: 0;
}

.action-icon svg {
    width: 14px;
    height: 14px;
}

.action-icon:hover {
    color: #fbbf24;
    transform: scale(1.1);
}

.action-icon.del:hover {
    color: #e83f5b;
}

.action-icon.play-main {
    color: #4ade80;
}

.action-icon.play-main:hover {
    color: #fbbf24;
    transform: scale(1.2);
}

.action-icon.play-main.playing {
    color: #e83f5b;
}

/* --- SISTEMA SEMÁFORO PARA BOTÕES DE ESTADO (Cards Principais) --- */
.card-btn.state-toggle {
    border-color: #4ade80;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
}

.card-btn.state-toggle.muted {
    border-color: #e83f5b;
    color: #e83f5b;
    background: rgba(232, 63, 91, 0.05);
    opacity: 0.4;
}

.card-btn.state-toggle:hover {
    border-color: #fbbf24 !important;
    color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.1) !important;
    opacity: 1;
}

/* Botão de Fila com Texto Descritivo */
.queue-toggle-btn {
    width: auto;
    padding: 0 12px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
}

.queue-toggle-btn.livre {
    border-color: #4ade80;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
}

.queue-toggle-btn.retida {
    border-color: #e83f5b;
    color: #e83f5b;
    background: rgba(232, 63, 91, 0.05);
}

.queue-toggle-btn:hover {
    border-color: #fbbf24;
    color: #fbbf24;
}


/* --- ESTILOS DO CARD ATIVO (PULSO E PROGRESSO) --- */

/* Animação de pulso neon com a cor dinâmica do canal */
@keyframes logGlow {
    0% {
        box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
    }

    50% {
        box-shadow: inset 0 0 20px var(--log-glow-color);
    }

    100% {
        box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
    }
}


/* Barra de progresso embutida no card */
.log-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    margin-top: 10px;
    border-radius: 2px;
    overflow: hidden;
    display: none;
    /* Só aparece quando o card está tocando */
}

.active-log .log-progress-container {
    display: block;
}

.log-progress-fill {
    height: 100%;
    width: 0%;
    transition: width 0.1s linear;
}