:root {
    --ai-pane-width: 490px;      /* Width for the AI chat pane */
    --ai-pane-height: 610px;     /* Height for the AI chat pane */
    --minimized-pane-size: 60px; /* Size for the minimized AI pane */

    /* Brand Colors (Vibrant and Professional) */
    --brand-primary: #007bff;        /* A strong, common brand blue */
    --brand-primary-dark: #0056b3;   /* Darker for hover/accents */

    --user-bubble-bg: #e0f7fa;    /* Very light cyan for user messages */
    --ai-bubble-bg: #ffffff;      /* White for AI messages */
    --border-color: #e9ecef;      /* Light gray border */
    --background-light: #f8f9fa;
    --text-color-dark: #343a40;
}
.ai-assistant-pane {
    position: fixed;
    bottom: 33px;
    right: 100px;
    width: var(--ai-pane-width);
    height: var(--ai-pane-height);
    background-color: var(--background-light);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    transform: translateY(calc(100% + 20px));
    opacity: 0;
    pointer-events: none; 
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 1000;
}

.ai-assistant-pane.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
    width: var(--ai-pane-width); 
    height: var(--ai-pane-height);
    border-radius: 12px;
}
.ai-assistant-pane.minimized {
    width: var(--minimized-pane-size);
    height: var(--minimized-pane-size);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    cursor: pointer;
    opacity: 1;
    pointer-events: all;
    background: linear-gradient(135deg, #a5cf26, #81c718);
    display: flex;
    justify-content: center;
    align-items: center;
    transform: none; 
    transition: all 0.3s ease-out;
}

.ai-assistant-pane.minimized .ai-pane-header,
.ai-assistant-pane.minimized .ai-chat-messages,
.ai-assistant-pane.minimized .ai-chat-input,
.ai-assistant-pane.minimized .ai-typing-indicator,
.ai-assistant-pane.minimized .copied-message {
    display: none !important;
}

.ai-assistant-pane.minimized .minimized-icon {
    display: block;
    height: 70%;
    width: 70%;
    filter: brightness(1.5) drop-shadow(0 0 5px rgba(255,255,255,0.5));
    transition: all 0.3s ease;
}

.ai-assistant-pane.minimized:hover .minimized-icon {
    transform: scale(1.1);
}

.ai-pane-header {
    background: linear-gradient(135deg, #abd129, #88c91c);
    color: white;
    padding: 15px 20px;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-family: "Roboto", sans-serif;
    position: relative;
}
.ai-pane-header .logo {
    height: 30px;
    margin-right: 10px;
    vertical-align: middle;
    filter: brightness(1.2);
}
.ai-pane-header .title-group {
    display: flex;
    align-items: center;
}

.ai-pane-header .header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-pane-header .close-btn,
.ai-pane-header .minimize-btn, 
.ai-pane-header .copy-chat-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0.8;
}
.ai-pane-header .close-btn { font-size: 1.6em; }
.ai-pane-header .minimize-btn { font-size: 1.4em; }
.ai-pane-header .copy-chat-btn { font-size: 1.2em; }

.ai-pane-header .close-btn:hover { opacity: 1; transform: rotate(90deg); }
.ai-pane-header .minimize-btn:hover,
.ai-pane-header .copy-chat-btn:hover { opacity: 1; transform: scale(1.1); }

.copied-message {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out, bottom 0.3s ease-out;
    z-index: 10;
    white-space: nowrap;
}
.copied-message.show {
    opacity: 1;
    bottom: -20px;
}

.ai-chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--background-light);
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 20px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    font-size: 15px;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    background-color: var(--user-bubble-bg);
    align-self: flex-end;
    text-align: right;
    color: var(--text-color-dark);
    border-bottom-right-radius: 2px;
    word-wrap: break-word;
}
.message.ai {
    background-color: var(--ai-bubble-bg);
    align-self: flex-start;
    text-align: left;
    color: var(--text-color-dark);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
    word-wrap: break-word;
}

.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: var(--ai-bubble-bg);
    padding: 10px 15px;
    border-radius: 20px;
    width: fit-content;
    max-width: 85%;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-top: 5px;
    margin-left: 20px;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.ai-typing-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: var(--brand-primary);
    border-radius: 50%;
    animation: dot-blink 1.4s infinite ease-in-out both;
}
.ai-typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}
.ai-typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

.ai-chat-input {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background-color: var(--ai-bubble-bg);
    flex-shrink: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}
.ai-chat-input textarea {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color) !important;
    border-radius: 25px;
    font-size: 1em;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    box-sizing: border-box;
    line-height: 1.5;
    overflow-y: auto;
}
.ai-chat-input textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
.ai-chat-input button {
    background-color: #aad028;
    color: white;
    border: none;
    padding: 0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, box-shadow 0.2s;
    position: relative;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.ai-chat-input button:hover {
    background-color: #84c81a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: pre-wrap;
    text-align: center;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.ai-chat-input button .tooltip {
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-5px);
    padding: 6px 12px;
}

.suggestion-button .tooltip {
    top: unset;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    padding: 6px 12px;
}

.ai-chat-input button:hover .tooltip,
.suggestion-button:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.icon {
    margin-right: 5px;
}

.action-buttons {
    display: contents;
}

#toast {
    visibility: hidden;
    min-width: 200px;
    margin-left: -125px;
    background-color: #92cb1f;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 10px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 30px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.5s, bottom 0.5s;
}

/* Show toast */
#toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 100px;
}

#toast.hide {
    display: none;
}