/* ABOUTME: Styles for multi-user chatrooms — intentionally distinct from AI chat */

/* ABOUTME: Uses blue accent and flat message list (not bubbles) to prevent confusion with private AI chat */

/* ========== Index Page ========== */
.chatrooms-index {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-4);
}

.chatrooms-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.chatrooms-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chatroom-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatroom-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgb(66 133 244 / 10%);
}

.chatroom-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

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

.chatroom-card-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.125rem;
}

.chatroom-card-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.chatroom-card-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.chatroom-card-meta i {
  margin-right: 0.25rem;
}

.chatroom-card-arrow {
  color: var(--gray-400);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ========== Room View ========== */
.chatroom-container {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 56px); /* viewport minus nav */
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
}

.chatroom-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chatroom-back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.2s;
}

.chatroom-back-btn:hover {
  background: var(--gray-100);
}

.chatroom-header-info {
  flex: 1;
}

.chatroom-title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.chatroom-member-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Public room warning banner */
.chatroom-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem var(--space-4);
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
}

.chatroom-banner i {
  font-size: 0.6875rem;
}

/* ========== Message List (flat style, not bubbles) ========== */
.chatroom-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.chatroom-scroll-anchor {
  height: 1px;
}

.chatroom-message {
  display: flex;
  gap: var(--space-3);
  padding: 0.375rem var(--space-4);
  transition: background 0.15s;
}

.chatroom-message:hover {
  background: var(--gray-50);
}

.chatroom-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

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

.chatroom-message-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: 0.125rem;
}

.chatroom-message-author {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.chatroom-message--own .chatroom-message-author {
  color: var(--blue);
}

.chatroom-message-time {
  font-size: 0.6875rem;
  color: var(--gray-400);
}

.chatroom-message-edited {
  font-size: 0.6875rem;
  color: var(--gray-400);
  font-style: italic;
}

.chatroom-message-content {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: break-word;
}

.chatroom-message-content span {
  white-space: pre-wrap;
}

.chatroom-message-deleted {
  color: var(--gray-400);
}

/* Optimistic message (pending server confirmation) */
.chatroom-message--optimistic {
  opacity: 0.6;
}

/* ========== Day Divider ========== */
.chatroom-day-divider {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
}

.chatroom-day-divider::before,
.chatroom-day-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.chatroom-day-divider-label {
  padding: 0 var(--space-3);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========== Input Area ========== */
.chatroom-input-area {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chatroom-input-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.chatroom-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatroom-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(66 133 244 / 15%);
}

.chatroom-send-btn {
  padding: 0.625rem 1.25rem;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.chatroom-send-btn:hover {
  background: #3b78e7;
}

.chatroom-send-btn:active {
  background: #2d6ae0;
}

/* ========== Load More ========== */
.chatroom-load-more {
  display: block;
  width: 100%;
  padding: var(--space-2);
  background: none;
  border: none;
  color: var(--blue);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.chatroom-load-more:hover {
  text-decoration: underline;
}

/* ========== Mobile ========== */
@media (width <= 768px) {
  .chatroom-container {
    height: calc(100dvh - 50px);
  }

  .chatroom-message-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.6875rem;
  }

  .chatroom-message {
    padding: 0.25rem var(--space-3);
    gap: var(--space-2);
  }

  .chatroom-input {
    font-size: 1rem; /* prevent iOS zoom */
  }
}
