/**
 * Solar Bear Energy Ph - Chatbot Styles
 * Floating chat widget with agentic lead capture
 */

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

/* Chat Trigger Button */
.chat-trigger {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF9800 0%, #FFC107 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4), 0 8px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-trigger:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 30px rgba(255, 152, 0, 0.5), 0 12px 40px rgba(0, 0, 0, 0.2);
}

.chat-icon {
    font-size: 32px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Pulse animation for the sun icon */
@keyframes sunPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chat-trigger:hover .chat-icon {
    animation: sunPulse 1s ease infinite;
}

/* Tooltip */
.chat-tooltip {
    position: absolute;
    right: 80px;
    background: #1a1a2e;
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-tooltip::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #1a1a2e;
}

.chat-trigger:hover .chat-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* Notification Badge */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    animation: badgePulse 2s ease infinite;
}

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

/* Chat Container */
.chat-container {
    position: absolute;
    bottom: 84px;
    right: 0;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15), 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #FF9800 0%, #FFC107 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.chat-name {
    display: block;
    font-weight: 600;
    font-size: 16px;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: statusBlink 2s ease infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

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

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}

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

.chat-message.bot {
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
    gap: 0;
}

.chat-message.bot .message-avatar {
    display: none;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 85%;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: #2196F3;
}

.message-content {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-message.bot .message-content {
    background: transparent;
    color: #1a1a2e;
    border-radius: 0;
    box-shadow: none;
    padding: 8px 0;
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.7;
    white-space: normal;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Quick Reply Buttons */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    animation: fadeIn 0.3s ease;
}

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

.quick-reply-btn {
    background: white;
    border: 2px solid #FF9800;
    color: #FF9800;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.1);
}

.quick-reply-btn:hover {
    background: #FF9800;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

/* Typing Indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 24px;
    background: white;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: typingBounce 1.4s ease infinite;
}

.chat-typing span:nth-child(1) { animation-delay: 0s; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Chat Input Area */
.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chat-input-area input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 28px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input-area input:focus {
    border-color: #FF9800;
    box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.1);
}

.chat-input-area button {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, #FF9800 0%, #FFC107 100%);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.chat-input-area button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

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

/* Responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-container {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 0;
        border-radius: 20px;
    }
    
    .chat-tooltip {
        display: none;
    }
}

/* Results Display in Chat */
.chat-message .results-preview {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 16px;
    padding: 16px;
    margin-top: 12px;
}

.chat-message .results-preview h4 {
    margin: 0 0 12px 0;
    color: #92400e;
    font-size: 14px;
}

.chat-message .results-preview .result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #fde68a;
}

.chat-message .results-preview .result-item:last-child {
    border-bottom: none;
}

.chat-message .results-preview .result-label {
    color: #78350f;
    font-size: 13px;
}

.chat-message .results-preview .result-value {
    color: #92400e;
    font-weight: 600;
    font-size: 13px;
}