/* ========================================
   Foto Rede Chat Widget - Assistente IA
   Dark Theme
   ======================================== */

/* FAB Buttons Container */
.chat-fabs {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 900;
}

/* Chat FAB */
.chat-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #8b5cf6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
}

.chat-fab svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* Badge notification */
.chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ec4899;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-fab-badge.visible {
    display: flex;
}

/* FAB pulse animation */
@keyframes chatPulse {
    0% { box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35); }
    50% { box-shadow: 0 4px 24px rgba(139, 92, 246, 0.55); }
    100% { box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35); }
}

.chat-fab.pulse {
    animation: chatPulse 1.5s ease infinite;
}

/* WhatsApp FAB */
.whatsapp-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #25D366;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.whatsapp-fab svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

/* ========================================
   Chat Window
   ======================================== */

.chat-window {
    position: fixed;
    bottom: 148px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #1a1f2e;
    border: 1px solid #2d3748;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 901;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ========================================
   Chat Header
   ======================================== */

.chat-header {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-avatar-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-name {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

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

.chat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ADE80;
    flex-shrink: 0;
}

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

.chat-header-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-header-btn svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    fill: none;
}

/* ========================================
   Chat Messages
   ======================================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0f1419;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #2d3748;
    border-radius: 2px;
}

/* Message row */
.chat-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: chatMsgIn 0.25s ease;
}

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

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg.assistant {
    align-self: flex-start;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg.assistant .chat-msg-bubble {
    background: #252a3a;
    color: #f8fafc;
    border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-msg-bubble {
    background: #8b5cf6;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}

.chat-msg.user .chat-msg-time {
    text-align: right;
}

/* ========================================
   Quick Replies
   ======================================== */

.chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    background: #0f1419;
}

.chat-quick-btn {
    padding: 8px 14px;
    border: 1.5px solid #8b5cf6;
    border-radius: 20px;
    background: transparent;
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.chat-quick-btn:hover {
    background: #8b5cf6;
    color: #fff;
}

/* ========================================
   Typing Indicator
   ======================================== */

.chat-typing {
    display: none;
    align-self: flex-start;
    gap: 8px;
    max-width: 85%;
    padding: 0 16px 4px;
    background: #0f1419;
}

.chat-typing.visible {
    display: flex;
}

.chat-typing-bubble {
    background: #252a3a;
    padding: 12px 18px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    animation: chatTypingBounce 1.2s ease infinite;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatTypingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.chat-typing-text {
    font-size: 12px;
    color: #64748b;
    margin-left: 4px;
}

/* ========================================
   Chat Input
   ======================================== */

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #2d3748;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: #1a1f2e;
}

.chat-input {
    flex: 1;
    border: 1.5px solid #2d3748;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
    transition: border-color 0.15s;
    background: #0f1419;
    color: #f8fafc;
}

.chat-input:focus {
    border-color: #8b5cf6;
}

.chat-input::placeholder {
    color: #64748b;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
}

.chat-send-btn:hover {
    background: #7c3aed;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* ========================================
   Mobile Fullscreen
   ======================================== */

@media (max-width: 767px) {
    .chat-fabs {
        bottom: 16px;
        right: 16px;
    }

    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        transform: translateY(100%);
        opacity: 1;
        visibility: hidden;
    }

    .chat-window.open {
        transform: translateY(0);
        visibility: visible;
    }

    .chat-header {
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
    }

    .chat-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Desktop adjustments */
@media (min-width: 768px) {
    .chat-fabs {
        bottom: 32px;
        right: 32px;
    }

    .chat-window {
        bottom: 156px;
        right: 32px;
    }
}
