:root {
  --sidebar-width: 280px;
  --main-bg: #19191d;
  --sidebar-bg: linear-gradient(145deg, #23222a 60%, #292830 100%);
  --accent: #ffd580;
  --accent-glow: #ffedb8;
  --bot-bg: linear-gradient(120deg, #222127 80%, #292830 100%);
  --user-bg: linear-gradient(90deg, #23282e 80%, #35333c 100%);
  --chat-scrollbar: #39373f;
  --input-bg: #23222a;
  --border-radius: 24px;
  --shadow: 0 6px 32px #0006, 0 0px 0px #0000;
  --font-main: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* General */
body {
  font-family: var(--font-main);
  background: var(--main-bg);
  color: #f8f8f8;
  min-height: 100vh;
  letter-spacing: 0.01em;
}

.layout {
  display: flex;
  height: 100vh;
  gap: 2.5rem;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-radius: var(--border-radius);
  margin: 2.5rem 0 2.5rem 2.5rem;
  padding: 1.5rem 1.2rem 1.2rem 1.2rem;
  box-shadow: var(--shadow);
  border: 1.5px solid #35333c;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 180px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Login oben links */
.sidebar-login {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.sidebar-login .user-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: #23222a;
  border-radius: 999px;
  padding: 0.3em 1em;
  border: 1px solid #28262c;
}
#user-avatar-sidebar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: #fff;
}
#username-sidebar {
  font-size: 1rem;
  color: #fff7e0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
#login-btn-sidebar, #logout-btn-sidebar {
  margin-top: 0.3em;
  margin-bottom: 0.1em;
}

/* About Fall AI Bereich */
.sidebar-about h2 {
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.7em;
  background: linear-gradient(90deg, #ffd580 70%, #ffedb8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-about ul {
  color: #e0e0e0;
  font-size: 1.01rem;
  gap: 1em;
  padding-left: 1em;
  opacity: 0.96;
  border-top: 1px solid #292830;
  padding-top: 0.6em;
  margin-bottom: 0.5em;
}
.sidebar-about li {
  margin-bottom: 0.5em;
  padding-left: 0.2em;
  letter-spacing: 0.01em;
}
.sidebar-about li b, .sidebar-about li i {
  color: var(--accent);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 2.5rem 2.5rem 2.5rem 0;
  gap: 2.5rem;
  border-left: 1.5px solid #292830;
}

/* Header */
header {
  background: var(--sidebar-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 2rem 1.1rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1.5px solid #35333c;
}
header h1 {
  font-size: 2.1rem;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0;
  background: linear-gradient(90deg, #ffd580 70%, #ffedb8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* User Info im Header */
.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #23222a;
  border-radius: 999px;
  padding: 0.3em 1em;
  border: 1px solid #28262c;
}
#user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: #fff;
  margin-left: 0.2rem;
}
#username {
  font-size: 1rem;
  color: #fff7e0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* Auth/Action Buttons */
.plain-auth-btn, #file-btn, footer button {
  background: linear-gradient(90deg, #35333c 0%, #292830 100%);
  color: var(--accent);
  border: 1.5px solid #39373f;
  border-radius: 999px;
  padding: 0.5em 1.3em;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.18s, color 0.18s, border 0.18s;
  margin: 0 0.2em;
  outline: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.plain-auth-btn:hover, #file-btn:hover, footer button:hover {
  background: linear-gradient(90deg, #292830 0%, #35333c 100%);
  color: #ffd580;
  border-color: var(--accent);
}
.plain-auth-btn:active, #file-btn:active, footer button:active {
  background: #18171c;
  color: #ffd580;
  border-color: #ffd580;
}

/* File Preview (above textarea) */
#file-preview {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-right: 0.5em;
  margin-bottom: 0.1em;
  min-width: 0;
  max-width: 250px;
}
.file-preview-block {
  display: flex;
  align-items: center;
  gap: 0.4em;
  background: #23222a;
  border: 1.5px solid #35333c;
  border-radius: 999px;
  padding: 0.18em 0.7em;
  min-width: 0;
  max-width: 250px;
  overflow: hidden;
}
.file-preview-block .file-preview-filename {
  color: var(--accent);
  font-size: 0.95em;
  max-width: 110px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.file-preview-block .file-preview-remove {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  margin-left: 0.15em;
  font-size: 1.08em;
  padding: 0.15em;
  border-radius: 4px;
  transition: background 0.13s;
}
.file-preview-block .file-preview-remove:hover {
  background: #2e2e2e;
  color: var(--accent);
}

/* File Block (in chat) - compact */
.file-block {
  background: #23222a;
  border: 1.5px solid #35333c;
  border-radius: 10px;
  padding: 0.28em 0.45em;
  margin: 0.2em 0;
  display: flex;
  flex-direction: column;
  gap: 0.09em;
  position: relative;
  word-break: break-all;
}
.file-block .file-header {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.89em;
  color: var(--accent);
  margin-bottom: 0.07em;
}
.file-block .file-content {
  background: #18171c;
  border-radius: 5px;
  padding: 0.18em 0.35em;
  font-family: "Fira Mono", "Consolas", monospace;
  color: #ffd580;
  font-size: 0.89em;
  white-space: pre-wrap;
  overflow-x: auto;
  margin-bottom: 0.07em;
}
.file-block .copy-btn {
  align-self: flex-end;
  background: #23222a;
  color: var(--accent);
  border: 1px solid #35333c;
  border-radius: 6px;
  font-size: 0.78em;
  padding: 0.11em 0.7em;
  cursor: pointer;
  margin-top: 0.07em;
  transition: background 0.12s;
}
.file-block .copy-btn:hover {
  background: #35333c;
  color: #ffd580;
}

/* Markdown support */
.message strong, .file-content strong { font-weight: bold; }
.message em, .file-content em { font-style: italic; }
.message code, .file-content code {
  background: #18171c;
  color: #ffd580;
  border-radius: 3px;
  padding: 2px 5px;
  font-family: "Fira Mono", "Consolas", monospace;
}
.message a, .file-content a { color: #ffd580; text-decoration: underline; }
pre, .file-content pre {
  background: #18171c;
  color: #ffd580;
  border-radius: 5px;
  padding: 0.18em 0.35em;
  font-family: "Fira Mono", "Consolas", monospace;
  font-size: 0.84em;
  white-space: pre-wrap;
  overflow-x: auto;
  margin-bottom: 0.07em;
}

/* Chat Area – größer */
.chat-area {
  flex: 1;
  background: var(--bot-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.2rem 2rem 2.2rem;
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-scrollbar) transparent;
}
.chat-area::-webkit-scrollbar {
  width: 10px;
}
.chat-area::-webkit-scrollbar-thumb {
  background: var(--chat-scrollbar);
  border-radius: 7px;
}
.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

/* Chat Bubble – höher & komfortabler */
.message {
  padding: 1.3rem 2rem;
  border-radius: 1.7rem;
  background: rgba(34,33,39,0.95);
  font-size: 1.18rem;
  margin-bottom: 0.7rem;
  box-shadow: 0 2px 12px #0003;
  border: 1.5px solid #35333c;
  max-width: 78%;
  transition: background 0.18s;
  line-height: 1.6;
}
.message.user {
  background: var(--user-bg);
  margin-left: auto;
  border: 1.5px solid var(--accent);
  box-shadow: 0 2px 18px #ffd58022;
}
.message.bot {
  background: var(--bot-bg);
  margin-right: auto;
}

.typing-animation {
  font-style: italic;
  opacity: 0.7;
}
.typing-animation::after {
  content: '...';
  animation: dots 1.2s infinite steps(3);
}
@keyframes dots {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}

/* Scroll to bottom button */
.scroll-to-bottom {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--accent);
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  z-index: 999;
  transition: background 0.2s, box-shadow 0.2s;
}
.scroll-to-bottom:hover {
  background: #ffe6a0;
}
.scroll-to-bottom svg {
  width: 22px;
  height: 22px;
  color: #18171c;
}

/* Footer */
footer {
  background: var(--sidebar-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.8rem;
  display: flex;
  gap: 0.9rem;
  align-items: center;
  border: 1.5px solid #35333c;
  margin-top: 1.2rem;
}

/* Input */
textarea {
  background: #23222a;
  color: #ffd580;
  border-radius: 1.6rem;
  border: 1.5px solid #35333c;
  font-size: 1.09rem;
  padding: 1rem 1.6rem;
  transition: box-shadow 0.15s;
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  resize: none;
}
textarea:focus {
  outline: 2px solid var(--accent);
}

/* Modals */
.login-modal, .confirm-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 23, 28, 0.65);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.login-modal.active, .confirm-modal.active {
  display: flex;
}
.login-modal-content, .confirm-modal-content {
  background: #23222a;
  border-radius: 18px;
  padding: 28px 24px 18px 24px;
  box-shadow: 0 8px 32px #000a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-width: 220px;
  text-align: center;
  border: 1.5px solid #39373f;
}
.login-modal-title, .confirm-modal-title {
  color: var(--accent);
  font-size: 1.17rem;
  margin-bottom: 4px;
  font-weight: bold;
  background: linear-gradient(90deg, #ffd580 70%, #ffedb8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-provider-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #18171c;
  border: none;
  border-radius: 999px;
  padding: 9px 28px;
  font-size: 1.01rem;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  justify-content: center;
  min-width: 150px;
  font-weight: 600;
}
.login-provider-btn img {
  width: 22px; height: 22px; display: inline-block;
}
.login-provider-btn:hover {
  background: #ffe6a0;
  color: #18171c;
}
.login-cancel-btn {
  margin-top: 5px;
  background: none;
  color: #aaa;
  border: none;
  font-size: 0.98rem;
  cursor: pointer;
  padding: 4px 0 0 0;
}
.login-cancel-btn:hover {
  color: var(--accent);
}

.confirm-modal-content {
  gap: 1.1em;
}
.confirm-modal-text {
  color: #ffd580;
  font-size: 0.97rem;
  margin-bottom: 0.4em;
  opacity: 0.92;
}
.confirm-modal-actions {
  display: flex;
  gap: 1em;
  justify-content: center;
}
.confirm-btn-yes, .confirm-btn-no {
  padding: 0.45em 1.4em;
  border-radius: 999px;
  border: none;
  font-size: 1.01rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.confirm-btn-yes {
  background: var(--accent);
  color: #18171c;
}
.confirm-btn-yes:hover {
  background: #ffe6a0;
}
.confirm-btn-no {
  background: #35333c;
  color: #ffd580;
}
.confirm-btn-no:hover {
  background: #39373f;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .main-content {
    width: 100vw;
    margin: 2rem 0;
    gap: 1.5rem;
    border-left: none;
  }
  header, footer {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    border-radius: 18px;
  }
}
@media (max-width: 600px) {
  .main-content {
    width: 100vw;
    margin: 0;
    gap: 0.8rem;
  }
  .chat-area {
    padding: 0.7rem 0.3rem 0.7rem 0.3rem;
    border-radius: 12px;
  }
  header, footer {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    border-radius: 12px;
  }
}
