*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a14;
  --bg-elevated: #10101d;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-solid: #141422;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eceaf6;
  --text-muted: #8f8ca8;
  --accent: #a78bfa;
  --accent-2: #e879f9;
  --accent-3: #22d3ee;
  --accent-hover: #b8a1fb;
  --link: #7dd3fc;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --gradient: linear-gradient(135deg, #a78bfa 0%, #e879f9 55%, #22d3ee 120%);
  --gradient-soft: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(232, 121, 249, 0.1), rgba(34, 211, 238, 0.08));
  --glow: 0 0 24px rgba(167, 139, 250, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --radius: 10px;
  --radius-lg: 16px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---- Scrollbars ---- */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.25) transparent;
}

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.25);
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(167, 139, 250, 0.45); }

/* ---- Utilities ---- */

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }

/* ---- Focus ---- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   AUTH VIEW — aurora backdrop
   ============================================ */

#auth-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(167, 139, 250, 0.12), transparent),
    radial-gradient(ellipse 60% 50% at 20% 110%, rgba(34, 211, 238, 0.08), transparent),
    url('../images/auth-bg.svg') center / cover no-repeat,
    var(--bg);
}

.aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  filter: blur(90px);
  opacity: 0.5;
}

.aurora-blob {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
}

.aurora-1 {
  background: radial-gradient(circle, rgba(167, 139, 250, 0.55), transparent 65%);
  top: -15%;
  left: 8%;
  animation: drift-1 22s ease-in-out infinite alternate;
}

.aurora-2 {
  background: radial-gradient(circle, rgba(232, 121, 249, 0.4), transparent 65%);
  bottom: -20%;
  right: 5%;
  animation: drift-2 26s ease-in-out infinite alternate;
}

.aurora-3 {
  background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 65%);
  top: 40%;
  left: 55%;
  width: 380px;
  height: 380px;
  animation: drift-3 30s ease-in-out infinite alternate;
}

@keyframes drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(12vw, 10vh) scale(1.15); }
}

@keyframes drift-2 {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-10vw, -12vh) scale(0.95); }
}

@keyframes drift-3 {
  from { transform: translate(0, 0); }
  to { transform: translate(-14vw, 8vh); }
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 2.75rem 2.25rem;
  background: rgba(20, 20, 34, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo {
  display: inline-flex;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 18px rgba(167, 139, 250, 0.45));
}

.auth-logo img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  object-fit: cover;
}

.auth-card h1 {
  font-size: 1.7rem;
  font-weight: 700;
}

.auth-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.55rem;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab:hover { color: var(--text); }

.auth-tab.active {
  background: var(--gradient);
  color: #0a0a14;
  box-shadow: var(--glow);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  text-decoration: none;
  transition: color var(--transition);
}

.auth-link:hover { color: var(--accent); }

.auth-error {
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.85rem;
}

/* ---- Forms ---- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
textarea,
select,
.input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: rgba(143, 140, 168, 0.6);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.05);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
}

textarea { resize: vertical; }

select option { background: var(--surface-solid); }

.form-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form-check label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group { flex: 1; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: var(--gradient);
  color: #0a0a14;
  box-shadow: 0 4px 18px rgba(167, 139, 250, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(167, 139, 250, 0.5);
  filter: brightness(1.08);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: var(--danger);
}

.btn-danger:hover { background: rgba(251, 113, 133, 0.2); }

.btn-full { width: 100%; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 40% at 85% -5%, rgba(167, 139, 250, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 0% 105%, rgba(34, 211, 238, 0.04), transparent),
    var(--bg);
}

/* ---- Left Sidebar ---- */

.sidebar-left {
  display: flex;
  flex-direction: column;
  width: 264px;
  min-width: 264px;
  background: rgba(16, 16, 29, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.community-logo {
  display: flex;
  filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.4));
}

.community-logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  object-fit: cover;
}

.community-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.sidebar-search { padding: 0.85rem 1rem 0.4rem; }

.search-input {
  font-size: 0.85rem;
  padding: 0.5rem 0.8rem;
}

.sidebar-nav { padding: 0.6rem 0.6rem 0.2rem; }

.nav-list { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  margin-bottom: 2px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--gradient-soft);
  color: var(--text);
  border: 1px solid rgba(167, 139, 250, 0.25);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 99px;
  background: var(--gradient);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
}

/* ---- Channel list ---- */

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.6rem;
}

.channel-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0.5rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.65rem;
  margin-bottom: 1px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.92rem;
  cursor: pointer;
  transition: all var(--transition);
}

.channel-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

.channel-item.active {
  background: var(--gradient-soft);
  color: var(--text);
  border: 1px solid rgba(167, 139, 250, 0.25);
  font-weight: 600;
}

