/* Chatbot Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 1;
    transition: all 0.3s ease;
    border: none;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.chat-toggle-btn svg {
    width: 30px;
    height: 30px;
    fill: var(--ink);
}

/* Tooltip */
.chat-toggle-btn::before {
    content: 'My ChatBot Assistant: Lexon';
    position: absolute;
    right: 70px;
    background: #1f2937;
    color: var(--on-accent);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.chat-toggle-btn::after {
    content: '';
    position: absolute;
    right: 60px;
    border: 6px solid transparent;
    border-left-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chat-toggle-btn:hover::before,
.chat-toggle-btn:hover::after {
    opacity: 1;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: var(--on-accent);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: bounce 2s infinite;
}

@keyframes bounce {

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

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

    60% {
        transform: translateY(-5px);
    }
}

.chat-widget-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    animation: slideUp 0.3s ease;
    backdrop-filter: blur(10px);
}

.chat-widget-container.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.chat-header {
    background: rgba(15, 23, 42, 0.95);
    color: var(--on-accent);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-content h3 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
}

.chat-header-content p {
    font-size: 12px;
    margin: 5px 0 0 0;
    opacity: 0.9;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.close-chat-btn {
    background: none;
    border: none;
    color: var(--on-accent);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.close-chat-btn:hover {
    background: rgba(var(--tint), 0.2);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--surface-2);
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--ink-5);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.message.bot {
    flex-direction: row;
}

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

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.bot .avatar {
    background: rgba(15, 23, 42, 0.95);
}

.user .avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.bot .message-content {
    background: var(--surface);
    color: var(--ink);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bot .message-content a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.bot .message-content a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--on-accent);
    border-bottom-right-radius: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--ink-4);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {

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

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

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    background: var(--surface-2);
}

/* Grid layout for mobile */
@media (max-width: 480px) {
    .quick-replies {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        /* 2 columns */
        gap: 8px;
        padding: 10px 15px;
    }

    .quick-reply-btn {
        width: 100%;
        text-align: center;
        font-size: 12px;
        /* Slightly smaller for mobile */
        padding: 10px 12px;
    }
}

.quick-reply-btn {
    padding: 8px 16px;
    background: var(--surface);
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: #667eea;
    color: var(--on-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-input-container {
    padding: 15px 20px;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--line);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

.send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: var(--on-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 18px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .chat-widget-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 90px;
    }

    .chat-toggle-btn {
        right: 20px;
        bottom: 20px;
        z-index: 999;
    }
}