/* ===== CHAT WIDGET STYLES ===== */

:root {
    --chat-primary: #172B41;
    --chat-accent: #C9A961;
    --chat-whatsapp: #25D366;
    --chat-bg: #F8F8F8;
    --chat-white: #FFFFFF;
    --chat-text: #333333;
    --chat-muted: #666666;
}

/* Botão Flutuante */
.chat-widget-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--chat-whatsapp) 0%, #1fbb4d 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    z-index: 9998;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: pulse-chat 2.5s infinite;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

.chat-widget-button.hidden {
    display: none;
}

@keyframes pulse-chat {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Container do Widget */
.chat-widget-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s ease;
    opacity: 0;
    transform: translateY(20px);
}

.chat-widget-container.open {
    opacity: 1;
    transform: translateY(0);
}

.chat-widget-container.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header do Widget */
.chat-widget-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, #1a3a52 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

.chat-widget-header .status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-widget-close:hover {
    transform: rotate(90deg);
}

/* Área de Mensagens */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
    justify-content: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-message-avatar.user {
    background: var(--chat-accent);
}

.chat-message-content {
    max-width: 70%;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-message.bot .chat-message-content {
    background: white;
    color: var(--chat-text);
    border: 1px solid #e0e0e0;
}

.chat-message.user .chat-message-content {
    background: var(--chat-whatsapp);
    color: white;
}

.chat-message-typing {
    display: flex;
    gap: 4px;
    padding: 12px 15px;
}

.chat-message-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chat-message-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-message-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-10px); }
}

/* Área de Input */
.chat-widget-input-area {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background: white;
    display: flex;
    gap: 10px;
}

.chat-widget-input {
    flex: 1;
    padding: 12px 15px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s;
    resize: none;
    max-height: 80px;
}

.chat-widget-input:focus {
    outline: none;
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

.chat-widget-send {
    background: var(--chat-whatsapp);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.3s, transform 0.2s;
}

.chat-widget-send:hover {
    background: #1fbb4d;
    transform: scale(1.05);
}

.chat-widget-send:active {
    transform: scale(0.95);
}

/* Blocos de Fluxo */
.chat-flow-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-flow-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chat-text);
}

.chat-flow-input {
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.chat-flow-input:focus {
    outline: none;
    border-color: var(--chat-accent);
}

.chat-flow-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-flow-button {
    padding: 12px 15px;
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.3s, transform 0.2s;
    text-align: left;
}

.chat-flow-button:hover {
    background: var(--chat-accent);
    transform: translateX(5px);
}

.chat-flow-button.primary {
    background: var(--chat-whatsapp);
}

.chat-flow-button.primary:hover {
    background: #1fbb4d;
}

/* Convite Automático */
.chat-invite {
    position: fixed;
    bottom: 120px;
    right: 30px;
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    max-width: 320px;
    animation: slideUp 0.4s ease;
    display: none;
}

.chat-invite.show {
    display: block;
}

.chat-invite-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
}

.chat-invite-title {
    font-weight: 700;
    color: var(--chat-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.chat-invite-text {
    font-size: 0.85rem;
    color: var(--chat-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.chat-invite-button {
    width: 100%;
    padding: 10px;
    background: var(--chat-whatsapp);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.chat-invite-button:hover {
    background: #1fbb4d;
}

/* Responsivo */
@media (max-width: 480px) {
    .chat-widget-container {
        width: calc(100vw - 40px);
        max-height: 70vh;
        bottom: 100px;
        right: 20px;
    }

    .chat-widget-button {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .chat-invite {
        bottom: 100px;
        right: 20px;
        max-width: calc(100vw - 40px);
    }

    .chat-message-content {
        max-width: 85%;
    }

    .chat-widget-input-area {
        padding: 12px;
    }

    .chat-widget-input {
        font-size: 16px; /* Evita zoom no iOS */
    }
}

/* Scrollbar customizada */
.chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}
