/* Navbar AI Button */
.nav-ai-btn {
    background: #66d9ef;
    color: #000;
    padding: 8px 20px;
    border: 3px solid #000;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 3px 3px 0px #000;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: breathing 3s ease-in-out infinite;
}

.nav-ai-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px #000;
    background: #a8e6cf;
}

.nav-ai-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000;
}

@keyframes breathing {
    0% {
        box-shadow: 3px 3px 0px #000;
        transform: scale(1);
    }
    50% {
        box-shadow: 5px 5px 15px rgba(102, 217, 239, 0.4);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 3px 3px 0px #000;
        transform: scale(1);
    }
}

/* AI Chat Widget */
.ai-chat-widget {
    position: fixed;
    bottom: 110px;
    right: 100px;
    width: 380px;
    height: 520px;
    background: var(--bg-card, #ffffff);
    border: 3px solid #000;
    border-radius: 12px;
    box-shadow: 6px 6px 0px #000;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif;
}

html.dark-theme .ai-chat-widget {
    background: #1a1a2e;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.8);
    border: 3px solid #333;
}

html.dark-theme .ai-chat-widget {
    border: 3px solid #66d9ef;
    box-shadow: 6px 6px 0px #66d9ef;
}

.ai-chat-widget.fullscreen {
    width: 90vw;
    height: 90vh;
    bottom: 5vh;
    right: 5vw;
    max-width: 1200px;
}

.ai-chat-widget.hidden {
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    pointer-events: none;
}

.ai-chat-header {
    padding: 15px;
    background: #ffd93d;
    border-bottom: 3px solid #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #000;
    font-weight: bold;
}

html.dark-theme .ai-chat-header {
    background: #ffd93d;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.ai-chat-actions {
    display: flex;
    gap: 10px;
}

.ai-chat-header-btn {
    background: transparent;
    border: 2px solid transparent;
    font-size: 20px;
    cursor: pointer;
    color: #000;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: all 0.2s;
}

.ai-chat-header-btn:hover {
    background: rgba(0,0,0,0.1);
    border-color: #000;
}

html.dark-theme .ai-chat-header-btn {
    color: #000;
}

.ai-agent-selector {
    display: flex;
    border-bottom: 3px solid #000;
    background: #f4f4f4;
}

html.dark-theme .ai-agent-selector {
    background: #2a2a3e;
    border-bottom-color: #66d9ef;
}

.agent-btn {
    flex: 1;
    padding: 10px 5px;
    background: transparent;
    border: none;
    border-right: 3px solid #000;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    color: #000;
    font-family: inherit;
}

html.dark-theme .agent-btn {
    color: #fff;
    border-right-color: #66d9ef;
}

.agent-btn:last-child {
    border-right: none;
}

.agent-btn.active {
    background: #a8e6cf;
}

html.dark-theme .agent-btn.active {
    background: #164e63;
    color: #a8e6cf;
}

.ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card, #fff);
}

html.dark-theme .ai-chat-messages {
    background: #1a1a2e;
}

.ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 2px solid #000;
    position: relative;
    word-wrap: break-word;
}

/* Markdown typography inside AI messages */
.ai-msg p {
    margin: 0 0 10px 0;
}
.ai-msg p:last-child {
    margin: 0;
}

.ai-msg ul, .ai-msg ol {
    margin: 0 0 10px 0;
    padding-left: 20px;
}

.ai-msg pre {
    background: #2d2b55; /* modern dark bg */
    color: #f8f8f2;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    border: 2px solid #000;
    margin: 10px 0;
}

.ai-msg code {
    background: rgba(0,0,0,0.08);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85em;
    color: #c53030;
}

html.dark-theme .ai-msg code {
    background: rgba(255,255,255,0.15);
    color: #ffb86c;
}

.ai-msg pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
    color: inherit;
}

/* Green Highlight for Important Contents (Bold Text) */
.ai-msg strong {
    color: #059669; /* Emerald Green */
    font-weight: 700;
    background: rgba(16, 185, 129, 0.15);
    padding: 0 4px;
    border-radius: 3px;
}

html.dark-theme .ai-msg strong {
    color: #4ade80; /* Bright Green */
    background: rgba(74, 222, 128, 0.15);
}

html.dark-theme .ai-msg {
    border-color: #444;
}

.assistant-msg {
    align-self: flex-start;
    background: #f0f0f0;
    border-bottom-left-radius: 0;
    color: #000;
}

html.dark-theme .assistant-msg {
    background: #2a2a3e;
    color: #e0e0e0;
}

.user-msg {
    align-self: flex-end;
    background: #66d9ef;
    color: #000;
    border-bottom-right-radius: 0;
}

html.dark-theme .user-msg {
    background: #66d9ef;
    color: #000;
    border-color: #000;
}

.ai-chat-input-container {
    display: flex;
    padding: 10px;
    border-top: 3px solid #000;
    background: #fff;
    gap: 10px;
}

html.dark-theme .ai-chat-input-container {
    background: #1a1a2e;
    border-top-color: #66d9ef;
}

.ai-file-preview {
    padding: 8px 15px;
    background: #e2f0cb;
    border-top: 3px solid #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #000;
}

html.dark-theme .ai-file-preview {
    background: #2a2a3e;
    color: #fff;
    border-top-color: #66d9ef;
}

.ai-file-preview.hidden {
    display: none;
}

.ai-file-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: #dc2626;
}

.ai-chat-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #f4f4f4;
    border: 2px solid #000;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    color: #000;
    transition: all 0.2s;
}

.ai-chat-file-label:hover {
    background: #e0e0e0;
}

html.dark-theme .ai-chat-file-label {
    background: #2a2a3e;
    color: #fff;
    border-color: #444;
}
html.dark-theme .ai-chat-file-label:hover {
    background: #444;
}

#ai-chat-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #000;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
    background: #fff;
    color: #000;
    font-size: 0.95rem;
}

html.dark-theme #ai-chat-input {
    background: #2a2a3e;
    color: #fff;
    border-color: #444;
}

#ai-chat-input:focus {
    border-color: #667eea;
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    background: #ffd93d;
    border: 2px solid #000;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    color: #000;
}

.ai-chat-send-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 2px 2px 0px #000;
}

.ai-chat-send-btn:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

html.dark-theme .ai-chat-send-btn {
    background: #66d9ef;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 100%;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #000;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

html.dark-theme .typing-dot {
    background: #fff;
}

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

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

@media (max-width: 768px) {
    .ai-chat-widget {
        right: 15px;
        left: 15px;
        bottom: 80px;
        width: auto;
    }
}
