#ai-container {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 350px;
    min-width: 300px;
    max-width: 80vw;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
}

/* Mobile */
@media screen and (max-width: 600px) {
    #ai-container {
        width: 100vw !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100dvh !important;
        left: 0 !important;
        right: 0 !important;
        max-width: none;
        border: none !important;
        border-radius: 0 !important;
    }
    #ai-resizer {
        display: none !important;
    }
    #ai-detach-btn {
        display: none !important;
    }
}

#ai-resizer {
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    z-index: 10;
}



#ai-header {
    height: 60px;
    box-sizing: border-box;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    background: var(--bg-color);
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

#ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

@keyframes wordReveal {
    0% { opacity: 0; filter: blur(5px); transform: translateY(2px); }
    100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.ai-msg {
    max-width: 90%;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    font-size: var(--font-size);
    line-height: var(--line-height);
    word-wrap: break-word;
}
.ai-word {
    display: inline-block;
    opacity: 0;
    animation: wordReveal 0.34s ease-out forwards;
}
.ai-msg.ai.is-revealing {
    color: transparent;
}
.ai-msg.ai.is-revealing .ai-word {
    color: var(--primary);
}
.ai-msg.ai.is-revealing table,
.ai-msg.ai.is-revealing th,
.ai-msg.ai.is-revealing td,
.ai-msg.ai.is-revealing pre,
.ai-msg.ai.is-revealing code {
    background: transparent;
}
.ai-msg.ai.is-revealing .ai-table-reveal {
    color: var(--primary);
    animation: wordReveal 0.34s ease-out forwards;
}
.ai-msg.ai.is-revealing ul,
.ai-msg.ai.is-revealing ol {
    list-style: none;
}
.ai-msg.ai.is-revealing a {
    text-decoration: none;
}
.ai-msg.ai.is-revealing a .ai-word,
.ai-msg.ai a .ai-word {
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-color: currentColor;
    text-underline-offset: 3px;
}
.ai-msg.user {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary);
    border-bottom-right-radius: 2px;
}
.ai-msg.ai {
    align-self: flex-start;
    background: transparent;
    border: none;
    color: var(--primary);
    border-bottom-left-radius: 2px;
}
.ai-msg.system {
    align-self: center;
    background: transparent;
    color: var(--secondary);
    font-size: var(--font-size-smaller);
    font-family: var(--font-family-mono, monospace);
    border: none;
    padding: 2px;
    text-align: left;
    width: 100%;
}
.ai-msg.action-status {
    align-self: flex-start;
    width: auto;
    margin: 0;
    padding: 3px 0;
    color: var(--secondary);
    font-family: var(--font-family-mono, monospace);
    font-size: var(--font-size-smaller);
    border: 0;
    background: transparent;
}
.ai-action-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 2px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.03);
    color: var(--primary);
    box-shadow: none;
}
.ai-action-status i {
    color: var(--secondary);
}
.ai-action-status .loader-gif {
    font-size: 0.9em;
}

/* Markdown Rendering inside AI messages (core rules moved to src/styles/markdown.css) */
.ai-msg p {
    margin: 0 0 8px 0;
}
.ai-msg p:last-child {
    margin-bottom: 0;
}

#ai-input-container {
    padding: 8px 10px;
    display: flex;
    gap: 8px;
    background: var(--bg-color);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

#ai-input {
    flex: 1;
    box-sizing: border-box;
    min-height: 0;
    max-height: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 6px 10px;
    color: var(--primary);
    font-family: var(--font-family);
    font-size: var(--font-size);
    outline: none;
    resize: none;
    overflow-y: hidden;
    line-height: var(--line-height);
}
#ai-input:focus {
    border-color: var(--primary);
}

#ai-send {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--primary);
    cursor: pointer;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#ai-send:hover {
    background: var(--highlight-color);
}
.ai-retry {
    margin-left: 6px;
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--primary);
    background: transparent;
    cursor: pointer;
}
