/* =====================================================
   NexusAI – Modern Dark Theme
   ===================================================== */

/* === Design Tokens === */
:root {
  --bg: #07070f;
  --bg2: #0d0d1a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-h: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-s: rgba(255, 255, 255, 0.14);
  --text: #eeeef8;
  --text2: #8888aa;
  --text3: #44445a;
  --accent: #7c3aed;
  --accent2: #4f46e5;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --green: #10b981;
  --red: #ef4444;
  --sidebar-w: 260px;
  --radius: 10px;
  --radius-lg: 16px;
}

/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: #a78bfa;
  text-decoration: none;
  transition: color .2s;
}

a:hover {
  color: #c4b5fd;
}

/* === Animated Background === */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.12;
}

.orb-1 {
  width: 700px;
  height: 700px;
  background: #7c3aed;
  top: -250px;
  left: -200px;
  animation: drift1 22s ease-in-out infinite;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: #2563eb;
  bottom: -180px;
  right: -150px;
  animation: drift2 28s ease-in-out infinite;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: #7c3aed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: drift3 35s ease-in-out infinite;
}

@keyframes drift1 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(70px, 50px)
  }
}

@keyframes drift2 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(-50px, -70px)
  }
}

@keyframes drift3 {

  0%,
  100% {
    transform: translate(-50%, -50%) scale(1)
  }

  50% {
    transform: translate(-50%, -50%) scale(1.25)
  }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 55px 55px;
}

/* === Utility === */
.hidden {
  display: none !important;
}

/* Views – nur EINE davon ist gleichzeitig sichtbar */
.view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#view-login {
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-chat {
  z-index: 5;
  display: flex;
}

#view-login.hidden,
#view-chat.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* =====================================================
   LOGIN VIEW
   ===================================================== */
.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 24px;
  gap: 28px;
}

/* Brand */
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Card */
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 40px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--text2);
  margin-bottom: 32px;
  line-height: 1.55;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-ico {
  position: absolute;
  left: 13px;
  color: var(--text3);
  flex-shrink: 0;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 12px 46px 12px 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', monospace;
  outline: none;
  transition: all .2s;
  letter-spacing: 0.3px;
}

.form-input:focus {
  border-color: rgba(124, 58, 237, 0.6);
  background: rgba(124, 58, 237, 0.07);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

.form-input::placeholder {
  color: var(--text3);
}

.vis-toggle {
  position: absolute;
  right: 11px;
  background: none;
  border: none;
  color: var(--text3);
  display: flex;
  padding: 4px;
  border-radius: 6px;
  transition: color .2s;
}

.vis-toggle:hover {
  color: var(--text2);
}

.form-error {
  margin-top: 7px;
  font-size: 12.5px;
  color: #fca5a5;
}

.form-success {
  margin-top: 7px;
  font-size: 12.5px;
  color: #6ee7b7;
}

.btn-danger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: translateY(0);
}


/* Checkbox */
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 26px;
  user-select: none;
}

.check-label input[type="checkbox"] {
  display: none;
}

.check-box {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 1.5px solid var(--border-s);
  border-radius: 5px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.check-label input:checked+.check-box {
  background: var(--accent);
  border-color: var(--accent);
}

.check-label input:checked+.check-box::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  display: block;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13.5px 24px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 5px 18px rgba(124, 58, 237, 0.45);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent);
  opacity: 0;
  transition: opacity .2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.6);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#btn-arrow {
  transition: transform .2s;
}

.btn-primary:hover #btn-arrow {
  transform: translateX(4px);
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-link {
  text-align: center;
  margin-top: 24px;
  font-size: 12.5px;
  color: var(--text3);
}

.login-link a {
  color: #a78bfa;
}

/* Model pills */
.model-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text2);
  backdrop-filter: blur(10px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot.green {
  background: #10b981;
  box-shadow: 0 0 7px #10b981;
}

.dot.purple {
  background: #a78bfa;
  box-shadow: 0 0 7px #a78bfa;
}

.dot.blue {
  background: #60a5fa;
  box-shadow: 0 0 7px #60a5fa;
}

.dot.orange {
  background: #f59e0b;
  box-shadow: 0 0 7px #f59e0b;
}

/* =====================================================
   CHAT VIEW LAYOUT
   ===================================================== */

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  flex-shrink: 0;
  background: rgba(8, 8, 20, 0.95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform .28s ease;
  overflow: visible;
}

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

.sb-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.28);
  border-radius: 8px;
  color: #a78bfa;
  font-size: 12.5px;
  font-weight: 500;
  transition: all .2s;
}

