/* ============================================
   EVACLEN - Chat Widget (Site Público)
   Arquivo: chat-widget.css
   ============================================ */

/* Botão Flutuante */
.ec-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}
.ec-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(79, 70, 229, 0.5);
}
.ec-chat-bubble:active {
    transform: scale(0.95);
}
.ec-chat-bubble .ec-icon-chat,
.ec-chat-bubble .ec-icon-close {
    font-size: 24px;
    transition: transform 0.3s, opacity 0.3s;
    position: absolute;
}
.ec-chat-bubble .ec-icon-close {
    opacity: 0;
    transform: rotate(-90deg);
}
.ec-chat-bubble.ec-open .ec-icon-chat {
    opacity: 0;
    transform: rotate(90deg);
}
.ec-chat-bubble.ec-open .ec-icon-close {
    opacity: 1;
    transform: rotate(0);
}

/* Badge de notificação */
.ec-chat-bubble .ec-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
    animation: ec-badge-pop 0.3s ease;
}

/* Tooltip */
.ec-chat-tooltip {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 9989;
    background: white;
    color: #1e293b;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    white-space: nowrap;
    animation: ec-slide-up 0.4s ease;
    cursor: pointer;
}
.ec-chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.05);
}
.ec-chat-tooltip .ec-tooltip-close {
    display: inline-block;
    margin-left: 8px;
    opacity: 0.4;
    cursor: pointer;
    font-size: 12px;
}

/* Janela do Chat */
.ec-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 9991;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.ec-chat-window.ec-visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Mobile fullscreen */
@media (max-width: 768px) {
    .ec-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .ec-chat-bubble.ec-open {
        display: none;
    }
}

/* Header */
.ec-chat-header {
    background: linear-gradient(135deg, #4f46e5, #6d28d9);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.ec-chat-header-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.ec-chat-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.ec-chat-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.8;
}
.ec-chat-header-close {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
.ec-chat-header-close:hover {
    background: rgba(255,255,255,0.25);
}
@media (max-width: 768px) {
    .ec-chat-header-close { display: flex; }
}

/* Tela de Boas-Vindas (Formulário) */
.ec-welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ec-welcome-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    gap: 16px;
    display: flex;
    flex-direction: column;
}
.ec-welcome-footer {
    flex-shrink: 0;
    padding: 12px 20px 20px;
    background: white;
    border-top: 1px solid #f1f5f9;
}
.ec-welcome-screen h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}
.ec-welcome-screen p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}
.ec-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ec-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}
.ec-form-group input,
.ec-form-group textarea {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    resize: none;
}
.ec-form-group input:focus,
.ec-form-group textarea:focus {
    border-color: #4f46e5;
}
.ec-quick-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ec-quick-topic {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.2s;
}
.ec-quick-topic:hover {
    background: #eef2ff;
    border-color: #a5b4fc;
    color: #4f46e5;
}
.ec-btn-iniciar {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.ec-btn-iniciar:hover {
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}
.ec-btn-iniciar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tela de Chat */
.ec-chat-screen {
    flex: 1;
    display: none;
    flex-direction: column;
}

/* Status Bar */
.ec-status-bar {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    flex-shrink: 0;
}
.ec-status-fila {
    background: #fef3c7;
    color: #92400e;
}
.ec-status-atendimento {
    background: #d1fae5;
    color: #065f46;
}
.ec-status-finalizada {
    background: #f1f5f9;
    color: #64748b;
}

/* Mensagens */
.ec-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}
.ec-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: ec-msg-in 0.2s ease;
}
.ec-msg-enviada {
    align-self: flex-end;
    background: linear-gradient(135deg, #4f46e5, #6d28d9);
    color: white;
    border-bottom-right-radius: 4px;
}
.ec-msg-recebida {
    align-self: flex-start;
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ec-msg-sistema {
    align-self: center;
    background: #fef9c3;
    color: #854d0e;
    border-radius: 10px;
    font-size: 12px;
    padding: 6px 12px;
    max-width: 90%;
    text-align: center;
}
.ec-msg-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
}
.ec-msg-atendente-name {
    font-size: 11px;
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 2px;
}

/* Input Area */
.ec-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: white;
}
.ec-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.2s;
}
.ec-input-area textarea:focus {
    border-color: #4f46e5;
}
.ec-btn-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.2s;
}
.ec-btn-send:hover {
    transform: scale(1.05);
}
.ec-btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Avaliação */
.ec-eval-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    flex: 1;
    gap: 16px;
}
.ec-eval-screen h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}
.ec-eval-screen p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}
.ec-stars {
    display: flex;
    gap: 8px;
}
.ec-star {
    font-size: 32px;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}
.ec-star:hover,
.ec-star.ec-active {
    color: #f59e0b;
    transform: scale(1.15);
}
.ec-btn-eval {
    padding: 12px 32px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.ec-btn-eval:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.ec-btn-skip {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

/* Typing indicator */
.ec-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ec-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: ec-typing-dot 1.4s infinite;
}
.ec-typing span:nth-child(2) { animation-delay: 0.2s; }
.ec-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Animations */
@keyframes ec-slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ec-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ec-badge-pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
@keyframes ec-typing-dot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Hidden utility */
.ec-hidden { display: none !important; }