.channel-icon {
  width: 18px;
  text-align: center;
  opacity: 0.8;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Sidebar user footer ---- */

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.avatar,
.message-avatar,
.member-card-avatar,
.member-avatar-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--gradient);
  /* Default avatars — replace with: background-image: url('../images/default-avatar.png'); */
  background-size: cover;
  background-position: center;
  color: #0a0a14;
  font-weight: 700;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.25);
}

.avatar {
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-actions {
  display: flex;
  gap: 2px;
}

/* ---- Main Content ---- */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 16, 29, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.view-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.5rem;
  animation: panel-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#channel-view {
  padding: 0;
  overflow: hidden;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.view-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

/* ---- Messages ---- */

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.message {
  display: flex;
  gap: 0.85rem;
  padding: 0.45rem 0.75rem;
  margin: 0 -0.75rem;
  border-radius: var(--radius);
  transition: background var(--transition);
  animation: msg-in 0.25s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message:hover { background: rgba(255, 255, 255, 0.03); }

.message.compact { padding-top: 0.1rem; padding-bottom: 0.1rem; }

.message:not(.compact) { margin-top: 0.85rem; }

.message-avatar {
  width: 38px;
  height: 38px;
  font-size: 0.95rem;
}

.message-avatar-spacer {
  width: 38px;
  flex-shrink: 0;
}

.message-body { min-width: 0; flex: 1; }

.message-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}

.message-author {
  font-weight: 700;
  font-size: 0.93rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.message-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.message-content {
  font-size: 0.93rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-content code {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  font-size: 0.85em;
}

.message-form {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
  padding: 0.9rem 1.5rem 1.2rem;
}

.message-input {
  flex: 1;
  max-height: 150px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  line-height: 1.45;
}

.message-input:focus {
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18), 0 0 24px rgba(167, 139, 250, 0.12);
}

.message-form .btn-primary {
  border-radius: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
}

/* ---- Empty states ---- */

.empty-state {
  background-image: url('../images/empty-chat.svg');
  background-size: 220px;
  background-repeat: no-repeat;
  background-position: center 26%;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem 2rem 3.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  margin: 1rem 0;
}

/* ---- Role badges ---- */

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.role-badge.admin {
  background: var(--gradient);
  color: #0a0a14;
}

.role-badge.mod {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--warning);
}

.role-badge.member {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

/* ---- Courses ---- */

.course-grid,
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.1rem;
}

.course-card {
  position: relative;
  padding: 110px 1.3rem 1.4rem;
  background-color: var(--surface-solid);
  background-image: url('../images/course-cover-1.svg');
  background-size: 100% 92px;
  background-repeat: no-repeat;
  background-position: top center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.course-card:nth-child(4n+2) { background-image: url('../images/course-cover-2.svg'); }
.course-card:nth-child(4n+3) { background-image: url('../images/course-cover-3.svg'); }
.course-card:nth-child(4n)   { background-image: url('../images/course-cover-4.svg'); }

.course-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity var(--transition);
}

.course-card:hover {
  transform: translateY(-4px);
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 24px rgba(167, 139, 250, 0.12);
}

.course-card:hover::before { opacity: 1; }

.course-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.course-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
}

.course-content,
.course-detail {
  max-width: 760px;
  line-height: 1.75;
}

.course-content h1, .course-detail h1,
.course-content h2, .course-detail h2,
.course-content h3, .course-detail h3 {
  margin: 1.5rem 0 0.6rem;
}

.course-content p, .course-detail p { margin: 0.7rem 0; }

.course-content code, .course-detail code {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  font-size: 0.88em;
}

.course-content pre, .course-detail pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.course-content pre code, .course-detail pre code {
  background: none;
  border: none;
  padding: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
}

.breadcrumb-link {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb-link:hover { text-decoration: underline; }

.breadcrumb-sep { color: var(--text-muted); }

.breadcrumb-current { color: var(--text-muted); }

/* ---- Events ---- */

.event-list,
.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 720px;
}

.event-card {
  display: flex;
  gap: 1.1rem;
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.event-card:hover {
  transform: translateX(4px);
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 20px rgba(34, 211, 238, 0.08);
}

.event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  background: var(--gradient);
  border-radius: 14px;
  color: #0a0a14;
  box-shadow: 0 4px 16px rgba(167, 139, 250, 0.3);
}

