/* Support Chat Widget Styles */

.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(6, 182, 212, 0.5);
}

.chat-toggle-btn i {
    font-size: 24px;
    color: white;
    transition: transform 0.3s ease;
}

.chat-toggle-btn.open i {
    transform: rotate(180deg);
}

.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
}

.chat-unread-badge.show {
    display: block;
    animation: pulse 2s infinite;
}

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

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: #1e293b;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.chat-header-status {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.chat-header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.chat-header-status .status-dot.offline {
    background: #f59e0b;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.ai,
.chat-message.human_support {
    align-self: flex-start;
    background: #334155;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
}

.chat-message.human_support {
    border-left: 3px solid #8b5cf6;
}

.chat-message .message-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-message.ai .message-meta,
.chat-message.human_support .message-meta {
    color: #64748b;
}

.chat-message .ai-badge {
    background: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    background: #334155;
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    gap: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Escalation Banner */
.escalation-banner {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    padding: 12px 16px;
    text-align: center;
    display: none;
}

.escalation-banner.show {
    display: block;
}

.escalation-banner p {
    color: white;
    font-size: 13px;
    margin: 0 0 10px;
}

.escalation-btn {
    background: white;
    color: #7c3aed;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.escalation-btn:hover {
    transform: scale(1.05);
}

/* Chat Input */
.chat-input-area {
    padding: 16px;
    background: #0f172a;
    border-top: 1px solid rgba(6, 182, 212, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px 16px;
    color: #f1f5f9;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #06b6d4;
}

.chat-input::placeholder {
    color: #64748b;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Welcome Screen */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.chat-welcome h3 {
    color: #f1f5f9;
    font-size: 18px;
    margin: 0 0 10px;
}

.chat-welcome p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.5;
}

.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.chat-quick-btn {
    background: #334155;
    border: 1px solid #475569;
    color: #f1f5f9;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-quick-btn:hover {
    background: #475569;
    border-color: #06b6d4;
}

/* Email Collection */
.email-collection {
    padding: 16px;
    background: #0f172a;
    border-top: 1px solid rgba(6, 182, 212, 0.1);
    display: none;
}

.email-collection.show {
    display: block;
}

.email-collection p {
    color: #94a3b8;
    font-size: 13px;
    margin: 0 0 10px;
}

.email-collection input {
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 14px;
    color: #f1f5f9;
    font-size: 14px;
    margin-bottom: 10px;
}

.email-collection input:focus {
    outline: none;
    border-color: #06b6d4;
}

.email-collection button {
    width: 100%;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-widget-container {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-toggle-btn {
        width: 56px;
        height: 56px;
    }
}
