/* ============================================
   CHAT HELP WIDGET
   ============================================
   Floating chat bubble with help options
*/

/* Widget Container */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Main Chat Button */
.chat-widget-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0369A1 0%, #0EA5E9 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(3, 105, 161, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(3, 105, 161, 0.5);
}

.chat-widget-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}

.chat-widget.open .chat-widget-btn svg {
    transform: rotate(45deg);
}

/* Notification Badge */
.chat-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #EA580C;
    border-radius: 50%;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Popup Panel */
.chat-widget-popup {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
}

.chat-widget.open .chat-widget-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Popup Header */
.chat-widget-header {
    background: linear-gradient(135deg, #0369A1 0%, #0EA5E9 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.chat-widget-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-widget-header p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.chat-widget-avatar {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* Popup Body */
.chat-widget-body {
    padding: 20px;
}

.chat-widget-message {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.5;
    position: relative;
}

.chat-widget-message::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #f1f5f9;
}

/* Action Buttons */
.chat-widget-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-widget-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #334155;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.chat-widget-action:hover {
    border-color: #0369A1;
    background: #f8fafc;
    transform: translateX(5px);
}

.chat-widget-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-widget-action-icon svg {
    width: 22px;
    height: 22px;
}

.chat-widget-action.whatsapp .chat-widget-action-icon {
    background: #25D366;
}
.chat-widget-action.whatsapp .chat-widget-action-icon svg {
    fill: white;
}
.chat-widget-action.whatsapp:hover {
    border-color: #25D366;
    background: rgba(37, 211, 102, 0.1);
}

.chat-widget-action.phone .chat-widget-action-icon {
    background: #0369A1;
}
.chat-widget-action.phone .chat-widget-action-icon svg {
    fill: white;
}
.chat-widget-action.phone:hover {
    border-color: #0369A1;
    background: rgba(3, 105, 161, 0.1);
}

.chat-widget-action.form .chat-widget-action-icon {
    background: #EA580C;
}
.chat-widget-action.form .chat-widget-action-icon svg {
    fill: white;
}
.chat-widget-action.form:hover {
    border-color: #EA580C;
    background: rgba(234, 88, 12, 0.1);
}

.chat-widget-action-text {
    flex: 1;
}

.chat-widget-action-title {
    display: block;
    font-weight: 600;
    color: #1e293b;
}

.chat-widget-action-subtitle {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 400;
}

/* Footer */
.chat-widget-footer {
    padding: 15px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* Proactive Message Bubble */
.chat-widget-prompt {
    position: absolute;
    bottom: 75px;
    right: 10px;
    background: white;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 280px;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.5;
    white-space: normal;
    word-wrap: break-word;
}

.chat-widget-prompt.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-widget-prompt::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 25px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.chat-widget-prompt-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #64748b;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-widget-prompt-close:hover {
    background: #475569;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-widget-popup {
        width: calc(100vw - 30px);
        right: 0;
        bottom: 70px;
    }
    
    .chat-widget-btn {
        width: 55px;
        height: 55px;
    }
}

/* Hide when floating buttons visible (mobile) */
@media (max-width: 1023px) {
    .chat-widget {
        bottom: 80px; /* Above floating call buttons */
    }
}

/* Animation for attention */
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.chat-widget-btn.attention {
    animation: wiggle 0.5s ease-in-out;
}
