/* Inherit variables from style.css, but add specific chat ones if needed */
:root {
    --chat-zIndex: 9999;
}

#aichat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: var(--chat-zIndex);
    font-family: 'Inter', sans-serif;
}

#aichat-toggle-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--surface-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(191, 0, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

#aichat-toggle-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(191, 0, 255, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: 0.3s;
}

#aichat-toggle-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 0 30px var(--primary-color);
    background: var(--primary-color);
    color: white;
}

#aichat-toggle-btn:hover::after {
    opacity: 1;
}

.aichat-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;
    /* Slightly wider */
    height: 600px;
    /* Taller */

    /* Liquid Glass */
    background: rgba(26, 16, 46, 0.4);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(191, 0, 255, 0.2);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(191, 0, 255, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);

    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.aichat-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.aichat-header {
    background: linear-gradient(135deg, #240046, #400080);
    /* Purple gradient */
    padding: 20px;
    color: white;
    border-bottom: 1px solid #3e2a5e;
    position: relative;
}

.aichat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aichat-logo {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.aichat-logo span {
    color: var(--primary-color);
}

.aichat-close {
    cursor: pointer;
    font-size: 24px;
    opacity: 0.7;
    transition: 0.2s;
}

.aichat-close:hover {
    opacity: 1;
    color: var(--primary-color);
    transform: rotate(90deg);
}

.aichat-welcome h3 {
    margin: 15px 0 5px 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.aichat-welcome p {
    font-size: 0.9rem;
    color: #ccc;
    margin: 0;
}

.aichat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.aichat-body::-webkit-scrollbar {
    width: 6px;
}

.aichat-body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.aichat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

.aichat-message.bot {
    background: #222;
    color: #eee;
    border-bottom-left-radius: 2px;
    border: 1px solid #333;
}

.aichat-message.user {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 10px rgba(191, 0, 255, 0.2);
}

/* Typing indicator */
.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    margin-right: 3px;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

@keyframes typing {

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

    40% {
        transform: scale(1);
    }
}

.aichat-input-area {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
}

.aichat-input-area input {
    flex: 1;
    padding: 12px 15px;
    background: #111;
    border: 1px solid #333;
    border-radius: 25px;
    color: white;
    outline: none;
    transition: 0.3s;
}

.aichat-input-area input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
}

.aichat-input-area button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    font-size: 18px;
}

.aichat-input-area button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--primary-color);
}

/* Quick Actions */
.aichat-quick-actions {
    margin-top: auto;
    /* Push to bottom if empty space */
    display: grid;
    gap: 8px;
}

.aichat-action-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 10px 15px;
    border-radius: 8px;
    text-align: left;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aichat-action-btn:hover {
    background: #222;
    border-color: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.aichat-action-btn i {
    color: var(--primary-color);
    opacity: 0.7;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .aichat-window {
        width: calc(100% - 40px);
        bottom: 100px;
        right: 20px;
        height: 70vh;
    }
}