/* ==========================================================================
   CSS DO WIDGET DA SOFIA: CHAT DE TRIAGEM ATIVA (SEM PLUGINS PAGOS)
   ========================================================================== */

:root {
    --bg-base: #08080C;
    --bg-surface: #111116;
    --bg-surface-hover: #16161D;
    
    --brand-primary: #3B82F6; /* Azul Elétrico */
    --brand-primary-glow: rgba(59, 130, 246, 0.15);
    --brand-success: #10B981; /* Verde Conversão */
    --brand-success-glow: rgba(16, 185, 129, 0.2);
    
    --text-main: #F4F4F7;
    --text-muted: #94A3B8;
    
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sofia-chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1d4ed8 100%);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sofia-chat-bubble:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.6);
}

.sofia-chat-bubble svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

.sofia-chat-bubble .notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--brand-success);
    border: 2px solid var(--bg-base);
    animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sofia-chat-container {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    height: 520px;
    border-radius: 20px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-body);
}

.sofia-chat-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.sofia-chat-header {
    background: linear-gradient(135deg, #13131a 0%, #0d0d12 100%);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sofia-avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sofia-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #ffffff;
    font-size: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px var(--brand-primary-glow);
}

.sofia-status-info h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    padding: 0;
    color: var(--text-main);
}

.sofia-status {
    font-size: 0.75rem;
    color: var(--brand-success);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.sofia-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--brand-success);
}

.sofia-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sofia-close-btn:hover {
    color: var(--text-main);
}

.sofia-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

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

.sofia-chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.sofia-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-sizing: border-box;
}

.sofia-message.bot {
    align-self: flex-start;
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
}

.sofia-message.bot a {
    color: var(--brand-primary);
    text-decoration: underline;
    font-weight: 600;
}

.sofia-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1d4ed8 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.sofia-chat-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background-color: #0b0b0f;
}

.sofia-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
    transition: var(--transition-smooth);
}

.sofia-chat-options.hidden {
    display: none;
}

.sofia-option-btn {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-body);
}

.sofia-option-btn:hover {
    border-color: var(--brand-primary);
    background-color: var(--brand-primary-glow);
    color: #ffffff;
}

.sofia-chat-input-wrapper {
    display: none;
    align-items: center;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 4px 6px 4px 16px;
    transition: var(--transition-smooth);
}

.sofia-chat-input-wrapper.active {
    display: flex;
}

.sofia-chat-input-wrapper:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.sofia-chat-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    height: 38px;
    outline: none;
    font-family: var(--font-body);
}

.sofia-chat-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.sofia-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sofia-send-btn:hover {
    background-color: #2563EB;
}

.sofia-send-btn svg {
    width: 16px;
    height: 16px;
    fill: #ffffff;
}

.sofia-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
}

.sofia-typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    animation: typing-dot 1.4s infinite ease-in-out;
}

.sofia-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.sofia-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 480px) {
    .sofia-chat-container {
        width: calc(100% - 32px);
        height: 480px;
        right: 16px;
        bottom: 85px;
    }
    .sofia-chat-bubble {
        bottom: 16px;
        right: 16px;
    }
}
