/* =============================================
   Kuaförim App - Chat Styles
   ============================================= */

/* Chat list */
.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chat-list-item:active {
  background: var(--bg-surface);
}

.chat-list-item .chat-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
}

.chat-list-item .online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--success);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-dark);
}

.chat-list-item .chat-info {
  flex: 1;
  min-width: 0;
}

.chat-list-item .chat-name {
  font-size: var(--font-md);
  font-weight: var(--font-weight-bold);
  margin-bottom: 2px;
}

.chat-list-item .chat-last-msg {
  font-size: var(--font-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-item .chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.chat-list-item .chat-time {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.chat-list-item .unread-badge {
  min-width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  padding: 0 6px;
}

/* Chat room */
.chat-room {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-room-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  padding-top: calc(var(--safe-top) + var(--space-sm));
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  min-height: var(--navbar-height);
}

.chat-room-header .back-btn {
  font-size: 20px;
  padding: var(--space-xs);
}

.chat-room-header .room-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.chat-room-header .room-info {
  flex: 1;
}

.chat-room-header .room-name {
  font-size: var(--font-md);
  font-weight: var(--font-weight-bold);
}

.chat-room-header .room-status {
  font-size: var(--font-xs);
  color: var(--success);
}

/* Messages area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.message-bubble {
  max-width: 80%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: var(--font-sm);
  line-height: 1.4;
  position: relative;
  animation: msgSlideIn 0.2s ease;
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble.sent {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: var(--radius-xs, 4px);
}

.message-bubble.received {
  align-self: flex-start;
  background: var(--bg-elevated);
  border-bottom-left-radius: var(--radius-xs, 4px);
}

.message-bubble .msg-sender {
  font-size: var(--font-xs);
  font-weight: var(--font-weight-bold);
  color: var(--primary-light);
  margin-bottom: 2px;
}

.message-bubble .msg-time {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  text-align: right;
  margin-top: 4px;
}

.message-bubble.received .msg-time {
  color: var(--text-muted);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Message input */
.message-input-area {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  padding-bottom: calc(var(--safe-bottom) + var(--space-sm));
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
}

.message-input-area .msg-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: var(--font-md);
  resize: none;
  overflow-y: auto;
}

.message-input-area .msg-input:focus {
  border-color: var(--primary);
}

.message-input-area .send-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: var(--radius-full);
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.message-input-area .send-btn:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

/* Group chat rooms list */
.room-categories {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.room-category-chip {
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: var(--font-sm);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.room-category-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
