:root {
--ai-primary: #1d4ed8; /* Library Blue-Dark */
--ai-accent: #e74c3c; /* Accent Red */
--ai-bg-light: #f4f6f8;
--ai-white: #ffffff;
--ai-text: #333333;
--ai-text-light: #666666;
--ai-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#ai-assistant-widget {
position: fixed;
bottom: 100px;
right: 20px;
z-index: 99999;
font-family: 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* --- Toggle Button --- */
#ai-assistant-toggle {
background: linear-gradient(135deg, #1d4ed8, #0a2c8b);
color: var(--ai-white);
border: none;
border-radius: 50%;
width: 64px;
height: 64px;
font-size: 28px;
cursor: pointer;
box-shadow: var(--ai-shadow);
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#ai-assistant-toggle:hover {
transform: scale(1.1);
box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

#ai-assistant-toggle .dashicons {
font-size: 32px;
width: 32px;
height: 32px;
}

/* --- Chat Container --- */
#ai-assistant-chat-container {
position: absolute;
bottom: 80px;
right: 0;
width: 450px; /* Increased width */
height: 600px; /* Increased height */
max-height: 80vh;
background: var(--ai-white);
border-radius: 16px;
box-shadow: var(--ai-shadow);
display: flex;
flex-direction: column;
overflow: hidden;
/* Removed opacity/visibility transition hacking to fix jQuery fadeIn compatibility */
}

/* --- Header --- */
#ai-assistant-header {
background: linear-gradient(135deg, var(--ai-primary), #0a2c8b);
color: var(--ai-white);
padding: 16px 20px;
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
font-size: 16px;
border-bottom: 1px solid rgba(255,255,255,0.1);
}

#ai-assistant-header span {
display: flex;
align-items: center;
gap: 8px;
}

#ai-assistant-header span::before {
content: '';
display: block;
width: 10px;
height: 10px;
background-color: #2ecc71; /* Online green */
border-radius: 50%;
box-shadow: 0 0 5px rgba(46, 204, 113, 0.6);
}

#ai-assistant-close {
background: var(--ai-primary);
border: none;
color: var(--ai-white);
width: 28px;
height: 36px;
border-radius: 50%;
font-size: 18px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
}

#ai-assistant-close:hover {
background: #0a2c8b;
}

/* --- Messages Area --- */
#ai-assistant-messages {
flex-grow: 1;
padding: 20px;
overflow-y: auto;
background: var(--ai-bg-light);
display: flex;
flex-direction: column;
gap: 12px;
scrollbar-width: thin;
scrollbar-color: #ccc transparent;
}

#ai-assistant-messages::-webkit-scrollbar {
width: 6px;
}
#ai-assistant-messages::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 3px;
}

.ai-message {
padding: 12px 16px;
border-radius: 18px;
max-width: 85%;
line-height: 1.5;
font-size: 14px;
word-wrap: break-word;
position: relative;
animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
from { opacity: 0; transform: translateY(5px); }
to { opacity: 1; transform: translateY(0); }
}

/* Assistant Message */
.ai-message.assistant {
background-color: var(--ai-white);
color: var(--ai-text);
align-self: flex-start;
border-bottom-left-radius: 4px;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
border: 1px solid #e1e4e8;
}

/* User Message */
.ai-message.user {
background-color: var(--ai-primary);
color: var(--ai-white);
align-self: flex-end;
border-bottom-right-radius: 4px;
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ai-message a {
color: #3498db;
text-decoration: none;
font-weight: 500;
}
.ai-message a:hover {
text-decoration: underline;
}

/* --- Suggestions --- */
#ai-assistant-suggestions {
padding: 10px 15px;
background: var(--ai-bg-light);
display: flex;
flex-wrap: wrap;
gap: 8px;
border-top: 1px solid #e1e4e8;
}

.ai-suggestion-btn {
background: var(--ai-white);
border: 1px solid #d1d5db;
color: var(--ai-primary);
font-size: 13px;
padding: 6px 12px;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s ease;
outline: none;
font-family: inherit;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ai-suggestion-btn:hover {
background: var(--ai-primary);
color: var(--ai-white);
border-color: var(--ai-primary);
transform: translateY(-1px);
}

/* --- Input Area --- */
#ai-assistant-input-area {
padding: 15px;
background: var(--ai-white);
border-top: 1px solid #eee;
display: flex;
gap: 10px;
align-items: center;
}

#ai-user-input {
flex-grow: 1;
border: 1px solid #ddd;
border-radius: 20px;
padding: 10px 15px;
font-size: 14px;
outline: none;
transition: border-color 0.2s;
font-family: inherit;
}

#ai-user-input:focus {
border-color: var(--ai-primary);
}

#ai-send-btn {
background: var(--ai-primary);
color: var(--ai-white);
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
font-size: 16px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s, transform 0.1s;
}

#ai-send-btn:hover {
background: #0a2c8b;
}
#ai-send-btn:active {
transform: scale(0.95);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
#ai-assistant-chat-container {
    width: 90vw;
    height: 70vh;
    bottom: 90px;
    right: 0vw;
}
    /* #ai-assistant-chat-container {
    width: 90vw;
    height: 50vh;
    bottom: 120px;
    right: 0vw;
} */
}