.new-chat-btn:hover {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.5);
}

/* Model select */
.sb-model {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sb-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

/* ── Custom Model Picker ── */
.mpick {
  position: relative;
}

.mpick-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
}

.mpick-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(124, 58, 237, 0.35);
}

.mpick-btn.open {
  border-color: rgba(124, 58, 237, 0.55);
  background: rgba(124, 58, 237, 0.08);
}

.mpick-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.mpick-logo.google {
  background: linear-gradient(135deg, #4285F4, #34A853);
}

.mpick-logo.anthropic {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

.mpick-logo.openai {
  background: linear-gradient(135deg, #10a37f, #1a7f64);
}

.mpick-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mpick-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mpick-tag {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 1px;
}

.mpick-chevron {
  color: var(--text3);
  flex-shrink: 0;
  transition: transform .2s;
}

.mpick-btn.open .mpick-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.mpick-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #0e0e1e;
  border: 1.5px solid rgba(124, 58, 237, 0.3);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  animation: dropIn .18s ease;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-6px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.mpick-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all .15s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.mpick-option:last-child {
  border-bottom: none;
}

.mpick-option:hover {
  background: rgba(124, 58, 237, 0.1);
}

.mpick-option.active {
  background: rgba(124, 58, 237, 0.12);
}

.mpick-opt-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.mpick-opt-logo.google {
  background: linear-gradient(135deg, #4285F4, #34A853);
}

.mpick-opt-logo.anthropic {
  background: linear-gradient(135deg, #d97706, #f59e0b);
}

.mpick-opt-logo.openai {
  background: linear-gradient(135deg, #10a37f, #1a7f64);
}

.mpick-opt-info {
  flex: 1;
  min-width: 0;
}

.mpick-opt-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mpick-opt-tag {
  display: block;
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

.mpick-check {
  color: #a78bfa;
  flex-shrink: 0;
  opacity: 0;
}

.mpick-option.active .mpick-check {
  opacity: 1;
}

/* Chat history */
.sb-history {
  flex: 1;
  overflow: hidden;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--text2);
}

.chat-item:hover {
  background: var(--surface-h);
  color: var(--text);
}

.chat-item.active {
  background: rgba(124, 58, 237, 0.13);
  border-color: rgba(124, 58, 237, 0.22);
  color: var(--text);
}

.ci-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ci-del {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text3);
  padding: 2px;
  border-radius: 4px;
  display: flex;
  transition: all .15s;
}

.chat-item:hover .ci-del {
  opacity: 1;
}

.ci-del:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.no-chats-msg {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  padding: 18px 0;
}

/* Sidebar footer */
.sb-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.sb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sb-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-user-role {
  font-size: 11px;
  color: var(--text3);
  text-transform: capitalize;
}

.sb-user-role.role-admin {
  color: #a78bfa;
}

.sb-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
}

.icon-btn-sm:hover {
  background: var(--surface-h);
  color: var(--text);
  border-color: var(--border-s);
}

.icon-btn-sm.logout:hover {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--red);
  background: rgba(239, 68, 68, 0.07);
}

/* Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

/* Main chat */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: flex-basis .25s ease, max-width .25s ease, width .25s ease;
}

/* Top bar */
.chat-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 20, 0.9);
  flex-shrink: 0;
  min-height: 54px;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text2);
  padding: 5px;
  border-radius: 7px;
  display: flex;
  transition: all .15s;
}

.menu-btn:hover {
  background: var(--surface-h);
  color: var(--text);
}

.chat-title {
  flex: 1;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text3);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  transition: all .15s;
}

.icon-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

/* Messages area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.09) transparent;
}

.chat-main.canvas-open {
  flex: 0 0 36%;
  max-width: 36%;
  min-width: 320px;
  border-right: 1px solid var(--border);
}

.chat-main.canvas-open .chat-topbar {
  padding: 12px 18px;
}

.chat-main.canvas-open .messages-area {
  padding: 22px 18px;
}

.chat-main.canvas-open .welcome-title {
  font-size: 24px;
}

.chat-main.canvas-open .welcome-sub {
  font-size: 13px;
  max-width: 320px;
}

.chat-main.canvas-open .suggestions {
  grid-template-columns: 1fr;
  max-width: 340px;
}

.chat-main.canvas-open .msg-list {
  gap: 18px;
}

.chat-main.canvas-open .msg-text {
  font-size: 14px;
}

.chat-main.canvas-open .input-zone {
  padding: 12px 18px 16px;
}

.chat-main.canvas-open .input-bar {
  padding: 10px 12px;
  border-radius: 13px;
}

.chat-main.canvas-open .msg-input {
  font-size: 13px;
  line-height: 1.45;
}

/* Welcome screen */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 14px;
}

