*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827; /* neutral-900 */
  background-color: #f3f4f6; /* neutral-100 */
}

/* Für bessere Lesbarkeit von Text */
body {
  -webkit-font-smoothing: antialiased;
}

/* Links (falls später benötigt) */
a {
  color: inherit;
  text-decoration: none;
}

:root {
  --color-bg: #f3f4f6;
  --color-surface: #ffffff;
  --color-surface-alt: #f9fafb;

  --color-border-subtle: #e5e7eb;
  --color-border-strong: #d1d5db;

  --color-text-main: #111827;
  --color-text-muted: #6b7280;
  --color-text-soft: #9ca3af;

  --color-primary: #004F9D;
  --color-primary-soft: #E0ECF7;
  --color-primary-strong: #003467;

  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
}

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

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
}

/* Topbar / App-Header */

.app-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
    background: linear-gradient(90deg, #ffffff 0%, #f9fafb 40%, #E6EEF7 100%);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.app-header_brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-header_logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  font-size: 0.85rem;
  font-weight: 600;
}

.app-header_titles {
  display: flex;
  flex-direction: column;
}

.app-header_title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app-header_subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.app-header_meta {
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.app-header_nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 2rem;
  margin-right: auto;
}

.app-header_nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  background-color: transparent;
}

.app-header_nav-link:hover {
  background-color: var(--color-primary-soft);
  color: var(--color-primary-strong);
  cursor: pointer;
}

.app-header_nav-link.active {
  background-color: var(--color-primary);
  color: #ffffff;
}

/* Hauptlayout: Sidebar + Chat */

.app-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0; /* wichtig für flex + overflow */
}

/* ===========
   Sidebar (Chat-Übersicht)
   =========== */

.app-content_sidebar {
  width: 280px;
  border-right: 1px solid var(--color-border-subtle);
  background-color: #f9fafb;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.75rem;
  flex: 0 0 280px;
}

.sidebar_section {
  padding: 0.25rem 0.25rem;
}

.sidebar_section_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar_section_title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-soft);
}

.sidebar_newchat {
  font-size: 0.8rem;
  padding-inline: 0.7rem;
  white-space: nowrap;
}

.sidebar_section-search {
  padding-top: 0;
}

.sidebar_section-search--input {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  background-color: #ffffff;
  color: var(--color-text-main);
  outline: none;
}

.sidebar_section-search--input::placeholder {
  color: var(--color-text-soft);
}

.sidebar_section-search--input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
}

/* Chatliste */

.sidebar_section-list {
  flex: 1 1 auto;
  min-height: 0;
}

#sidebar_chatlist {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 0.1rem;
}

.sidebar_section-list--item {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  background-color: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.list--item---title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--color-text-main);
}

.list--item---meta {
  font-size: 0.76rem;
  color: var(--color-text-soft);
}

.sidebar_section-list--item:hover {
  background-color: #e5e7eb;
  border-color: var(--color-border-subtle);
}

.sidebar_section-list--item.active {
  background-color: #E6EEF7;
  border-color: #B2C8E0;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.05);
}

/* ===========
   Chat-Bereich
   =========== */

.app-content_main_chat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 1rem 1.25rem;
  gap: 0.75rem;
}

/* Chat-Header */

.main_chat_header {
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: 0.6rem;
}

.main_chat_header-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.main_chat_header-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* Nachrichtenverlauf */

.main_chat_messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0.2rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Nachrichten */

.chat_messages-message {
  max-width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.chat_messages-message.ai {
  align-self: flex-start;
}

.chat_messages-message.user {
  align-self: flex-end;
}

.message__meta {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--color-text-soft);
}

.message--user .message__meta {
  justify-content: flex-end;
}

.message__author {
  font-weight: 500;
  color: var(--color-text-muted);
}

.message__time {
  font-variant-numeric: tabular-nums;
}

/* Bubbles */

.messages-message--bubble {
  padding: 0.6rem 0.8rem;
  border-radius: 0.9rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.03);
  font-size: 0.9rem;
  line-height: 1.4;
}

.messages-message--bubble p {
  margin: 0.1rem 0;
}

.chat_messages-message.ai .messages-message--bubble {
  background-color: #ffffff;
}

.chat_messages-message.user .messages-message--bubble {
  background: linear-gradient(135deg, #004F9D, #003467);
  border-color: transparent;
  color: #ffffff;
}

/* ===========
   Eingabebereich
   =========== */

.main_chat_input {
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 0.6rem;
  margin-top: 0.15rem;
}

.main_chat_input-form {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.input-form--field {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.input-form-field---label {
  font-size: 0.78rem;
  color: var(--color-text-soft);
}

.input-form--field---textarea {
  width: 100%;
  max-height: 160px;
  min-height: 40px;
  resize: vertical;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  outline: none;
  background-color: var(--color-surface);
}

.input-form--field---textarea::placeholder {
  color: var(--color-text-soft);
}

.input-form--field---textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
}

.input-form--send {
    height: 100%;               /* gleiche Höhe wie Textarea */
    align-self: flex-end;       /* Button unten ausrichten */
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===========
   Buttons
   =========== */

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background-color: #e5e7eb;
  color: #111827;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
}

.btn:hover {
  background-color: #d1d5db;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn--primary:hover {
  background-color: var(--color-primary-strong);
  box-shadow: 0 8px 18px rgba(0, 79, 157, 0.25);
}