:root {
  --bg: #f3ecff;
  --bg-alt: #ffe9f5;
  --panel: #fffaff;
  --panel-alt: #f6ecff;
  --accent: #c9a2ff;
  --accent-soft: #ffb8dd;
  --accent-mint: #b8f0d8;
  --text: #4a3b63;
  --text-dim: #9483ad;
  --error: #ff6b93;
  --success: #6fd9a8;
  --radius: 20px;
  --border: #ecd9ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, #ffe0f2 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, #e0d4ff 0%, transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-alt));
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.brand { font-size: 1.5rem; font-weight: 800; color: #8a5cd6; }

.user-badge {
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 14px rgba(180,140,255,0.15);
}
.user-badge button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
}

.view { display: flex; justify-content: center; padding: 20px; min-height: 100vh; align-items: center; }
.brand-auth { text-align: center; font-size: 1.4rem; font-weight: 800; color: #8a5cd6; margin-bottom: 18px; }

/* --- App-Shell: Sidebar-Dashboard-Layout --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 84px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #d9b8ff, #ffc7e6);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  gap: 22px;
}
.sidebar-logo { font-size: 1.8rem; margin-bottom: 10px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.sidebar-btn {
  width: 50px; height: 50px;
  border-radius: 18px;
  border: none;
  background: rgba(255,255,255,0.55);
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.sidebar-btn:hover { transform: scale(1.06); background: rgba(255,255,255,0.85); }
.sidebar-btn.active { background: white; box-shadow: 0 6px 16px rgba(120,70,180,0.35); }
.sidebar-logout { margin-top: auto; }

.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view-panel { flex: 1; display: flex; justify-content: center; padding: 24px; }

.panel-banner {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  color: white;
  font-weight: 800;
  text-align: center;
  padding: 14px;
  border-radius: 16px;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.split { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.split-block {
  flex: 1;
  min-width: 220px;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.split-block h3 { margin: 0 0 4px; font-size: 1rem; color: #8a5cd6; }

/* --- Profilseite (Carrd-/Aesthetic-Card-Stil) --- */
.profile-card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  padding-bottom: 24px;
  box-shadow: 0 14px 40px rgba(180,140,255,0.22);
  text-align: center;
  overflow: hidden;
}
.profile-banner {
  background: linear-gradient(120deg, #d9b8ff, #ffc7e6, #b8f0d8);
  height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  padding-top: 10px;
  font-size: 1.3rem;
}
.profile-avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  font-size: 2rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: -42px auto 10px;
  border: 4px solid var(--panel);
  box-shadow: 0 6px 16px rgba(150,100,220,0.3);
}
.profile-name { margin: 0; font-size: 1.2rem; }
.profile-email { color: var(--text-dim); font-size: 0.85rem; margin: 2px 0 16px; }

.profile-stats { display: flex; justify-content: center; gap: 10px; padding: 0 20px; }
.stat-pill {
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.stat-value { font-weight: 800; font-size: 1.1rem; color: #8a5cd6; }
.stat-label { font-size: 0.75rem; color: var(--text-dim); }

.profile-about {
  text-align: left;
  margin: 18px 20px 0;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
}
.profile-about h4 { margin: 0 0 4px; font-size: 0.9rem; color: #8a5cd6; }
.profile-about-placeholder { margin: 0; font-size: 0.85rem; color: var(--text-dim); }

.profile-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 20px 0;
}
.gallery-tile {
  aspect-ratio: 1;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}

.auth-card, .panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 14px 40px rgba(180,140,255,0.22);
}

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1;
  padding: 10px;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 700;
}
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-soft)); color: white; border-color: transparent; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { font-size: 0.85rem; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.form input {
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 1rem;
}
.form input:focus { outline: none; border-color: var(--accent); }
.form button {
  margin-top: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(200,150,255,0.4);
}
.form button:hover { filter: brightness(1.05); }
.error { color: var(--error); font-size: 0.85rem; min-height: 1em; }

.panel { max-width: 640px; }

/* Räume-Übersicht: schlichte Kartenraster + FAB */
.rooms-panel { position: relative; max-width: 720px; }
.room-grid {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.room-grid li {
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.room-grid li:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 10px 24px rgba(200,150,255,0.3); }
.room-grid .room-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: white;
  box-shadow: 0 4px 10px rgba(200,150,255,0.4);
}
.room-grid .room-name { font-weight: 700; font-size: 0.95rem; }
.room-grid .room-code { color: var(--text-dim); font-size: 0.78rem; letter-spacing: 0.05em; }
.room-grid .empty-hint { grid-column: 1 / -1; color: var(--text-dim); text-align: center; cursor: default; background: none; border: none; }

.fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(200,150,255,0.5);
}
.fab:hover { filter: brightness(1.08); transform: scale(1.05); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(140, 110, 200, 0.35);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal-card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  position: relative;
  box-shadow: 0 16px 44px rgba(150,100,220,0.3);
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--panel-alt); border: none; color: var(--text-dim);
  font-size: 1rem; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%;
}

.room-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.room-list li {
  background: var(--panel-alt);
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}
.room-list li:hover { outline: 2px solid var(--accent); }


.room-layout {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 1000px;
  height: calc(100vh - 100px);
}
.member-panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  width: 220px;
  flex-shrink: 0;
  overflow-y: auto;
}
.back-btn { background: var(--panel-alt); border: 2px solid var(--border); border-radius: 999px; padding: 6px 14px; color: var(--text-dim); cursor: pointer; margin-bottom: 10px; font-weight: 700; }
.room-code { color: var(--text-dim); font-size: 0.85rem; }
.member-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.member-list li { background: var(--panel-alt); padding: 6px 12px; border-radius: 999px; font-size: 0.9rem; }

.chat-panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-messages li { max-width: 80%; }
.chat-messages .system { color: var(--text-dim); font-size: 0.8rem; align-self: center; text-align: center; }
.chat-messages .msg .author { color: #a86bd6; font-weight: 700; font-size: 0.8rem; }
.chat-messages .msg .bubble { background: var(--panel-alt); padding: 8px 14px; border-radius: 16px; margin-top: 2px; }

.chat-form { display: flex; gap: 8px; padding: 14px; border-top: 2px solid var(--border); }
.chat-form input {
  flex: 1;
  background: var(--panel-alt);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
}
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(200,150,255,0.4);
}

@media (max-width: 700px) {
  .room-layout { flex-direction: column; height: auto; }
  .member-panel { width: 100%; }
}