.event-month {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.event-day {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.event-info h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.event-meta {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.event-card-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.event-card-mini:hover { background: var(--surface-hover); }

.event-date-mini {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  background: var(--gradient-soft);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.event-title-mini {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Members ---- */

.members-toolbar,
.members-search {
  margin-bottom: 1.25rem;
  max-width: 380px;
}

.member-grid,
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.member-card {
  display: flex;
  gap: 0.9rem;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.member-card:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 121, 249, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.member-card-avatar {
  width: 46px;
  height: 46px;
  font-size: 1.15rem;
}

.member-card-info { min-width: 0; }

.member-card-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.member-card-joined {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  transition: background var(--transition);
}

.member-item:hover { background: var(--surface-hover); }

.member-avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 0.7rem;
}

/* ---- Settings ---- */

.settings-form { max-width: 480px; }

.settings-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.settings-form legend {
  padding: 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

/* ---- Right Sidebar ---- */

.sidebar-right {
  width: 264px;
  min-width: 264px;
  overflow-y: auto;
  background: rgba(16, 16, 29, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-left: 1px solid var(--border);
  padding: 1.1rem 0.9rem;
}

.sidebar-right.collapsed { display: none; }

.sidebar-section { margin-bottom: 1.75rem; }

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.6rem;
}

.online-members-list,
.upcoming-events-list {
  list-style: none;
}

/* ---- Modals ---- */

dialog.modal {
  margin: auto;
  width: min(480px, calc(100vw - 2rem));
  background: transparent;
  border: none;
  padding: 0;
}

dialog.modal::backdrop {
  background: rgba(6, 6, 12, 0.7);
  backdrop-filter: blur(6px);
}

dialog.modal[open] .modal-content {
  animation: modal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
  background: rgba(20, 20, 34, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.75rem;
}

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 1.5rem 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  padding-top: 0.5rem;
}

/* ---- Toasts ---- */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  padding: 0.8rem 1.2rem;
  background: rgba(20, 20, 34, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.88rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 340px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

.toast.fade-out {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Responsive ---- */

@media (max-width: 1080px) {
  .sidebar-right { display: none; }
}

@media (max-width: 768px) {
  .sidebar-left {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(16, 16, 29, 0.97);
  }

  .sidebar-left.open { transform: translateX(0); }

  .view-panel { padding: 1rem; }

  .message-list { padding: 1rem 1rem 0.5rem; }

  .message-form { padding: 0.7rem 1rem 1rem; }

  .auth-card { padding: 2rem 1.5rem; }
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Assistant ---- */

#assistant-view {
  padding: 0;
  overflow: hidden;
}

.assistant-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.assistant-msg {
  max-width: 46rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.93rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: msg-in 0.25s ease;
}

.assistant-msg-user {
  align-self: flex-end;
  background: var(--gradient-soft);
  border: 1px solid rgba(167, 139, 250, 0.25);
  white-space: pre-wrap;
}

.assistant-msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.assistant-msg-assistant p { margin: 0 0 0.6em; }
.assistant-msg-assistant p:last-child { margin-bottom: 0; }
.assistant-msg-assistant ul,
.assistant-msg-assistant ol { margin: 0 0 0.6em; padding-left: 1.3em; }
.assistant-msg-assistant li { margin-bottom: 0.25em; }

.assistant-msg-assistant code {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.2);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  font-size: 0.85em;
}

.assistant-msg-assistant pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  margin: 0 0 0.6em;
}

.assistant-msg-assistant pre code {
  background: none;
  border: none;
  padding: 0;
}

.assistant-thinking {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  padding: 0.9rem 1rem;
}

.assistant-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: thinking-pulse 1.2s ease-in-out infinite;
}

.assistant-thinking span:nth-child(2) { animation-delay: 0.2s; }
.assistant-thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

/* ---- Gallery ---- */

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.filter-chip {
  padding: 0.35rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.filter-chip.active {
  background: var(--gradient);
  border-color: transparent;
  color: #0a0a14;
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.35);
}

.gallery-grid {
  columns: 4 240px;
  column-gap: 1rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover {
  transform: translateY(-3px);
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(167, 139, 250, 0.15);
}

.gallery-item img {
  width: 100%;
  display: block;
}

.gallery-item-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 0.9rem 0.75rem;
  background: linear-gradient(transparent, rgba(6, 6, 12, 0.9));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover .gallery-item-overlay { opacity: 1; }

.gallery-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  flex-shrink: 0;
}

.source-firefly {
  background: var(--gradient);
  color: #0a0a14;
}

.source-midjourney {
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--accent-3);
}

.source-dalle {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--success);
}

.source-stable-diffusion {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--warning);
}

.source-other,
.source-upload {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.commercial-badge {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--success);
}

.license-hint {
  font-size: 0.78rem;
  line-height: 1.5;
  margin-top: -0.35rem;
}

.art-drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.art-drop-zone:hover,
.art-drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.06);
  color: var(--text);
}

dialog.lightbox {
  width: min(920px, calc(100vw - 2rem));
}

.lightbox .modal-content {
  position: relative;
  padding: 0;
}

.lightbox-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  z-index: 2;
  background: rgba(6, 6, 12, 0.6);
  border-radius: 8px;
}

#lightbox-img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  display: block;
  background: #06060c;
}

.lightbox-info {
  padding: 1rem 1.4rem 1.3rem;
}

.lightbox-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.lightbox-prompt {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}

.lightbox-meta {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .gallery-grid { columns: 3 200px; }
}

@media (max-width: 600px) {
  .gallery-grid { columns: 2 150px; }
}
