/**
 * WP Flow - Estilos do Sistema de Atendimento
 *
 * Estilos para o painel do operador e botão do cliente.
 */

/* ============================================
   PAINEL DO OPERADOR (Dashboard)
   ============================================ */

.wpflow-atendimento-container {
    max-width: 100%;
    margin: 0;
}

/* Estatísticas */
.wpflow-atendimento-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
    min-width: 120px;
}

.stat-card .stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.stat-card.pendentes .stat-number {
    color: #dc3232;
}

.stat-card.atendimento .stat-number {
    color: #00a32a;
}

.stat-card.total .stat-number {
    color: #2271b1;
}

/* Layout principal */
.wpflow-atendimento-main {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    min-height: 600px;
}

/* Lista de sessões */
.wpflow-sessoes-lista {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.sessoes-secao {
    border-bottom: 1px solid #eee;
}

.sessoes-secao:last-child {
    border-bottom: none;
}

.sessoes-secao h3 {
    padding: 15px 20px;
    margin: 0;
    background: #f9f9f9;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sessoes-secao h3 .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.sessoes-secao h3 .badge {
    background: #dc3232;
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
}

.sessoes-secao h3 .badge.badge-success {
    background: #00a32a;
}

.sessoes-container {
    max-height: 300px;
    overflow-y: auto;
}

/* Card de sessão */
.sessao-card {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

.sessao-card:hover {
    background: #f9f9f9;
}

.sessao-card.active {
    background: #e6f3ff;
    border-left: 3px solid #2271b1;
}

.sessao-card:last-child {
    border-bottom: none;
}

.sessao-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.sessao-nome {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
}

.sessao-tempo {
    font-size: 12px;
    color: #dc3232;
    font-weight: 500;
}

.sessao-preview {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sessao-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #888;
    margin-bottom: 10px;
}

.sessao-origem {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sessao-operador {
    color: #00a32a;
    font-weight: 500;
}

.sessao-actions {
    display: flex;
    gap: 8px;
}

.sessao-actions .button {
    font-size: 12px;
    padding: 4px 12px;
    height: auto;
    line-height: 1.5;
}

/* Sessão vazia */
.sessao-vazia {
    padding: 40px 20px;
    text-align: center;
    color: #888;
}

.sessao-vazia .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ccc;
    margin-bottom: 10px;
}

.sessao-vazia p {
    margin: 0;
    font-size: 13px;
}

/* Painel de chat */
.wpflow-chat-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-contact-name {
    font-weight: 600;
    font-size: 15px;
    color: #1d2327;
}

.chat-origin-url {
    font-size: 12px;
    color: #888;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-actions .button {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-header-actions .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Mensagens */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 12px;
    position: relative;
}

.chat-message.msg-client {
    align-self: flex-start;
    background: #f0f0f0;
    border-bottom-left-radius: 4px;
}

.chat-message.msg-operator {
    align-self: flex-end;
    background: #2271b1;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.msg-system {
    align-self: center;
    background: #fff3cd;
    color: #856404;
    font-size: 12px;
    padding: 8px 15px;
    border-radius: 20px;
    max-width: 90%;
    text-align: center;
}

.chat-message.msg-bot {
    align-self: flex-end;
    background: #e8f4fd;
    color: #1d2327;
    border-bottom-right-radius: 4px;
}

.message-content {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-meta {
    display: flex;
    gap: 8px;
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.7;
}

.msg-operator .message-meta {
    justify-content: flex-end;
}

/* Indicador de digitação */
.chat-typing {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.typing-indicator {
    display: flex;
    gap: 3px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Área de input */
.chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.4;
    max-height: 100px;
}

.chat-input-area textarea:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.chat-input-area .button {
    padding: 10px 15px;
    height: auto;
}

.chat-input-area .button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Placeholder */
.wpflow-chat-placeholder {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 600px;
    color: #888;
    text-align: center;
}

.wpflow-chat-placeholder .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.wpflow-chat-placeholder h3 {
    margin: 0 0 10px;
    color: #666;
}

.wpflow-chat-placeholder p {
    margin: 0;
    font-size: 14px;
}

/* ============================================
   BOTÃO DO CLIENTE (Frontend)
   ============================================ */

.wpflow-btn-atendente {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin: 10px auto;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.wpflow-btn-atendente:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.wpflow-btn-atendente:active {
    transform: translateY(0);
}

.wpflow-btn-atendente.active {
    background: linear-gradient(135deg, #f39c12 0%, #d68910 100%);
    cursor: default;
    animation: pulse-atendente 2s infinite;
}

.wpflow-btn-atendente .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

@keyframes pulse-atendente {
    0%, 100% { box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3); }
    50% { box-shadow: 0 2px 20px rgba(243, 156, 18, 0.5); }
}

/* Indicador de digitação no cliente */
.wpflow-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    margin: 5px 0;
    background: #f5f5f5;
    border-radius: 12px;
    max-width: fit-content;
}

.wpflow-typing-indicator .typing-dots {
    display: flex;
    gap: 3px;
}

.wpflow-typing-indicator .typing-dots span {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.wpflow-typing-indicator .typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.wpflow-typing-indicator .typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.wpflow-typing-indicator .typing-dots span:nth-child(3) { animation-delay: 0; }

.wpflow-typing-indicator .typing-text {
    font-size: 12px;
    color: #666;
}

/* Mensagem do operador no chat do cliente - herda estilo do bot */
/* Removido estilo diferenciado para manter igual às mensagens da IA */

.system-message {
    background: #fff3cd !important;
    text-align: center;
    font-size: 12px;
    color: #856404;
    padding: 8px 15px;
    border-radius: 20px;
    max-width: 80%;
    margin: 10px auto;
}

/* ============================================
   RESPONSIVO
   ============================================ */

@media (max-width: 1200px) {
    .wpflow-atendimento-main {
        grid-template-columns: 350px 1fr;
    }
}

@media (max-width: 992px) {
    .wpflow-atendimento-main {
        grid-template-columns: 1fr;
    }

    .wpflow-sessoes-lista {
        max-height: 400px;
        overflow-y: auto;
    }

    .wpflow-chat-panel,
    .wpflow-chat-placeholder {
        height: 500px;
    }
}

@media (max-width: 600px) {
    .wpflow-atendimento-stats {
        flex-wrap: wrap;
    }

    .stat-card {
        flex: 1;
        min-width: 80px;
        padding: 15px;
    }

    .stat-card .stat-number {
        font-size: 24px;
    }

    .chat-message {
        max-width: 90%;
    }
}
