/* AI Bots Overlay & Glitch Effects */
.ai-glitch-trigger {
    position: relative;
    cursor: pointer;
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
    animation: ai-glitch-anim 2s infinite;
    font-weight: bold;
    border-bottom: 1px dashed var(--neon-green);
}
@keyframes ai-glitch-anim {
    0% { opacity: 1; }
    50% { opacity: 0.8; text-shadow: -2px 0 red, 2px 0 blue; }
    100% { opacity: 1; }
}

.ai-inline-bot {
    display: none;
    background: rgba(0, 20, 0, 0.9);
    border-left: 3px solid var(--neon-green);
    padding: 10px 15px;
    margin-top: 10px;
    margin-bottom: 10px;
    color: #e0e0e0;
    font-size: 0.9em;
    font-family: 'Share Tech Mono', monospace, sans-serif;
    box-shadow: inset 0 0 10px rgba(0,255,0,0.1);
}
.ai-inline-bot.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-cursor-trigger {
    display: inline-block;
    color: #00ff00;
    animation: ai-blink-caret 1s step-end infinite;
    cursor: pointer;
    font-weight: bold;
    margin-left: 5px;
}
@keyframes ai-blink-caret {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.ai-console-bot {
    display: none;
    background: #000;
    border: 1px solid var(--neon-purple);
    padding: 15px;
    margin-top: 15px;
    color: var(--terminal-green);
    font-family: 'Courier New', Courier, monospace, sans-serif;
    font-size: 0.9em;
}
.ai-console-bot.active {
    display: block;
}

.ai-overlay-bot {
    position: absolute;
    top: 20px;
    right: 0;
    transform: translateX(100%);
    width: 280px;
    background: rgba(0, 10, 20, 0.95);
    border: 1px solid var(--neon-blue);
    padding: 15px;
    color: #fff;
    box-shadow: -5px 5px 20px rgba(0, 221, 235, 0.2);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform;
    z-index: 10;
    border-radius: 8px 0 0 8px;
    border-right: none;
}
.ai-overlay-bot.active {
    transform: translateX(0);
}
.ai-bot-avatar {
    font-size: 1.5em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--neon-blue);
}

/* Terminal Typing Effect */
.terminal-typing {
    font-family: 'Courier New', Courier, monospace, sans-serif !important;
    color: #00ff41 !important;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.5) !important;
    background: rgba(0, 20, 0, 0.8) !important;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #00ff41;
}
.terminal-typing .terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: #00ff41;
    vertical-align: text-bottom;
    animation: terminalBlink 1s step-end infinite;
    margin-left: 2px;
}
@keyframes terminalBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.typing-dot.paused { animation-play-state: paused !important; opacity: 0.5; transform: scale(0); }


.ai-guide-input-wrapper.limit-reached {
    border-color: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
}
.ai-guide-limit-tooltip {
    position: absolute;
    right: 10px;
    top: -30px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(10px);
    z-index: 1000;
}
.ai-guide-limit-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.chat-msg p {
    margin-bottom: 0.75em;
    text-align: left;
}
.ai-markdown-content {
    text-align: left;
}
.chat-msg p:last-child {
    margin-bottom: 0;
}
.chat-msg ul, .chat-msg ol {
    margin-bottom: 0.35em;
    padding-left: 18px;
    list-style: disc;
}
.chat-msg li {
    margin-bottom: 0.2em;
}

.ai-md-a, .ai-md-code {
    display: inline-block;
    word-break: break-all;
    max-width: 100%;
}
.ai-md-quote {
    border-left: 3px solid var(--ai-primary, #00ddeb);
    padding-left: 12px;
    margin: 8px 0;
    font-style: italic;
    color: #cbd5e1;
}

.ai-markdown-content pre, .ai-markdown-content code {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: clamp(0.7rem, 1.5vw, 0.85em);
}

/* AI Markdown Tables */
.ai-guide-chat table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: clamp(0.7rem, 2vw, 0.95em);
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    word-break: break-word;
}
.ai-guide-chat th {
    background: rgba(var(--ai-primary-rgb, 0, 221, 235), 0.15);
    color: var(--ai-primary, #00ddeb);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    white-space: normal;
    border-bottom: 1px solid rgba(var(--ai-primary-rgb, 0, 221, 235), 0.3);
}
.ai-guide-chat td {
    padding: 8px 10px;
    font-size: 0.95em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    vertical-align: top;
}
.ai-guide-chat tr:last-child td {
    border-bottom: none;
}