/* ========================================
   Warm 24/7 Chat Widget
   ======================================== */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: var(--font-primary);
}

.chat-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95) 0%, rgba(139, 92, 246, 0.95) 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.chat-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px rgba(99, 102, 241, 0.6);
}

.chat-button.minimized {
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
}

.chat-button.minimized .chat-preview {
    display: none;
}

.chat-button.minimized .chat-close {
    display: none;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    position: relative;
    flex-shrink: 0;
}

.online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

.chat-preview {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-preview strong {
    font-size: 15px;
    font-weight: 700;
    color: white;
}

.chat-preview span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.chat-close {
    display: none;
    font-size: 20px;
    color: white;
    margin-left: auto;
}

.chat-button:not(.minimized) .chat-close {
    display: block;
}

.chat-window {
    display: none;
    width: 400px;
    height: 600px;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    flex-direction: column;
    position: absolute;
    bottom: 0;
    right: 0;
}

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

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

.chat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.chat-info strong {
    font-size: 15px;
    font-weight: 700;
    color: white;
}

.status-text {
    font-size: 12px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.chat-minimize {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
}

.chat-message.received {
    flex-direction: row;
}

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

.message-bubble {
    max-width: 75%;
    padding: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px 16px 16px 4px;
}

.chat-message.sent .message-bubble {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(139, 92, 246, 0.3) 100%);
    border-radius: 16px 16px 4px 16px;
}

.message-bubble p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-200);
    margin: 0 0 12px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.quick-reply {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--primary);
    transform: translateX(4px);
}

.chat-input {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: rgba(17, 24, 39, 0.8);
    border-top: 1px solid rgba(99, 102, 241, 0.3);
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-family: var(--font-primary);
    transition: all 0.3s ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.message-input::placeholder {
    color: var(--gray-500);
}

.send-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
    }
    
    .chat-button {
        padding: 12px 16px;
    }
    
    .chat-preview {
        display: none;
    }
}
