/* ============================================
   AI Chat Widget - Modern Redesign
   Sleek glassmorphism design with AI booking
   ============================================ */

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

/* ============================================
   Chat Bubble (Closed State)
   ============================================ */
.chat-bubble {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow:
        0 8px 32px rgba(102, 126, 234, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    border-radius: inherit;
}

.chat-bubble:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow:
        0 12px 40px rgba(102, 126, 234, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.chat-bubble:active {
    transform: scale(0.95);
}

.chat-bubble svg {
    width: 28px;
    height: 28px;
    position: relative;
    z-index: 1;
}

/* Online Indicator - Pulse animation */
.online-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 3px solid white;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 16px rgba(16, 185, 129, 0.8);
        transform: scale(1.1);
    }
}

/* Unread Badge */
.unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
    animation: bounce 0.6s ease infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

/* ============================================
   Chat Window (Open State)
   ============================================ */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 580px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpFade 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header - Gradient with glass effect */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    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(180deg, rgba(255, 255, 255, 0.15) 0%, transparent 100%);
}

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

.chat-logo {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    backdrop-filter: blur(10px);
}

.chat-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: 0.95;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.chat-close {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

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

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Message Bubble */
.message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 100%;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.3);
}

.message-content {
    max-width: 75%;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 20px;
    line-height: 1.55;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.message.bot .message-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    padding: 0 4px;
}

/* Welcome Message */
.message.welcome .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 22px;
}

.welcome-title {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.5;
}

/* Quick Action Buttons - Hidden by default */
.welcome-list {
    display: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 16px 24px;
    background: white;
    border-radius: 20px;
    width: fit-content;
    margin-left: 46px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* Input Area */
.chat-input-area {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 16px 20px;
    background: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-form {
    flex: 1;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.chat-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 14px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chat-send:active {
    transform: scale(0.95);
}

.chat-send:disabled {
    background: #e2e8f0;
    box-shadow: none;
    cursor: not-allowed;
}

.chat-clear {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-clear:hover {
    color: #f43f5e;
    background: #fef2f2;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-bubble {
        width: 60px;
        height: 60px;
        border-radius: 18px;
    }

    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        animation: slideUpMobile 0.3s ease-out;
    }

    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .chat-header {
        padding: 16px 20px;
        border-radius: 0;
    }

    .message-content {
        max-width: 80%;
    }
}

/* ============================================
   Accessibility & Preferences
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    .chat-bubble,
    .chat-window,
    .message,
    .online-indicator,
    .typing-dot {
        animation: none;
        transition: none;
    }
}

@media (prefers-color-scheme: dark) {
    .chat-window {
        background: rgba(30, 41, 59, 0.98);
    }

    .chat-messages {
        background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    }

    .message.bot .message-bubble {
        background: #334155;
        color: #f1f5f9;
        border-color: rgba(255, 255, 255, 0.05);
    }

    .chat-input-area {
        background: #1e293b;
        border-color: rgba(255, 255, 255, 0.05);
    }

    .chat-input {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }

    .chat-input:focus {
        background: #1e293b;
    }

    .typing-indicator {
        background: #334155;
    }
}

/* ============================================
   Dental Page Theme - Teal Colors & Clean Style
   ============================================ */
[data-page-type="dental"] .chat-bubble {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    box-shadow: 0 8px 32px rgba(13, 148, 136, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

[data-page-type="dental"] .chat-bubble:hover {
    box-shadow: 0 12px 40px rgba(13, 148, 136, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

[data-page-type="dental"] .chat-header {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}

[data-page-type="dental"] .chat-window {
    width: 400px;
    height: 550px;
    border-radius: 20px;
}

[data-page-type="dental"] .chat-messages {
    background: #f8fafc;
    padding: 16px;
}

[data-page-type="dental"] .chat-send {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}

[data-page-type="dental"] .chat-send:hover {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
}

[data-page-type="dental"] .message.bot .message-bubble {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white;
    border: none;
}

[data-page-type="dental"] .message.user .message-bubble {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

[data-page-type="dental"] .message-avatar {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

[data-page-type="dental"] .message.user .message-avatar {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

[data-page-type="dental"] .chat-logo {
    background: rgba(255, 255, 255, 0.2);
}

[data-page-type="dental"] .chat-input-area {
    background: white;
    border-top: 1px solid #e2e8f0;
}

[data-page-type="dental"] .chat-input {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-page-type="dental"] .chat-input:focus {
    border-color: #0d9488;
    background: white;
}

/* ============================================
   BlocryxNova Chat Button - Lightweight Style
   ============================================ */
[data-page-type="blocryxnova"] .chat-bubble {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(220, 80%, 55%) 0%, hsl(270, 70%, 55%) 100%);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-page-type="blocryxnova"] .chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.5);
}

[data-page-type="blocryxnova"] .chat-bubble svg {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

[data-page-type="blocryxnova"] .online-indicator {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border: 3px solid white;
    box-shadow:
        0 0 20px rgba(74, 222, 128, 0.8),
        0 0 40px rgba(74, 222, 128, 0.4);
    animation: onlinePulse 1.5s ease-in-out infinite;
}

[data-page-type="blocryxnova"] .chat-header {
    background: linear-gradient(135deg, hsl(220, 90%, 45%) 0%, hsl(280, 80%, 50%) 100%);
}

[data-page-type="blocryxnova"] .chat-send {
    background: linear-gradient(135deg, hsl(220, 90%, 55%) 0%, hsl(280, 80%, 55%) 100%);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

[data-page-type="blocryxnova"] .chat-send:hover {
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5);
}

[data-page-type="blocryxnova"] .message-avatar {
    background: linear-gradient(135deg, hsl(220, 90%, 55%) 0%, hsl(280, 80%, 55%) 100%);
}

[data-page-type="blocryxnova"] .typing-dot {
    background: linear-gradient(135deg, hsl(220, 90%, 55%) 0%, hsl(280, 80%, 55%) 100%);
}

@keyframes chatFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes chatPulse {
    0% {
        box-shadow:
            0 10px 40px rgba(99, 102, 241, 0.5),
            0 0 60px rgba(139, 92, 246, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }

    100% {
        box-shadow:
            0 15px 50px rgba(99, 102, 241, 0.6),
            0 0 80px rgba(139, 92, 246, 0.4),
            inset 0 0 30px rgba(255, 255, 255, 0.15);
    }
}

@keyframes neonRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes onlinePulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow:
            0 0 20px rgba(74, 222, 128, 0.8),
            0 0 40px rgba(74, 222, 128, 0.4);
    }

    50% {
        transform: scale(1.1);
        box-shadow:
            0 0 25px rgba(74, 222, 128, 1),
            0 0 50px rgba(74, 222, 128, 0.6);
    }
}