/**
 * AI Intelligence Page Styles
 * Chat-like interface for natural language queries
 */

/* ========================================
   INTELLIGENCE PAGE LAYOUT
   ======================================== */

.intelligence-page-view {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.intelligence-section {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 4rem;
}

.intelligence-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
}

/* ========================================
   HEADER
   ======================================== */

.intelligence-header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.intelligence-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.intelligence-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ========================================
   EXAMPLE PROMPTS
   ======================================== */

.intelligence-examples {
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.intelligence-examples h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
}

.example-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.example-prompt-btn {
    padding: 0.875rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-prompt-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.example-prompt-btn:active {
    transform: translateY(0);
}

/* ========================================
   CONVERSATION AREA
   ======================================== */

.intelligence-conversation {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.intelligence-conversation:empty::before {
    content: 'No messages yet. Ask a question to get started!';
    display: block;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
}

/* ========================================
   MESSAGES
   ======================================== */

.intelligence-message {
    display: flex;
    gap: 1rem;
    animation: messageSlideIn 0.3s ease;
}

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

.message-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-avatar svg {
    width: 20px;
    height: 20px;
}

.user-avatar {
    background: var(--accent-primary);
    color: white;
}

.assistant-avatar {
    background: var(--success);
    color: white;
}

.error-avatar {
    background: var(--danger);
    color: white;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.intelligence-message-user .message-text {
    background: var(--accent-primary);
    color: white;
    margin-left: auto;
    max-width: 80%;
}

.intelligence-message-assistant .message-text {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    max-width: 90%;
}

.intelligence-message-error .message-text {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
    max-width: 90%;
}

/* Markdown formatting in messages */
.message-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-text em {
    font-style: italic;
}

.message-text code {
    padding: 0.125rem 0.375rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

/* ========================================
   LOADING STATE
   ======================================== */

.message-loading {
    display: flex;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: loadingBounce 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ========================================
   INPUT AREA
   ======================================== */

.intelligence-input-container {
    flex-shrink: 0;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.intelligence-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.intelligence-textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    transition: border-color 0.2s ease;
}

.intelligence-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.intelligence-textarea::placeholder {
    color: var(--text-muted);
}

.intelligence-send-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.intelligence-send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.intelligence-send-btn:active:not(:disabled) {
    transform: translateY(0);
}

.intelligence-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.intelligence-send-btn svg {
    width: 20px;
    height: 20px;
}

.intelligence-send-btn.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.intelligence-input-hint {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
}

.intelligence-input-hint kbd {
    padding: 0.125rem 0.375rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75rem;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .intelligence-container {
        padding: 1rem;
    }
    
    .intelligence-title {
        font-size: 1.5rem;
    }
    
    .example-prompts {
        grid-template-columns: 1fr;
    }
    
    .intelligence-message-user .message-text {
        max-width: 85%;
    }
    
    .intelligence-message-assistant .message-text {
        max-width: 95%;
    }
}
