/* Modals & Setup */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(250, 237, 240, 0.85);
  backdrop-filter: blur(8px);
  padding: 20px;
}

.modal-card {
  width: 100%; max-width: 420px;
  background: #FFFFFF;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.95) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.brand-icon {
  width: 72px; height: 72px;
  margin: 0 auto 24px;
  object-fit: cover;
}

.modal-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: var(--text-main); }
.modal-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; line-height: 1.5; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
  width: 100%; padding: 14px 16px;
  background: #FAFAFA;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
  color: var(--text-main);
  transition: all 0.2s ease;
  outline: none;
}
.form-input:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-main {
  width: 100%; padding: 16px;
  background: var(--primary);
  color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-main:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Left Sidebar (Rooms) */
.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: space-between;
}
.user-profile { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--primary-light); }
.user-info h3 { font-size: 16px; font-weight: 600; }
.user-info p { font-size: 12px; color: var(--text-muted); }

.rooms-list {
  flex: 1; overflow-y: auto; padding: 12px;
}
.room-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}
.room-item:hover { background: #FAFAFA; }
.room-item.active { background: var(--primary-light); }
.room-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: white; display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: var(--shadow-sm);
}
.room-details { flex: 1; overflow: hidden; }
.room-name { font-size: 15px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-last { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }

.btn-add-room {
  margin: 20px; padding: 14px;
  background: var(--primary-light); color: var(--primary-hover);
  border: 2px dashed var(--primary); border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-add-room:hover { background: var(--primary); color: white; border-style: solid; }

/* Center Chat */
.chat-header {
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; gap: 16px;
  z-index: 10; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.back-btn { display: none; background: none; border: none; font-size: 24px; color: var(--text-main); cursor: pointer; }
.chat-header-info { flex: 1; }
.chat-header-info h2 { font-size: 18px; font-weight: 700; }
.chat-status { font-size: 13px; color: var(--primary); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chat-status::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--primary); border-radius: 50%; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
}

.empty-chat {
  margin: auto; text-align: center; max-width: 300px;
}
.empty-banner { width: 100%; border-radius: var(--radius-lg); margin-bottom: 20px; box-shadow: var(--shadow-md); }
.empty-chat h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
.empty-chat p { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

.msg {
  display: flex; flex-direction: column;
  max-width: 75%;
  animation: msgPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.msg.sent { align-self: flex-end; }
.msg.recv { align-self: flex-start; }
.msg-sender { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; padding: 0 4px; }
.msg.sent .msg-sender { display: none; }

.msg-bubble {
  padding: 14px 18px;
  font-size: 15px; line-height: 1.5;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.msg.sent .msg-bubble {
  background: var(--msg-sent); color: var(--msg-sent-text);
  border-radius: 20px 20px 4px 20px;
}
.msg.recv .msg-bubble {
  background: var(--msg-recv); color: var(--msg-recv-text);
  border-radius: 20px 20px 20px 4px;
}

.msg-image { max-width: 100%; border-radius: 12px; margin-top: 8px; cursor: pointer; display: block; }
.msg-time {
  font-size: 11px; color: var(--text-muted);
  margin-top: 6px; display: flex; align-items: center; gap: 4px;
}
.msg.sent .msg-time { justify-content: flex-end; }

.chat-input-area {
  padding: 20px 24px;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.input-wrapper {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-main);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}
.btn-attach {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 8px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-attach:hover { color: var(--primary); background: var(--surface); }
.file-input-hidden { display: none; }

.chat-textarea {
  flex: 1; border: none; background: none; outline: none;
  font-family: inherit; font-size: 15px; color: var(--text-main);
  padding: 10px 0; resize: none; max-height: 100px;
}

.btn-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: white;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}
.btn-send:hover:not(:disabled) { transform: scale(1.05); background: var(--primary-hover); }
.btn-send:disabled { background: var(--text-light); cursor: not-allowed; }

/* Right Sidebar (Details) */
.details-header {
  padding: 24px; text-align: center; border-bottom: 1px solid var(--divider);
}
.details-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  margin: 0 auto 16px; object-fit: cover; border: 4px solid var(--primary-light);
}
.details-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.details-desc { font-size: 14px; color: var(--text-muted); }

.details-actions {
  display: flex; justify-content: center; gap: 16px; padding: 20px;
}
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  transition: color 0.2s;
}
.action-btn .icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-main); display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--primary);
}
.action-btn:hover { color: var(--primary); }

.about-footer {
  margin-top: auto; padding: 24px; text-align: center;
  border-top: 1px solid var(--divider);
  font-size: 12px; color: var(--text-light); line-height: 1.6;
}

@media (max-width: 768px) {
  .back-btn { display: block; }
  .chat-header { border-radius: 0; }
  .chat-input-area { border-radius: 0; }
}
