/* Chat Widget Styles */
#ai-assistant-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

#ai-assistant-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#ai-assistant-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.6);
}

#ai-assistant-window {
    display: none;
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 450px;
    height: 600px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    overflow: hidden;
    resize: both;
    direction: rtl; /* Moves resize handle to bottom-left */
    min-width: 350px;
    min-height: 450px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    animation: slideUp 0.3s ease-out;
}

/* Reset text direction and alignment for all children so text looks normal */
#ai-assistant-window > * {
    direction: ltr;
}

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

#ai-assistant-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#ai-assistant-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#ai-assistant-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

#ai-assistant-close:hover {
    color: white;
}

#ai-assistant-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-msg {
    max-width: 85%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-msg.bot {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.8), rgba(139, 92, 246, 0.8));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg p {
    margin: 0 0 0.5rem 0;
}
.chat-msg p:last-child {
    margin-bottom: 0;
}
.chat-msg a {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.chat-typing {
    display: flex;
    gap: 4px;
    padding: 0.5rem 1rem;
    align-items: center;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

#ai-assistant-input-area {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.5rem;
}

#ai-assistant-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#ai-assistant-input:focus {
    border-color: var(--accent-cyan);
}

#ai-assistant-send {
    background: var(--accent-cyan);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#ai-assistant-send:hover {
    background: var(--accent-purple);
}

@media screen and (max-width: 480px) {
    #ai-assistant-window {
        width: calc(100vw - 40px);
        right: -10px;
    }
}
