/* Kafra Assistant Styles */
.kafra-assistant {
    position: fixed;
    bottom: 70px;
    left: 10px;
    z-index: 1000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.kafra-chat {
    position: fixed;
    bottom: 120px;
    left: 90px;
    transform: scale(0.8);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    width: 320px;
    max-height: 500px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1001;
}

.kafra-chat.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Efeito do avatar igual ao botão WhatsApp: pulse, glow, ripple, hover */
.kafra-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #4CAF50;
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.5), 0 0 20px rgba(76, 175, 80, 0.35);
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: visible;
    animation: kafra-avatar-pulse 2s ease-in-out infinite;
}

@keyframes kafra-avatar-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(76, 175, 80, 0.5), 0 0 20px rgba(76, 175, 80, 0.35);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 12px 30px rgba(76, 175, 80, 0.7), 0 0 30px rgba(76, 175, 80, 0.5), 0 0 40px rgba(251, 191, 36, 0.25);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(76, 175, 80, 0.5), 0 0 20px rgba(76, 175, 80, 0.35);
    }
}

.kafra-avatar::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #4CAF50, #66BB6A, #4CAF50);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    animation: kafra-glow 3s ease-in-out infinite;
}

@keyframes kafra-glow {
    0%, 100% { opacity: 0; transform: scale(0.9); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.kafra-avatar:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 15px 35px rgba(76, 175, 80, 0.7), 0 0 40px rgba(76, 175, 80, 0.5), 0 0 50px rgba(251, 191, 36, 0.35);
    border-color: #81C784;
}

.kafra-avatar:hover .kafra-avatar-img {
    transform: scale(1.08);
}

.kafra-ripple {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.4);
    opacity: 0;
    animation: kafra-ripple 2.5s ease-out infinite;
    pointer-events: none;
}

.kafra-ripple:nth-child(2) {
    animation-delay: 0.5s;
}

@keyframes kafra-ripple {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(2.5); opacity: 0; }
}

.kafra-avatar-img {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    object-position: center;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    padding: 6px;
    box-sizing: border-box;
    display: block;
    backface-visibility: hidden;
}

.kafra-avatar:hover .kafra-avatar-img {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.kafra-welcome {
    padding: 20px;
    display: block;
}

.kafra-welcome-header {
    text-align: center;
    margin-bottom: 15px;
}

.kafra-welcome-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.kafra-welcome-content {
    text-align: center;
    margin-bottom: 20px;
}

.kafra-welcome-message {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.kafra-welcome-submessage {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.kafra-welcome-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.kafra-welcome-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.kafra-welcome-yes {
    background: #2196F3;
    color: white;
    flex: 1;
}

.kafra-welcome-yes:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

.kafra-welcome-no {
    background: #f5f5f5;
    color: #666;
    flex: 1;
}

.kafra-welcome-no:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.kafra-welcome-hide {
    background: none;
    border: none;
    color: #2196F3;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
}

.kafra-welcome-hide:hover {
    color: #1976D2;
}

.kafra-main-content {
    display: none;
}

.kafra-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}


.kafra-title {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: bold;
}

.kafra-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.kafra-buttons {
    padding: 20px;
    display: grid;
    gap: 18px;
}

.kafra-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: left;
}

.kafra-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.kafra-btn-green {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.kafra-btn-blue {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.kafra-btn-red {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.kafra-btn-gold {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #333;
}

.kafra-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.kafra-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.kafra-back-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.kafra-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kafra-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    margin-bottom: 8px;
}

.kafra-link:hover {
    background: #e3f2fd;
    border-left-color: #2196F3;
    transform: translateX(5px);
    color: #1976D2;
}

.kafra-link-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 6px;
    color: #2196F3;
    font-size: 14px;
}

.kafra-link-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kafra-link-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.kafra-link-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

.kafra-link-arrow {
    font-size: 12px;
    opacity: 0.6;
    color: #999;
}



/* Animações de entrada */
.kafra-link {
    opacity: 0;
    transform: translateY(20px);
}

.kafra-link.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsividade */
@media (max-width: 768px) {
    .kafra-assistant {
        bottom: 8px;
        left: 8px;
    }
    
    .kafra-chat {
        bottom: 45px;
        left: 10px;
        width: 280px;
        max-height: 400px;
    }
    
    .kafra-avatar {
        width: 60px;
        height: 60px;
    }
    
    .kafra-welcome-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .kafra-welcome-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .kafra-assistant {
        bottom: 5px;
        left: 5px;
    }
    
    .kafra-chat {
        bottom: 40px;
        left: 5px;
        width: calc(100vw - 20px);
        max-width: 300px;
    }
    
    .kafra-welcome {
        padding: 15px;
    }
    
    .kafra-welcome-title {
        font-size: 16px;
    }
    
    .kafra-welcome-message {
        font-size: 14px;
    }
    
    .kafra-welcome-submessage {
        font-size: 12px;
    }
}

/* Scrollbar personalizada */
.kafra-content::-webkit-scrollbar {
    width: 6px;
}

.kafra-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.kafra-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.kafra-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Estados de foco para acessibilidade */
.kafra-avatar:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

.kafra-btn:focus,
.kafra-welcome-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Indicador de carregamento */
.kafra-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #666;
}

.kafra-loading.show {
    display: block;
}

.kafra-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: kafra-spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes kafra-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificação de novo conteúdo */
.kafra-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: kafra-notification-pulse 2s infinite;
}

@keyframes kafra-notification-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tema escuro */
[data-theme="dark"] .kafra-chat {
    background: #2d3748;
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-link {
    background: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-link:hover {
    background: #2d3748;
    color: #63b3ed;
}

[data-theme="dark"] .kafra-link-icon {
    background: rgba(99, 179, 237, 0.1);
    color: #63b3ed;
}

[data-theme="dark"] .kafra-link-title {
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-link-desc {
    color: #a0aec0;
}

[data-theme="dark"] .kafra-back-btn {
    background: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-back-btn:hover {
    background: #2d3748;
    color: #63b3ed;
}

[data-theme="dark"] .kafra-welcome-title {
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-welcome-message {
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-welcome-submessage {
    color: #a0aec0;
}

[data-theme="dark"] .kafra-welcome-no {
    background: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] .kafra-welcome-no:hover {
    background: #2d3748;
}
