/* Rooms toggle button + slide-down panel over the chat */
.chat-body {
  position: relative;
}

/* Rooms toggle now lives inline on the chat input bar, matching the emoji button */
.rooms-toggle-btn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  border: 1px solid var(--chat-border, var(--border));
  background: rgba(255, 255, 255, 0.08);
  color: var(--chat-text, var(--text));
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.rooms-toggle-btn:hover {
  background: rgba(145, 70, 255, 0.28);
  border-color: rgba(145, 70, 255, 0.5);
}

.rooms-toggle-btn[aria-expanded="true"] {
  background: var(--primary, #9146ff);
  border-color: var(--primary, #9146ff);
  color: #fff;
}

.rooms-toggle-btn svg {
  width: 14px;
  height: 14px;
}

.rooms-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58%;
  max-height: 58%;
  z-index: 9;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(12, 15, 20, 0.98), rgba(12, 15, 20, 0.94));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--chat-border, var(--border));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  transform: translateY(-102%);
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms ease, opacity 200ms ease;
}

.rooms-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.rooms-panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 48px;
  border-bottom: 1px solid var(--chat-border, var(--border));
}

.rooms-panel-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--chat-muted, var(--muted));
}

.rooms-panel-close {
  border: none;
  background: transparent;
  color: var(--chat-muted, var(--muted));
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 8px;
}

.rooms-panel-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.rooms-panel-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
}

.rooms-panel-list::-webkit-scrollbar {
  width: 6px;
}

.rooms-panel-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}

.room-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--chat-border, var(--border));
  background: rgba(255, 255, 255, 0.04);
  color: var(--chat-text, var(--text));
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.room-card:hover {
  background: rgba(145, 70, 255, 0.16);
  border-color: rgba(145, 70, 255, 0.45);
}

.room-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.room-card-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-card-name .lock {
  font-size: 11px;
  opacity: 0.8;
}

.room-card-meta {
  font-size: 11px;
  color: var(--chat-muted, var(--muted));
  margin-top: 2px;
}

.room-card-join {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(145, 70, 255, 0.5);
  background: rgba(145, 70, 255, 0.18);
  color: var(--chat-text, var(--text));
}

.rooms-panel-foot {
  flex: 0 0 auto;
  padding: 8px;
  border-top: 1px solid var(--chat-border, var(--border));
}

.rooms-create-btn {
  border: 1px solid rgba(95, 222, 161, 0.7);
  color: #e9fff3;
  background: linear-gradient(135deg, rgba(24, 174, 102, 0.9), rgba(13, 123, 92, 0.95));
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 10px;
}

.rooms-panel-foot .rooms-create-btn {
  width: 100%;
  padding: 9px;
  font-size: 12px;
}

.rooms-create-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.rooms-overlay-empty {
  font-size: 12px;
  color: var(--chat-muted, var(--muted));
  padding: 12px;
  text-align: center;
}

.rooms-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(5, 8, 12, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rooms-modal-backdrop.open {
  display: flex;
}

.rooms-modal {
  width: min(420px, 100%);
  background: rgba(18, 23, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  padding: 14px;
}

.rooms-modal h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.rooms-modal p {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.rooms-modal input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 9px 10px;
  margin-bottom: 10px;
}

.rooms-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rooms-modal-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 11px;
  cursor: pointer;
}

.rooms-modal-btn.primary {
  border-color: rgba(95, 222, 161, 0.75);
  background: linear-gradient(135deg, rgba(24, 174, 102, 0.92), rgba(13, 123, 92, 0.98));
  color: #eafff4;
}