.welcome-logo {
  margin-bottom: 4px;
  opacity: 0.95;
}

.welcome-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a78bfa 30%, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-sub {
  font-size: 14px;
  color: var(--text2);
  max-width: 380px;
  margin-bottom: 28px;
}

.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.sugg-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: all .2s;
}

.sugg-card:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.25);
  color: var(--text);
  transform: translateY(-2px);
}

.sugg-ico {
  font-size: 18px;
  flex-shrink: 0;
}

/* Messages list */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Single message */
.msg {
  display: flex;
  gap: 14px;
  animation: fadeUp .3s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.msg-avatar {
  width: 33px;
  height: 33px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}

.msg.user .msg-avatar {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
}

.msg.assistant .msg-avatar {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-s);
  font-size: 16px;
}

.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-role {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
}

.msg-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.72;
}

.msg-canvas-artifacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.msg-canvas-file {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  text-align: left;
  transition: all .18s ease;
  cursor: pointer;
}

.msg-canvas-file:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(124, 58, 237, 0.25);
  transform: translateY(-1px);
}

.msg-canvas-file-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.msg-canvas-file-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.msg-canvas-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-canvas-file-desc {
  font-size: 11.5px;
  color: var(--text2);
}

/* User bubble */
.msg.user .msg-text {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 12px;
  padding: 11px 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Action Buttons an AI Nachrichten */
.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.msg-action-btn {
  background: transparent;
  color: var(--text3);
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: all .2s;
}

.msg-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.msg-action-btn.active {
  color: #10b981;
}

.math-toggle-btn {
  padding: 4px 10px;
  gap: 6px;
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.08);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 600;
}

.math-toggle-btn:hover {
  background: rgba(124, 58, 237, 0.16);
  color: #fff;
}

.math-toggle-btn.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
}

.math-toggle-btn span {
  white-space: nowrap;
}

.msg-math-solution {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid #a78bfa;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.12);
}

.msg-math-solution h1,
.msg-math-solution h2,
.msg-math-solution h3 {
  margin-top: 0;
}

.msg-math-solution.hidden {
  display: none !important;
}

/* Markdown inside AI messages */
.msg-text h1,
.msg-text h2,
.msg-text h3 {
  margin: 18px 0 8px;
  font-weight: 600;
}

.msg-text h1 {
  font-size: 1.4em;
}

.msg-text h2 {
  font-size: 1.2em;
}

.msg-text h3 {
  font-size: 1.05em;
}

.msg-text p {
  margin-bottom: 12px;
}

.msg-text p:last-child {
  margin-bottom: 0;
}

.msg-text ul,
.msg-text ol {
  margin: 6px 0 12px 22px;
}

.msg-text li {
  margin-bottom: 4px;
}

.msg-text strong {
  font-weight: 600;
  color: #f0f0ff;
}

.msg-text em {
  font-style: italic;
  color: #c4b5fd;
}

.msg-text a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.msg-text blockquote {
  border-left: 3px solid rgba(124, 58, 237, 0.5);
  padding: 8px 16px;
  margin: 12px 0;
  border-radius: 0 8px 8px 0;
  background: rgba(124, 58, 237, 0.05);
  color: var(--text2);
  font-style: italic;
}

.msg-text code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.09);
  padding: 2px 6px;
  border-radius: 4px;
  color: #a78bfa;
}

.msg-text pre {
  margin: 12px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.msg-text pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 13px;
}

/* Code-Block Kopier-Button */
.code-wrapper {
  position: relative;
  margin: 12px 0;
}

.code-wrapper pre {
  margin: 0;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text2);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  z-index: 2;
}

.code-wrapper:hover .copy-code-btn {
  opacity: 1;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text);
}

.copy-code-btn.copied {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--green);
  opacity: 1;
}

.msg-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13.5px;
}

.msg-text th {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
}

.msg-text td {
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 6px 0;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  animation: bounce 1.3s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: .16s;
}

.typing-dot:nth-child(3) {
  animation-delay: .32s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: .4
  }

  40% {
    transform: translateY(-7px);
    opacity: 1
  }
}

