/* ==================== ADVANCED AI CHATBOT STYLES ==================== */
/* Premium chatbot with glass morphism, animations & modern design */

:root {
    --chat-primary: #667eea;
    --chat-secondary: #764ba2;
    --chat-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chat-bg: rgba(15, 20, 40, 0.95);
    --chat-glass: rgba(255, 255, 255, 0.08);
    --chat-border: rgba(255, 255, 255, 0.12);
    --chat-window-width: 380px;
    --chat-window-height: 550px;
}

/* ==================== CHAT BUBBLE (FAB) ==================== */
.chat-bubble {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 100000;
    width: 65px;
    height: 65px;
    background: var(--chat-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow:
        0 10px 40px rgba(102, 126, 234, 0.5),
        0 0 30px rgba(102, 126, 234, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: floatBubble 3s ease-in-out infinite;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--chat-gradient);
    z-index: -1;
    opacity: 0.5;
    filter: blur(10px);
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Notification badge */
.chat-bubble::after {
    content: '1';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: #ff4757;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(15, 20, 40, 0.9);
    animation: bounce 2s infinite;
}

.chat-bubble.no-notification::after {
    display: none;
}

@keyframes floatBubble {

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

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

@keyframes pulseGlow {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.chat-bubble:hover {
    animation: none;
    transform: scale(1.15) rotate(10deg);
    box-shadow:
        0 15px 50px rgba(102, 126, 234, 0.7),
        0 0 50px rgba(102, 126, 234, 0.5);
}

.chat-bubble i {
    transition: transform 0.3s ease;
}

.chat-bubble:hover i {
    transform: scale(1.1);
}

/* ==================== CHAT WINDOW ==================== */
.chat-window {
    position: fixed;
    bottom: 180px;
    right: 30px;
    width: var(--chat-window-width);
    height: var(--chat-window-height);
    background: var(--chat-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 99999;
    transform: translateY(30px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ==================== CHAT HEADER ==================== */
.chat-header {
    background: var(--chat-gradient);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: shimmerHeader 3s linear infinite;
}

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

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

.chat-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #00ff88;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 1);
    animation: onlinePulse 2s infinite;
}

@keyframes onlinePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

.chat-header-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.chat-header-info h3 {
    color: white;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 2px 0;
    font-family: 'Space Grotesk', sans-serif;
}

.chat-header-info span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-header-info span i {
    color: #00ff88;
    font-size: 8px;
}

.close-chat {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

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

/* ==================== CHAT MESSAGES AREA ==================== */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* ==================== MESSAGE BUBBLES ==================== */
.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    position: relative;
}

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

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

.message.bot {
    background: var(--chat-glass);
    color: #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid var(--chat-border);
}

.message.user {
    background: var(--chat-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
    display: block;
}

/* ==================== TYPING INDICATOR ==================== */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: var(--chat-glass);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 80px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(102, 126, 234, 0.8);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typingBounce {

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

    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ==================== QUICK REPLIES ==================== */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px 15px;
    animation: fadeIn 0.5s ease;
}

.quick-reply-btn {
    padding: 10px 16px;
    background: var(--chat-glass);
    border: 1px solid var(--chat-border);
    color: #a8b2c8;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.quick-reply-btn:hover {
    background: var(--chat-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.quick-reply-btn i {
    margin-right: 6px;
}

/* ==================== CHAT INPUT AREA ==================== */
.chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.chat-input {
    flex: 1;
    background: var(--chat-glass);
    border: 1px solid var(--chat-border);
    border-radius: 25px;
    padding: 14px 20px;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.15);
}

.send-msg {
    width: 48px;
    height: 48px;
    background: var(--chat-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.send-msg:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

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

.send-msg i {
    transform: translateX(2px);
}

/* ==================== EMOJI & ATTACHMENTS ==================== */
.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.chat-action-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* ==================== BOT MESSAGE WITH AVATAR ==================== */
.bot-message-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.bot-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--chat-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

/* ==================== MOBILE ADJUSTMENTS ==================== */
@media (max-width: 768px) {
    .chat-bubble {
        right: 20px;
        bottom: 85px;
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    .chat-bubble::after {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .chat-window {
        width: 100%;
        right: 0;
        left: 0;
        bottom: 0;
        height: 85vh;
        border-radius: 28px 28px 0 0;
        transform: translateY(110%);
    }

    .chat-window.active {
        transform: translateY(0);
    }

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

    .chat-messages {
        padding: 16px;
    }

    .quick-replies {
        padding: 10px 16px 15px;
    }

    body.chat-open {
        overflow: hidden;
    }

    body.chat-open .chat-bubble,
    body.chat-open .theme-toggle,
    body.chat-open .scroll-top-btn {
        display: none !important;
    }
}

/* ==================== LIGHT THEME ==================== */
[data-theme="light"] .chat-window {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .message.bot {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chat-input {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .quick-reply-btn {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-input-area {
    background: rgba(0, 0, 0, 0.03);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}