/* ── App Layout ── */
.app-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.sidebar-backdrop {
  display: none;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255,255,255,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.new-chat-btn {
  width: 100%;
  padding: 8px;
  border: 1px dashed rgba(var(--color-primary-rgb),0.4);
  border-radius: 8px;
  background: transparent;
  color: var(--color-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.new-chat-btn:hover { background: rgba(var(--color-primary-rgb),0.08); border-style: solid; }
.sidebar-search {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e0e3ea;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  background: rgba(255,255,255,0.6);
  color: #333;
}
.sidebar-search:focus { border-color: var(--color-primary); }

/* ── Conversation List ── */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.conv-list::-webkit-scrollbar { width: 3px; }
.conv-list::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }
.conv-item {
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 2px;
  position: relative;
}
.conv-item:hover { background: rgba(var(--color-primary-rgb),0.06); }
.conv-item.active { background: rgba(var(--color-primary-rgb),0.12); }
.conv-item .conv-title {
  font-size: 13px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 20px;
}
.conv-item .conv-time {
  font-size: 11px;
  color: #aaa;
  margin-top: 2px;
}
.conv-item .conv-delete {
  position: absolute;
  right: 8px;
  top: 10px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}
.conv-item:hover .conv-delete { display: flex; }
.conv-item .conv-delete:hover { color: var(--color-danger); background: rgba(238,85,85,0.08); }

/* ── Header User Info ── */
.header .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}
.header .user-nick {
  font-size: 12px;
  color: #666;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header .logout-btn {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid #e0e3ea;
  border-radius: 12px;
  background: transparent;
  color: #999;
  cursor: pointer;
  transition: all .2s;
}
.header .logout-btn:hover { border-color: var(--color-danger); color: var(--color-danger); }

/* ── Sidebar Responsive ── */
@media (max-width: 640px) {
  .sidebar { width: 200px; }
}

@media (max-width: 499px) {
  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: min(82vw, 280px);
    z-index: 920;
    border-right: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 18px 40px rgba(12, 27, 54, 0.18);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

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

  .sidebar-backdrop {
    display: none;
  }
}

body.force-mobile-sidebar .sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: min(82vw, 280px);
  z-index: 920;
  border-right: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 18px 40px rgba(12, 27, 54, 0.18);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}

body.force-mobile-sidebar.mobile-sidebar-open .sidebar {
  transform: translateX(0);
}

body.force-mobile-sidebar .sidebar-backdrop {
  display: none;
}