/* Error box */
.err-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 15px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 13.5px;
  margin-top: 4px;
}

/* Input zone */
.input-zone {
  padding: 14px 24px 20px;
  flex-shrink: 0;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.draft-attach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  min-width: 220px;
}

.draft-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.draft-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.draft-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-size {
  font-size: 11px;
  color: var(--text2);
}

.draft-remove {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: 8px;
  cursor: pointer;
}

.draft-remove:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  transition: all .2s;
}

.input-bar:focus-within {
  border-color: rgba(124, 58, 237, 0.6);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.msg-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: #ffffff;
  caret-color: #a78bfa;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  resize: none;
  line-height: 1.6;
  min-height: 26px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  cursor: text;
}

.msg-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.attach-btn {
  width: 37px;
  height: 37px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: var(--text);
  transition: all .2s;
}

.attach-btn:hover {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.35);
  color: #fff;
}

.send-btn {
  width: 37px;
  height: 37px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none;
  border-radius: 9px;
  color: #fff;
  transition: all .2s;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.45);
}

.send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.65);
}

.send-btn:active {
  transform: scale(0.94);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Stop-Button */
.stop-btn {
  width: 37px;
  height: 37px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 9px;
  color: #ef4444;
  transition: all .2s;
}

.stop-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: scale(1.06);
}

.stop-btn:active {
  transform: scale(0.94);
}

/* Mikrofon-Button */
.mic-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text2);
  transition: all .2s;
}

.mic-btn:hover {
  background: var(--surface-h);
  color: var(--text);
  border-color: var(--border);
}

.mic-btn.listening {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
  }
}

/* "Gestoppt"-Badge unter abgebrochenen Antworten */
.stop-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .3px;
}

.disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  margin-top: 9px;
}

/* Chat media */
.msg-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.msg-media-img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (min-width: 769px) {
  .sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0;
    overflow: hidden;
    border: none;
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .suggestions {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 28px 22px;
  }

  .messages-area {
    padding: 20px 16px;
  }

  .input-zone {
    padding: 12px 16px 16px;
  }

  .draft-attach {
    min-width: 100%;
  }
}

/* =====================================================
   ADMIN MODAL
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}

.modal-box {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  background: #0e0e1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  animation: slideUp .25s ease;
  overflow: hidden;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

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

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-title-row svg {
  color: #a78bfa;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.modal-section {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-section:last-child {
  border-bottom: none;
}

.modal-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 18px;
}

.modal-section-title svg {
  color: #a78bfa;
  flex-shrink: 0;
}

/* Form inside modal */
.create-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-success {
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* User count badge */
.user-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  color: #a78bfa;
  margin-left: 6px;
}

/* Users table */
.users-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: all .15s;
}

.user-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-row-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.user-row-avatar.role-user {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.user-row-info {
  flex: 1;
  min-width: 0;
}

.user-row-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row-email {
  font-size: 12px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  text-transform: capitalize;
}

.role-badge.admin {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.25);
}

.role-badge.user {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.del-user-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 7px;
  color: #fca5a5;
  cursor: pointer;
  transition: all .15s;
  opacity: 0;
}

.user-row:hover .del-user-btn {
  opacity: 1;
}

.del-user-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--red);
}

.del-user-btn:disabled {
  opacity: 0.2 !important;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .modal-box {
    border-radius: 14px;
  }

  .modal-section {
    padding: 18px;
  }
}

/* =====================================================
   Tools Menu
   ===================================================== */
.tools-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px 0;
}

.tools-menu-wrap {
  position: relative;
}

.tools-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 500;
  transition: all .18s;
  cursor: pointer;
}

.tools-btn:hover {
  background: var(--surface-h);
  border-color: var(--border-s);
  color: var(--text);
}

.tools-btn.active {
  border-color: rgba(124, 58, 237, 0.5);
  color: #a78bfa;
  background: rgba(124, 58, 237, 0.08);
}

.tools-drop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #12121f;
  border: 1px solid var(--border-s);
  border-radius: 12px;
  padding: 6px;
  min-width: 230px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: fadeUp .15s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-option {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}

.tool-option:hover {
  background: var(--surface-h);
}

.tool-name {
  font-size: 13px;
  font-weight: 500;
}

.tool-desc {
  font-size: 11px;
  color: var(--text2);
  margin-top: 1px;
}

.tool-check {
  margin-left: auto;
  color: #a78bfa;
  flex-shrink: 0;
}

