/* Live Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Chat Toggle Button */
.chat-toggle {
    position: relative;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #137fec 0%, #0ea5e9 50%, #0d5cb3 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(19, 127, 236, 0.35);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 3px solid rgba(255, 255, 255, 0.9);
    color: white;
    backdrop-filter: blur(10px);
}

.chat-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 40px rgba(19, 127, 236, 0.5);
    border-color: rgba(255, 255, 255, 1);
}

.chat-toggle:active {
    transform: scale(1.02);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
}

.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

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

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    z-index: 9999;
}

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

/* Limit "hidden" utility to the chat widget only to avoid clobbering site styles */
.chat-widget .hidden {
    display: none !important;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #137fec 0%, #0ea5e9 50%, #0d5cb3 100%);
    color: white;
    padding: 20px 20px 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.agent-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.agent-avatar svg {
    width: 24px;
    height: 24px;
}

.agent-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.2px;
    margin-bottom: 2px;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.95;
    font-weight: 500;
}

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

.minimize-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.minimize-btn svg {
    width: 20px;
    height: 20px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.user-message {
    align-self: flex-end;
}

.support-message {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user-message .message-content {
    background: linear-gradient(135deg, #137fec 0%, #0ea5e9 100%);
    color: white;
    border-bottom-right-radius: 6px;
    font-weight: 500;
}

.support-message .message-content {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    color: #1f2937;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px;
    font-weight: 400;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 8px;
}

.user-message .message-time {
    text-align: right;
}

.support-message .message-time {
    text-align: left;
}

/* Typing Indicator */
.typing-indicator {
    padding: 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots .dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.5s infinite ease-in-out;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border-top: 1px solid #e2e8f0;
    backdrop-filter: blur(10px);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

#chat-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    font-weight: 500;
    color: #1f2937;
}

#chat-input:focus {
    border-color: #137fec;
    background: white;
    box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.1);
    transform: translateY(-1px);
}

#chat-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.send-btn {
    background: linear-gradient(135deg, #137fec 0%, #0ea5e9 100%);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: white;
    box-shadow: 0 4px 12px rgba(19, 127, 236, 0.3);
}

.send-btn:hover {
    background: linear-gradient(135deg, #0d5cb3 0%, #0369a1 100%);
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 6px 20px rgba(19, 127, 236, 0.4);
}

.send-btn:active {
    transform: scale(1.02);
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

/* Quick Options */
.chat-options {
    padding: 12px 20px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-option {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #475569;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quick-option:hover {
    background: linear-gradient(135deg, #137fec 0%, #0ea5e9 100%);
    color: white;
    border-color: #137fec;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(19, 127, 236, 0.25);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
        z-index: 9999 !important;
        pointer-events: auto !important;
    }
    
    .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        left: auto;
        bottom: 82px;
        height: 480px;
        max-height: calc(100vh - 120px);
        border-radius: 16px;
    }
    
    .chat-toggle {
        width: 58px;
        height: 58px;
        pointer-events: auto !important;
        -webkit-tap-highlight-color: transparent;
    }
    
    .chat-toggle svg {
        width: 26px;
        height: 26px;
    }
    
    .chat-header {
        padding: 16px 18px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input-wrapper {
        padding: 14px 18px;
    }
    
    .quick-option {
        font-size: 11px;
        padding: 6px 12px;
    }
}

@media (max-width: 380px) {
    .chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        height: 460px;
        max-height: calc(100vh - 100px);
    }
    
    .chat-toggle {
        width: 54px;
        height: 54px;
    }
    
    .chat-widget {
        right: 12px;
        bottom: 12px;
    }
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Accessibility */
.chat-toggle:focus,
.send-btn:focus,
.minimize-btn:focus,
.quick-option:focus {
    outline: 2px solid #137fec;
    outline-offset: 2px;
}

/* Animation for messages */
.message {
    animation: messageSlideIn 0.3s ease-out;
}

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