/* ============================================
   VF Copilot - Chat UI Styles
   ============================================ */

:root {
    /* Colors - Dark theme with teal accent */
    --bg-primary: #0a0f14;
    --bg-secondary: #111921;
    --bg-tertiary: #1a242e;
    --bg-hover: #243040;
    
    --text-primary: #e8eef4;
    --text-secondary: #8b9db0;
    --text-muted: #5a6a7a;
    
    --accent: #14b8a6;
    --accent-hover: #0d9488;
    --accent-subtle: rgba(20, 184, 166, 0.15);
    
    --border: #2a3a4a;
    --border-light: #1e2e3e;
    
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    
    /* Typography */
    --font-sans: 'Space Grotesk', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --sidebar-width: 280px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
    color: var(--accent);
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.sidebar-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.config-item {
    margin-bottom: 12px;
}

.config-item:last-child {
    margin-bottom: 0;
}

.config-item label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.config-item input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: border-color var(--transition-fast);
}

.config-item input:focus {
    outline: none;
    border-color: var(--accent);
}

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

.session-info {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
}

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

.info-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
}

.session-id-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.session-id-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.session-id-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    background: var(--bg-primary);
    padding: 6px 10px;
    border-radius: 4px;
    flex: 1;
    word-break: break-all;
    user-select: all;
    cursor: text;
}

.copy-btn {
    background: var(--bg-hover);
    border: none;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.copy-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.status-badge {
    padding: 2px 8px;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 4px;
    font-weight: 500;
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.status-badge.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon {
    font-size: 14px;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ============================================
   Chat Container
   ============================================ */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

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

.header-title h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

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

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.connection-status.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.connection-status.disconnected .status-dot {
    background: var(--error);
}

/* ============================================
   Chat Messages
   ============================================ */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    text-align: center;
    padding: 40px 24px;
    max-width: 900px;
    margin: auto;
}

.welcome-icon {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 16px;
}

.welcome-message h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Welcome Content Layout - Side by Side */
.welcome-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    text-align: left;
    margin-top: 24px;
}

.welcome-column h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Agent Capabilities */
.agent-capabilities {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.capability-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.capability-group:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.capability-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.capability-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.capability-info strong {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.capability-info span {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
}

@media (max-width: 768px) {
    .welcome-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.example-queries {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.example-query {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.example-query:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.message.assistant .message-avatar {
    background: var(--accent-subtle);
    color: var(--accent);
}

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

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.message.assistant .message-content {
    background: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: var(--accent);
    color: #000;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin-bottom: 8px;
}

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

.message-content strong {
    font-weight: 600;
}

.message-content code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-content pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* Tables in messages */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 12px;
}

.message-content th,
.message-content td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.message-content th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
}

.message-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.message-meta .agents {
    display: flex;
    gap: 4px;
}

.agent-tag {
    padding: 2px 6px;
    background: var(--bg-hover);
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* Loading indicator */
.message.loading .message-content {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    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);
        opacity: 1;
    }
}

/* ============================================
   Chat Input
   ============================================ */

.chat-input-container {
    padding: 16px 24px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.clarification-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--warning);
}

.clarification-banner.visible {
    display: flex;
}

.clarification-icon {
    font-weight: 600;
}

.chat-input-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 8px 8px 16px;
    transition: border-color var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    padding: 8px 0;
}

.input-wrapper textarea:focus {
    outline: none;
}

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

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-hover);
}

.send-btn:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

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

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

.input-hint kbd {
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left var(--transition-normal);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .message {
        max-width: 95%;
    }
}

