/* WissensBot - Vollständiges CSS mit 4K Support */

:root {
  --bg-primary: #0b1020;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --border-color: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --sidebar-width: 280px;
  --header-height: 64px;
  --input-height: 80px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
}

/* Layout Grid */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Global Logo */
.global-logo {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.global-logo:hover {
  opacity: 1;
}

.global-logo img {
  height: 50px;
  width: auto;
}

/* Sidebar */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.sidebar-button {
  background: var(--accent);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.sidebar-button:hover {
  background: var(--accent-hover);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

/* App Wrapper */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* App Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.app-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 16px;
}

.status {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.timer {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.header-button {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s;
}

.header-button:hover {
  background: var(--border-color);
}

.header-button.secondary {
  background: transparent;
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Messages */
.message {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

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

.message-content {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.message.user .message-content {
  background: var(--accent);
  border-color: var(--accent);
}

.message-content p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Chat Input */
.chat-input-row {
  height: var(--input-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}

#question-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#question-input:focus {
  border-color: var(--accent);
}

#question-input::placeholder {
  color: var(--text-secondary);
}

#send-button, #stop-button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#send-button:hover {
  background: var(--accent-hover);
}

#stop-button {
  background: #dc2626;
}

#stop-button:hover {
  background: #b91c1c;
}

/* Sources Sidebar */
.sources-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  z-index: 50;
}

.sources-sidebar.open {
  display: flex;
}

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

.sources-header h2 {
  font-size: 1.1rem;
}

.sources-status {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sources-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.sources-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.sources-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.sources-toolbar-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.875rem;
}

.sources-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.source-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.source-item label {
  flex: 1;
  cursor: pointer;
}

.sources-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sources-footer-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sources-apply-btn {
  background: var(--accent);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

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

/* 4K / High-Resolution Support */
@media (min-width: 2560px) {
  :root {
    --sidebar-width: 320px;
    --header-height: 72px;
    --input-height: 88px;
  }
  
  html {
    font-size: 18px;
  }
  
  .global-logo img {
    height: 60px;
  }
}

/* Mobile / Tablet */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
  
  .sources-sidebar {
    width: 100%;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

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