/* 
 * Chat Widget Cyrela - Standalone
 * Design baseado em aiofotoevideo.com.br
 */

:root {
    --chat-primary: #0066cc;
    --chat-secondary: #003d7a;
    --chat-accent: #00aa66;
    --chat-bg: #ffffff;
    --chat-text: #333333;
    --chat-border: #e0e0e0;
}

/* Container Principal */
#chat-widget-cyrela {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Botão de Toggle (Balão 3D) */
.chat-toggle-button {
    width: 70px;
    height: 70px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 102, 204, 0.4),
                0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle-button:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 102, 204, 0.5),
                0 6px 15px rgba(0, 0, 0, 0.15);
}

.chat-toggle-button:active {
    transform: scale(0.95);
}

/* Ícone do Balão */
.chat-toggle-button .chat-icon {
    width: 35px;
    height: 35px;
    fill: white;
    transition: transform 0.3s ease;
}

.chat-toggle-button.active .chat-icon {
    transform: rotate(180deg);
}

/* Badge de notificação */
.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Janela do Chat */
.chat-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;
    height: 600px;
    background: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2),
                0 5px 20px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: slideUp 0.3s ease;
}

.chat-window.active {
    display: flex;
}

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

/* Header do Chat */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-logo {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-logo img {
    width: 100%;
    height: auto;
}

.chat-title-wrapper h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

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

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

.chat-close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Corpo do Chat */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}

/* Mensagens */
.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 {
    flex-direction: row;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.4;
}

.chat-message.bot .message-bubble {
    background: white;
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Indicador de digitação */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chat-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Footer do Chat */
.chat-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--chat-border);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--chat-primary);
}

.chat-attach-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chat-attach-button:hover {
    color: var(--chat-primary);
}

.chat-send-button {
    width: 45px;
    height: 45px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-secondary) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chat-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

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

.chat-send-button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Mensagem de Boas-vindas */
.welcome-message {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.welcome-message h4 {
    margin: 0 0 10px 0;
    color: var(--chat-primary);
    font-size: 16px;
}

.welcome-message p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-button {
    background: white;
    border: 2px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply-button:hover {
    background: var(--chat-primary);
    color: white;
}

/* Responsivo */
@media (max-width: 480px) {
    .chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    #chat-widget-cyrela {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-toggle-button {
        width: 60px;
        height: 60px;
    }
}

/* Animação de entrada do chat */
.chat-appear {
    animation: appear 0.5s ease;
}

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