.live-chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.live-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb));
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.live-chat-bubble:hover { transform: scale(1.08); }
.live-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}
.live-chat-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.35);
    animation: liveChatPulse 2s infinite;
}
@keyframes liveChatPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.live-chat-window {
    position: absolute;
    bottom: 76px;
    left: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.live-chat-header {
    background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb));
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    flex-shrink: 0;
}
.live-chat-header-left { display: flex; align-items: center; gap: 10px; }
.live-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}
.live-chat-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid #fff;
    position: absolute;
    bottom: -1px;
    right: -1px;
}
.live-chat-header-info h3 { margin: 0; font-size: 15px; font-weight: 600; }
.live-chat-header-info small { opacity: 0.85; font-size: 11.5px; }
.live-chat-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
.live-chat-close-btn:hover { background: rgba(255,255,255,0.3); }

.live-chat-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8fafc;
}
.live-chat-form-content { text-align: center; max-width: 280px; width: 100%; }
.live-chat-form-icon { font-size: 56px; color: var(--blue-bright, #2563eb); margin-bottom: 12px; display: block; }
.live-chat-form-content h4 { margin: 0 0 6px; font-size: 20px; color: #1a1a1a; }
.live-chat-form-content p { margin: 0 0 18px; color: #666; font-size: 13.5px; }
.live-chat-form-content input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}
.live-chat-form-content input:focus { outline: none; border-color: var(--blue-bright, #2563eb); }
.live-chat-btn-primary {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb));
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.live-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.live-chat-message { display: flex; gap: 8px; max-width: 82%; }
.live-chat-message.customer { align-self: flex-end; flex-direction: row-reverse; }
.live-chat-message.admin, .live-chat-message.system { align-self: flex-start; }
.live-chat-message-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    font-size: 13.5px;
    word-break: break-word;
}
.live-chat-message.customer .live-chat-message-bubble {
    background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb));
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}
.live-chat-message.admin .live-chat-message-bubble { border-radius: 14px 14px 14px 4px; }
.live-chat-message.system .live-chat-message-bubble { background: #fef3c7; color: #92400e; border-radius: 14px 14px 14px 4px; }
.live-chat-message-time { font-size: 10.5px; color: #9ca3af; margin-top: 2px; }
.live-chat-message-image { max-width: 180px; border-radius: 10px; cursor: pointer; margin-top: 4px; }

.live-chat-typing { padding: 6px 16px; background: #f8fafc; flex-shrink: 0; }
.live-chat-typing-dots { display: inline-flex; gap: 3px; padding: 8px 12px; background: #fff; border-radius: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.live-chat-typing-dots span { width: 6px; height: 6px; background: #9ca3af; border-radius: 50%; animation: liveChatTypingDot 1.4s infinite; }
.live-chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.live-chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes liveChatTypingDot { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

.live-chat-voice-recording {
    padding: 12px 14px;
    background: #fef2f2;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.live-chat-voice-wave { display: flex; gap: 2px; align-items: center; flex: 1; height: 28px; }
.live-chat-voice-wave span {
    width: 3px;
    background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb));
    border-radius: 2px;
    animation: liveChatVoiceWave 1.1s ease-in-out infinite;
}
.live-chat-voice-wave span:nth-child(1) { height: 14px; animation-delay: 0s; }
.live-chat-voice-wave span:nth-child(2) { height: 22px; animation-delay: .1s; }
.live-chat-voice-wave span:nth-child(3) { height: 28px; animation-delay: .2s; }
.live-chat-voice-wave span:nth-child(4) { height: 22px; animation-delay: .3s; }
.live-chat-voice-wave span:nth-child(5) { height: 14px; animation-delay: .4s; }
@keyframes liveChatVoiceWave { 0%, 100% { height: 14px; } 50% { height: 28px; } }
.live-chat-voice-timer { font-size: 14px; font-weight: 600; color: #dc2626; min-width: 44px; text-align: center; }
.live-chat-voice-cancel, .live-chat-voice-send {
    padding: 7px 12px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12.5px;
    flex-shrink: 0;
}
.live-chat-voice-cancel { background: #f3f4f6; color: #6b7280; }
.live-chat-voice-send { background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb)); color: #fff; }
.live-chat-mic-btn.is-recording { background: #ef4444; color: #fff; animation: liveChatMicPulse 1.2s infinite; }
@keyframes liveChatMicPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }
.live-chat-voice-player { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.live-chat-voice-play-btn {
    width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: rgba(255,255,255,0.9); color: var(--blue-bright, #2563eb);
}
.live-chat-message.admin .live-chat-voice-play-btn,
.live-chat-message.system .live-chat-voice-play-btn { background: var(--blue-bright, #2563eb); color: #fff; }
.live-chat-voice-duration { font-size: 11.5px; opacity: 0.9; min-width: 32px; }
.live-chat-message-status { font-size: 10.5px; color: #9ca3af; margin-top: 2px; text-align: right; }
.live-chat-message-status.read { color: #4ade80; }

.live-chat-input-area {
    padding: 10px 14px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.live-chat-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #f3f4f6;
    color: #6b7280;
    flex-shrink: 0;
}
#liveChatSendBtn { background: linear-gradient(135deg, var(--blue-deep, #0b2545), var(--blue-bright, #2563eb)); color: #fff; }
#liveChatMessageInput {
    flex: 1;
    padding: 9px 13px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    font-size: 13.5px;
}
#liveChatMessageInput:focus { outline: none; border-color: var(--blue-bright, #2563eb); }

.live-chat-footer { padding: 6px 14px; text-align: center; background: #f8fafc; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.live-chat-footer small { color: #9ca3af; font-size: 10.5px; }

@media (max-width: 480px) {
    .live-chat-window { width: calc(100vw - 20px); height: calc(100vh - 100px); bottom: 68px; left: 10px; }
    .live-chat-widget { left: 10px; bottom: 10px; }
}
