/* AI Command Deck - Modern UI Styles */

:root {
    --zinc-50: #fafafa;
    --zinc-100: #f4f4f5;
    --zinc-200: #e4e4e7;
    --zinc-300: #d4d4d8;
    --zinc-400: #a1a1aa;
    --zinc-500: #71717a;
    --zinc-600: #52525b;
    --zinc-700: #3f3f46;
    --zinc-800: #27272a;
    --zinc-900: #18181b;
    --zinc-950: #09090b;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
}

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--zinc-800);
    border-radius: 20px;
    border: 3px solid var(--zinc-950);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--zinc-700);
}

/* Sidebar behavior */
#sidebar.collapsed {
    width: 0 !important;
    border-right: none;
}

/* Typing Indicator (Google Style) */
.typing-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--zinc-900);
    border: 1px solid var(--zinc-800);
    border-radius: 12px;
    width: fit-content;
    margin-bottom: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--zinc-600);
    border-radius: 50%;
    animation: google-pulse 1.4s infinite ease-in-out;
    opacity: 0.6;
}

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

@keyframes google-pulse {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
    40% { transform: translateY(-5px); opacity: 1; background: var(--blue-500); }
}

/* Message Styles */
.chat-message {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message {
    padding-left: 1rem;
    border-left: 2px solid var(--zinc-800);
}

.user-message {
    align-items: flex-end;
}

.user-bubble {
    background-color: var(--zinc-900);
    border: 1px solid var(--zinc-800);
    padding: 0.75rem 1.25rem;
    border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
    max-width: 85%;
    font-size: 1rem;
    color: var(--zinc-100);
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 768px) {
    .user-bubble {
        font-size: 1.05rem;
    }
}

/* Content Formatting */
.ai-content {
    color: var(--zinc-200);
    font-size: 1rem;
    line-height: 1.65;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .ai-content {
        font-size: 1.05rem;
    }
}

.ai-content p {
    margin-bottom: 1rem;
}

.ai-content p:last-child {
    margin-bottom: 0;
}

.ai-content code:not(pre code) {
    background-color: var(--zinc-800);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--zinc-100);
}

.ai-content pre {
    background-color: #0d0d0f !important;
    border: 1px solid var(--zinc-800);
    border-radius: 0.5rem;
    margin: 1rem 0;
    padding: 1rem;
    position: relative;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
}

.ai-content pre code {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.85rem !important;
    background: transparent !important;
    padding: 0 !important;
}

@media (min-width: 768px) {
    .ai-content pre code {
        font-size: 0.95rem !important;
    }
}

/* Streaming specific */
.streaming-cursor::after {
    content: "█";
    animation: blink 1s step-start infinite;
    margin-left: 2px;
    font-size: 0.8em;
    color: var(--blue-600);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Switch UI */
.switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--zinc-800);
    transition: .3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: var(--zinc-400);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--blue-600);
}

input:checked + .slider:before {
    transform: translateX(12px);
    background-color: white;
}

/* Utilities */
.scrollbar-none::-webkit-scrollbar {
    display: none;
}

.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Markdown Fixes */
.ai-content ul, .ai-content * ul {
    margin-bottom: 1rem !important;
    padding-left: 1.5rem !important;
    list-style-type: disc !important;
}

.ai-content ol, .ai-content * ol {
    margin-bottom: 1rem !important;
    padding-left: 1.5rem !important;
    list-style-type: decimal !important;
}

.ai-content li, .ai-content * li {
    margin-bottom: 0.5rem !important;
    display: list-item !important;
}

/* KaTeX specific */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
    max-width: 100%;
}
.katex {
    font-size: 1.1em;
}

.ai-content hr {
    border: 0;
    border-top: 1px solid var(--zinc-800);
    margin: 1.5rem 0;
}

.ai-content h1, .ai-content h2, .ai-content h3 {
    color: white;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.ai-content h1 { font-size: 1.25rem; }
.ai-content h2 { font-size: 1.1rem; }
.ai-content h3 { font-size: 1rem; }

/* Modal Animations */
#modal-content.modal-show {
    transform: scale(1);
    opacity: 1;
}

/* File Tree Styles */
.tree-node {
    display: flex;
    flex-direction: column;
}
.tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--zinc-400);
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
}
.tree-item:hover {
    background-color: var(--zinc-800);
    color: var(--zinc-100);
}
.tree-folder {
    font-weight: 500;
}
.tree-folder.open {
    color: var(--blue-500);
}
.tree-children {
    display: none;
    margin-left: 1.2rem;
    border-left: 1px solid var(--zinc-800);
}
.tree-children.open {
    display: block;
}

/* Context Menu Styles */
#sidebar-context-menu {
    min-width: 150px;
}
#sidebar-context-menu button {
    white-space: nowrap;
}

/* Voice Recording Styles */
.recording-active {
    background-color: rgba(239, 68, 68, 0.1) !important; /* light red bg */
    border-color: rgba(239, 68, 68, 0.5) !important;
    animation: mic-pulse 1.5s infinite ease-in-out;
}

@keyframes mic-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Wikipedia Card Styles */
.wiki-card {
    background: var(--zinc-900);
    border: 1px solid var(--zinc-800);
    border-radius: 1rem;
    padding: 1.25rem;
    margin: 1rem 0;
    max-width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.wiki-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.wiki-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--zinc-50);
    text-decoration: none;
    line-height: 1.2;
}

.wiki-title:hover {
    color: var(--blue-500);
}

.wiki-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    flex-shrink: 0;
    background: var(--zinc-800);
}

.wiki-extract {
    font-size: 0.95rem;
    color: var(--zinc-300);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wiki-footer {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wiki-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--zinc-800);
    color: var(--zinc-200);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}

.wiki-link-btn:hover {
    background: var(--zinc-700);
    color: white;
}

.wiki-full-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--zinc-800);
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.95rem;
    color: var(--zinc-300);
}

.wiki-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--zinc-100);
    margin: 1.5rem 0 0.75rem 0;
}

.wiki-section-content {
    margin-bottom: 1rem;
}

.wiki-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--blue-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.wiki-expand-btn:hover {
    background: var(--blue-500);
}
