/* Chat Area Styles */

/* Main Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

.chat-header {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chat-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
    max-height: calc(100vh - 200px);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.2);
    border-radius: 4px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

/* Thinking indicator styles */
.thinking-indicator {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.thinking-bubble {
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.thinking-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: thinking-bounce 1.4s infinite ease-in-out;
}

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

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

.thinking-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: white;
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.message-content {
    flex: 1;
}

.message-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.message.user .message-bubble {
    background: var(--bg-tertiary);
}

/* Audit Report & Structured Response Styling */
.message-bubble h2 {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.message-bubble h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 16px 0 8px 0;
    color: var(--accent-secondary);
}

.message-bubble p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-bubble ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: none;
}

.message-bubble ul li {
    margin: 4px 0;
    padding: 4px 0;
    line-height: 1.5;
    position: relative;
}

.message-bubble ul li::before {
    content: "";
}

.message-bubble strong {
    color: var(--text-primary);
    font-weight: 600;
}

.message-bubble em {
    color: var(--text-secondary);
    font-style: italic;
}

.message-bubble code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-primary);
}

.message-bubble hr {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.message-bubble .audit-report {
    max-width: 100%;
}

.message-bubble .health-score {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
    padding-left: 4px;
}

/* Input Area */
.chat-input-container {
    padding: 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.chat-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.send-button:active {
    transform: scale(0.95);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.quick-action {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
    transform: translateY(-1px);
}