/* =====================================================
   Canvas Panel – IDE Layout
   ===================================================== */
.canvas-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  border-left: 1px solid var(--border);
  background: #0a0a18;
  animation: slideInRight .2s ease;
  overflow: hidden;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Datei-Sidebar ── */
.cfp {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #080812;
}

.cfp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.cfp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cfp-close-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 5px;
  transition: all .15s;
}

.cfp-close-btn:hover {
  background: var(--surface-h);
  color: var(--text);
}

.cfp-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 10px 14px 6px;
}

.cfp-file-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.cfp-empty {
  font-size: 11.5px;
  color: var(--text3);
  padding: 12px 14px;
}

.cfp-file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
  border-left: 2px solid transparent;
}

.cfp-file-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.cfp-file-item.active {
  background: rgba(124, 58, 237, 0.1);
  border-left-color: #a78bfa;
}

.cfp-file-item:hover .cfp-file-del {
  opacity: 1;
}

.cfp-file-icon-box {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cfp-file-meta {
  flex: 1;
  min-width: 0;
}

.cfp-file-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cfp-file-date {
  display: block;
  font-size: 10px;
  color: var(--text3);
  margin-top: 1px;
}

.cfp-file-del {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 14px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all .12s;
}

.cfp-file-del:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
}

/* ── Editor-Bereich ── */
.canvas-editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #0d0d1c 0%, #0a0a14 100%);
}

.canvas-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text3);
  font-size: 12.5px;
  text-align: center;
  padding: 20px;
}

.canvas-code-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── File Header ── */
.ccv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
  min-height: 42px;
}

.ccv-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ccv-file-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ccv-filename {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Fira Code', 'Consolas', monospace;
}

.ccv-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ccv-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s;
}

.ccv-btn:hover {
  background: var(--surface-h);
  color: var(--text);
}

.ccv-btn.ccv-close:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

/* ── Code Editor mit Zeilennummern ── */
.ccv-editor-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #0d0d1c;
}

.ccv-line-nums {
  width: 52px;
  flex-shrink: 0;
  padding: 18px 0;
  background: #080812;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: right;
}

.ccv-line-nums span {
  display: block;
  height: 24px;
  padding-right: 12px;
  font-size: 12.5px;
  line-height: 24px;
  font-family: 'Fira Code', 'Consolas', monospace;
  color: rgba(255, 255, 255, 0.2);
  user-select: none;
}

.canvas-editor {
  flex: 1;
  padding: 18px 16px 20px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #c9d1d9;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 24px;
  tab-size: 4;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
  caret-color: #a78bfa;
}

.canvas-editor::placeholder {
  color: var(--text3);
}

.chat-main.canvas-open {
  min-width: 0;
}

@media (max-width: 1100px) {
  .chat-main.canvas-open {
    flex-basis: 40%;
    max-width: 40%;
    min-width: 280px;
  }

  .canvas-panel {
    width: auto;
  }

  .cfp {
    width: 180px;
  }
}

@media (max-width: 900px) {
  .canvas-panel {
    width: 100%;
    flex-direction: column;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .cfp {
    width: 100%;
    height: 160px;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .cfp-file-list {
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding: 6px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .cfp-file-item {
    flex-direction: column;
    min-width: 80px;
  }

  .chat-main.canvas-open {
    display: none;
  }
}

/* =====================================================
   Lernhilfe Banner & PDF Attachment
   ===================================================== */
.lernhilfe-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  margin-bottom: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 10px;
  font-size: 12.5px;
  color: #6ee7b7;
}

.lernhilfe-banner svg {
  flex-shrink: 0;
  color: #10b981;
}

.lernhilfe-banner span {
  flex: 1;
}

.lernhilfe-upload-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.lernhilfe-upload-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.lernhilfe-upload-btn:hover {
  background: rgba(16, 185, 129, 0.2);
}

.pdf-attachment {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 12.5px;
}

.pdf-attachment svg {
  color: #f59e0b;
  flex-shrink: 0;
}

.pdf-attachment-name {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-attachment-pages {
  color: var(--text2);
  font-size: 11px;
  flex-shrink: 0;
}

.pdf-remove-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  color: #fca5a5;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}

.pdf-remove-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-info {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-error {
  background: rgba(220, 38, 38, 0.9);
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.toast-warn {
  background: rgba(217, 119, 6, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.toast-ok {
  background: rgba(5, 150, 105, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.5);
}
