.intelligence-page {
    margin: -2.5rem;
    height: 100vh;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

@media (max-width: 768px) {
    .intelligence-page {
        margin: -1.25rem;
        height: calc(100vh - 60px);
    }
}

.intelligence-layout {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.chat-thread-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 3rem 4rem 2rem 4rem;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .chat-thread-container {
        padding: 1.5rem 1rem;
    }
}

/* Custom Scrollbars */
.chat-thread-container::-webkit-scrollbar {
    width: 6px;
}
.chat-thread-container::-webkit-scrollbar-track {
    background: transparent;
}
.chat-thread-container::-webkit-scrollbar-thumb {
    background: var(--accent-glow);
    border-radius: 4px;
}
.chat-thread-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.chat-bubbles-scroll {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* State 1: Initial Empty Screen */
.welcome-state {
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    margin-bottom: auto;
    animation: fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.welcome-icon {
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 15px rgba(139, 130, 115, 0.15));
}

.welcome-prompt {
    font-family: var(--nexus-font-sans, inherit);
    color: var(--text-main);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* Input Controls */
.chat-input-controls {
    padding: 1.5rem 4rem 3rem 4rem;
    background: linear-gradient(to top, var(--bg-base) 70%, transparent);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .chat-input-controls {
        padding: 1rem 1rem 1.5rem 1rem;
    }
}

.input-panel-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.scope-bar {
    display: flex;
    align-items: center;
}

.scope-selector {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.nexus-select {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.825rem;
    transition: all 0.25s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8273' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.85em;
}

.nexus-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.input-field-group {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.4rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.input-field-group:focus-within {
    border-color: var(--accent);
    background: var(--bg-surface);
    box-shadow: 0 10px 35px var(--accent-glow);
}

.nexus-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.975rem;
    outline: none;
    padding: 0.5rem 1rem;
}

.nexus-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--accent);
    border: none;
    color: var(--bg-surface);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-btn:hover:not(:disabled) {
    background: var(--accent);
    opacity: 0.9;
    transform: scale(1.02);
}

.search-btn:disabled {
    background: var(--bg-base);
    color: var(--text-muted);
    opacity: 0.4;
    border: 1px solid var(--border);
    cursor: not-allowed;
}

/* Typing / Loading Indicators */
.message-bubble.pending-bubble {
    border-color: var(--accent-glow);
    background: var(--accent-glow);
    max-width: 450px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 0.6rem;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

.loading-label {
    font-size: 0.825rem;
    color: var(--text-muted);
    font-style: italic;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-in-up {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes typing-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   LIGHT THEME OVERRIDES — "Warm Paper / Soft Sepia"
   ============================================================ */

.theme-light .welcome-prompt {
    color: var(--text-main);
}

.theme-light .welcome-icon svg {
    stroke: var(--text-muted);
}

.theme-light .welcome-icon svg circle {
    fill: var(--text-muted);
}

.theme-light .welcome-icon svg path[stroke^="rgba(139"] {
    stroke: rgba(120, 113, 108, 0.4);
}

.theme-light .welcome-icon svg path[stroke^="rgba(139"][stroke-dasharray] {
    stroke: rgba(120, 113, 108, 0.3);
}

.theme-light .input-field-group {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(139, 130, 115, 0.08);
}

.theme-light .input-field-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 10px 35px rgba(16, 185, 129, 0.15);
}

.theme-light .nexus-input {
    color: var(--text-main);
}

.theme-light .nexus-input::placeholder {
    color: var(--text-muted);
}

.theme-light .nexus-select {
    background-color: var(--bg-surface);
    border-color: var(--border);
    color: var(--text-main);
}

.theme-light .nexus-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.theme-light .chat-thread-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .chat-thread-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

