/* Live Chat Widget Styles - Professional Design */

/* Hide the original scroll-to-top button since widget provides one */
button.scroltop {
    display: none !important;
}

.live-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}


/* Scroll to Top Button - Above Chat Button */
.scroll-to-top-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #64748B 0%, #475569 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(71, 85, 105, 0.3);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
}

.scroll-to-top-btn.visible {
    display: flex;
}

.scroll-to-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(71, 85, 105, 0.4);
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.scroll-to-top-btn svg {
    width: 22px;
    height: 22px;
}

/* Welcome Notification Bubble - Horizontal Professional Design */
.chat-welcome-notification {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 12px 16px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 320px;
    animation: notificationSlideIn 0.4s ease;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.chat-welcome-notification.hiding {
    opacity: 0;
    transform: translateX(20px);
}

.chat-welcome-notification::before {
    display: none;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
}

.notification-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #066168 0%, #0891b2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-avatar svg {
    width: 16px;
    height: 16px;
    color: white;
}

.notification-text {
    flex: 1;
}

.notification-text p {
    font-size: 13px;
    font-weight: 500;
    color: #1F2937;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
}

.notification-close {
    position: relative;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    line-height: 1;
    font-size: 16px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.notification-close:hover {
    color: #6B7280;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* Chat Toggle Button - Premium Design */
.chat-toggle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    border: none;
    box-shadow: 0 6px 25px rgba(14, 165, 233, 0.45), 0 0 0 4px rgba(14, 165, 233, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chat-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
}

.chat-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.5), 0 0 0 6px rgba(14, 165, 233, 0.2);
}

.chat-toggle-btn:active {
    transform: scale(1.02);
}

/* Pulse animation for attention */
.chat-toggle-btn::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.4);
    animation: pulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.1);
        opacity: 0;
    }
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.chat-toggle-btn:hover svg {
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Chat Window - Premium Design */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header - Premium */
.chat-header {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    color: white;
    padding: 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: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.chat-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-avatar svg {
    width: 26px;
    height: 26px;
}

.chat-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.chat-status {
    font-size: 13px;
    opacity: 0.9;
    margin: 3px 0 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22C55E;
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chat-minimize-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.chat-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-minimize-btn svg {
    width: 20px;
    height: 20px;
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
    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;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 30px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.welcome-icon {
    font-size: 52px;
    margin-bottom: 16px;
}

.chat-welcome h4 {
    font-size: 19px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 10px 0;
}

.chat-welcome p {
    font-size: 15px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

/* Chat Messages */
.chat-message {
    display: flex;
    margin-bottom: 4px;
    animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.visitor {
    justify-content: flex-end;
}

.chat-message.admin {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-message.visitor .message-bubble {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.chat-message.admin .message-bubble {
    background: white;
    color: #1F2937;
    border-bottom-left-radius: 6px;
}

.message-text {
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    display: block;
    margin-top: 6px;
}

.message-attachments {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-image {
    max-width: 100%;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.message-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    font-size: 13px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.message-file:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* Input Area */
.chat-input-area {
    border-top: 1px solid #E2E8F0;
    background: white;
    padding: 16px;
}

.image-preview-container {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding: 4px;
}

.image-preview {
    position: relative;
    flex-shrink: 0;
}

.image-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #E2E8F0;
}

.remove-preview {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    border: 2px solid white;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    transition: transform 0.2s;
}

.remove-preview:hover {
    transform: scale(1.1);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #F8FAFC;
    border-radius: 25px;
    padding: 6px 6px 6px 16px;
    border: 1px solid #E2E8F0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #0EA5E9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.attach-btn {
    background: transparent;
    border: none;
    color: #64748B;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
    border-radius: 50%;
}

.attach-btn:hover {
    color: #0EA5E9;
    transform: scale(1.1);
}

.attach-btn svg {
    width: 22px;
    height: 22px;
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 100px;
    color: #1F2937;
}

#chat-input::placeholder {
    color: #94A3B8;
}

.send-btn {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.send-btn:active {
    transform: scale(0.98);
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

/* Loading indicator */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px;
}

.chat-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0EA5E9;
    animation: bounce 1.4s ease-in-out infinite both;
}

.chat-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 8px;
        border-radius: 16px;
    }

    .live-chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-toggle-btn {
        width: 58px;
        height: 58px;
    }

    .chat-welcome-notification {
        right: -8px;
        max-width: 260px;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}