/* =========================================================================
   CORE DESIGN SYSTEM & VARIABLE DEFINITIONS (APPLE/NOTION STYLE)
   ========================================================================= */
:root {
  --bg-primary: #121212;
  --bg-secondary: #181818;
  --bg-tertiary: #222222;
  --bg-active: #2A2A2A;
  --bg-hover: rgba(255, 255, 255, 0.05);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.25);
  
  --text-primary: #F9FAFB;
  --text-secondary: #8E8E93;
  --text-muted: #636366;
  
  --accent-light: #FFFFFF;
  --accent-dark: #000000;
  --accent-blue: #0A84FF;
  
  --danger-color: #FF453A;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --letter-spacing-tight: -0.015em;
  --letter-spacing-tighter: -0.025em;
  
  --transition-smooth: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --radius-minimal: 6px;
  --radius-bubble: 8px;
}

/* =========================================================================
   GLOBAL RESET & INITIALIZATION
   ========================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  letter-spacing: var(--letter-spacing-tight);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Scrollbar customizations */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hide {
  display: none !important;
}

/* =========================================================================
   LOADING COVER OVERLAY
   ========================================================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-primary);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================================
   1. AUTHENTICATION LANDING CARD STYLE
   ========================================================================= */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.015) 0%, transparent 70%);
}

.auth-card {
  width: 360px;
  padding: 40px 32px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-header {
  margin-bottom: 36px;
}

.brand-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tighter);
  color: var(--text-primary);
  margin-bottom: 6px;
}

.brand-title .accent-dot {
  color: var(--text-secondary);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.google-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  background-color: var(--accent-light);
  color: var(--accent-dark);
  border: none;
  border-radius: var(--radius-minimal);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.google-signin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
  background-color: #f3f3f3;
}

.google-signin-btn:active {
  transform: translateY(0);
}

.auth-footer {
  margin-top: 24px;
}

.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* =========================================================================
   2. MAIN WORKSPACE CONTAINER LAYOUT
   ========================================================================= */
.workspace-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-primary);
}

/* =========================================================================
   SIDEBAR COMPONENT
   ========================================================================= */
.sidebar {
  width: 240px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tighter);
}

.brand-name .accent-dot {
  color: var(--text-secondary);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-minimal);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-scroll {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px 8px;
}

.list-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0 8px 8px 8px;
  text-transform: uppercase;
}

.channels-list {
  list-style: none;
}

.channels-list li {
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-minimal);
  cursor: pointer;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.channels-list li:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.channels-list li.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.channels-list li svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.channels-list li.active svg {
  color: var(--text-primary);
}

.loading-item {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  cursor: default !important;
  background: transparent !important;
}

/* Sidebar Footer Details */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: rgba(0, 0, 0, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  max-width: 160px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-sub {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-icon.danger:hover {
  background-color: rgba(255, 69, 58, 0.1);
  color: var(--danger-color);
}

/* =========================================================================
   CHAT VIEWPORT PANEL
   ========================================================================= */
.chat-viewport {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
}

.chat-header {
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.room-details {
  display: flex;
  flex-direction: column;
}

.room-title {
  font-size: 14.5px;
  font-weight: 600;
}

.room-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* =========================================================================
   MESSAGE LOG HISTORY SECTION
   ========================================================================= */
.messages-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Welcome intro view */
.welcome-box {
  margin: auto;
  text-align: center;
  max-width: 320px;
  padding: 40px 20px;
}

.welcome-icon {
  display: inline-flex;
  padding: 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.welcome-box h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-box p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Chat Message Cards */
@keyframes messageSlideUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 75%;
  animation: messageSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-item.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-sender-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
  flex-shrink: 0;
}

.msg-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 44px);
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
}

.msg-author {
  font-weight: 600;
  color: var(--text-primary);
}

.msg-time {
  color: var(--text-muted);
}

.message-item.own .msg-meta {
  flex-direction: row-reverse;
}

.message-item.own .msg-author {
  display: none; /* Hide own display name on own messages for minimalism */
}

/* Premium Minimalist Bubble */
.msg-bubble {
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: var(--radius-bubble);
  word-break: break-word;
  white-space: pre-wrap;
}

/* Received Message Bubble styling: Notion styled dark gray */
.message-item:not(.own) .msg-bubble {
  background-color: var(--bg-secondary);
  color: #ffffff; /* 가독성을 위해 흰색으로 변경 */
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 2px;
}

/* Own Message Bubble styling: Modern white bubble, black text (Premium Minimalism) */
.message-item.own .msg-bubble {
  background-color: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid var(--accent-light);
  border-top-right-radius: 2px;
  font-weight: 500;
}

/* Attachment layout styling inside bubbles */
.msg-attachment {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
}

.attachment-image-card {
  max-width: 320px;
  max-height: 240px;
  border-radius: var(--radius-minimal);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.attachment-image-card:hover {
  opacity: 0.9;
}

.attachment-file-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background-color: #1e1f22; /* 고급스러운 다크 그레이 */
  border: 1px solid rgba(255, 255, 255, 0.1); /* 은은한 반투명 화이트 */
  border-radius: 8px; /* 라운딩 */
  text-decoration: none;
  color: #e3e5e8; /* 밝은 실버 화이트 */
  font-size: 12px;
  margin-top: 4px;
  transition: var(--transition-smooth);
  max-width: 280px;
}

.attachment-file-card:hover {
  background-color: #2a2b2d;
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff; /* 마우스 호버 시 완전한 흰색 */
  text-decoration: underline; /* 다운로드 링크 유도 밑줄 */
}

/* Override attachment card if inside an own message bubble to unify with dark theme */
.message-item.own .attachment-file-card {
  background-color: #1e1f22;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e3e5e8;
}

.message-item.own .attachment-file-card:hover {
  background-color: #2a2b2d;
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.attachment-file-card svg {
  width: 16px;
  height: 16px;
  color: #e3e5e8 !important; /* 아이콘 실버 화이트 통일 */
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.attachment-file-card:hover svg {
  color: #ffffff !important;
}

.message-item.own .attachment-file-card svg {
  color: #e3e5e8 !important;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.attachment-name {
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: #ffffff !important; /* 파일 이름 깨끗한 흰색 강제 */
}

.attachment-size-lbl {
  font-size: 10px;
  color: #e3e5e8 !important; /* 파일 크기 실버 화이트 강제 */
}

.message-item.own .attachment-size-lbl {
  color: #e3e5e8 !important;
}

/* =========================================================================
   TYPING AWARENESS INDICATORS
   ========================================================================= */
.typing-indicator {
  position: absolute;
  bottom: 74px;
  left: 24px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background-color: rgba(18, 18, 18, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================================
   FOOTER CHAT CONTROL INPUT PANEL
   ========================================================================= */
.chat-footer-bar {
  padding: 16px 24px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-panel {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-minimal);
  padding: 4px 10px;
  gap: 8px;
  transition: var(--transition-smooth);
}

.input-panel:focus-within {
  border-color: var(--border-focus);
}

.btn-footer-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-footer-icon:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.btn-footer-icon svg {
  width: 16px;
  height: 16px;
}

.message-form {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-form input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 10px 4px;
}

.message-form input::placeholder {
  color: var(--text-muted);
}

.message-form input:disabled {
  cursor: not-allowed;
}

.btn-send-icon {
  background: var(--accent-light);
  border: none;
  color: var(--accent-dark);
  padding: 8px;
  border-radius: var(--radius-minimal);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-send-icon:hover {
  opacity: 0.9;
}

.btn-send-icon:disabled {
  background: transparent;
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-send-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5px;
}

/* =========================================================================
   BINARY UPLOAD PERCENT PROGRESS MONITOR
   ========================================================================= */
.upload-progress-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-minimal);
  padding: 10px 14px;
}

.upload-progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
}

.upload-progress-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.upload-progress-val {
  font-weight: 600;
}

.upload-progress-track {
  height: 3px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--text-primary);
  transition: width 0.1s linear;
}

.spin {
  animation: spin 1s linear infinite;
}
.icon-small {
  width: 12px;
  height: 12px;
}

/* =========================================================================
   MODAL POPUP DIALOG WINDOWS (NOTION CARD STYLE)
   ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  z-index: 1001;
  width: 400px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-minimal);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input:focus {
  border-color: var(--border-focus);
}

.form-tip {
  font-size: 10.5px;
  color: var(--text-muted);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-minimal);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.btn-primary {
  background-color: var(--accent-light);
  border: none;
  color: var(--accent-dark);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-minimal);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  opacity: 0.9;
}

/* =========================================================================
   SIDEBAR NAV TABS (FRIENDS / CHATS)
   ========================================================================= */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 8px;
  background-color: rgba(0, 0, 0, 0.05);
}

.tab-button {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 12px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.tab-button:hover {
  color: var(--text-primary);
}

.tab-button.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-light);
}

.tab-icon {
  width: 14px !important;
  height: 14px !important;
}

.tab-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* =========================================================================
   MY PROFILE CARD
   ========================================================================= */
.my-profile-section {
  padding: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.my-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-minimal);
}

.avatar-small {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  object-fit: cover;
}

.my-profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.my-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.my-nickname {
  font-size: 11px;
  color: var(--text-secondary);
}

/* =========================================================================
   FRIENDS & CHATS DYNAMIC LISTS
   ========================================================================= */
.friends-list, .rooms-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.friends-list li, .rooms-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-minimal);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.friends-list li:hover, .rooms-list li:hover {
  background-color: var(--bg-hover);
}

.friends-list li.active, .rooms-list li.active {
  background-color: var(--bg-tertiary);
}

.friend-name-display {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.friend-name-display span.nick {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Chat rooms items with Kakaotalk layouts */
.room-item-meta {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.room-name-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-sidebar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.room-sidebar-count {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 8px;
}

.room-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.last-msg-preview {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* =========================================================================
   ONBOARDING BLOCKED LAYOUT STYLES (FLOW A)
   ========================================================================= */
.onboarding-backdrop {
  background-color: #0b0b0b !important;
  backdrop-filter: blur(15px) !important;
  opacity: 0.98;
}

.onboarding-modal {
  z-index: 10000 !important;
}

.full-width {
  width: 100% !important;
  justify-content: center;
}

.form-error {
  color: var(--danger-color);
  font-size: 11.5px;
  margin-top: 4px;
}

.form-success {
  color: #34A853;
  font-size: 11.5px;
  margin-top: 4px;
}

/* =========================================================================
   CHAT HEADER RE-DESIGN (MEMBER COUNT & EDIT INPUT)
   ========================================================================= */
.title-container {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.room-title-input {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-minimal);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  padding: 4px 8px;
  outline: none;
  width: 240px;
}

.member-count-badge {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 12px;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =========================================================================
   SYSTEM CHAT MESSAGES
   ========================================================================= */
.message-item.system {
  align-self: center !important;
  max-width: 90% !important;
  width: 100%;
  justify-content: center;
  margin: 12px 0;
  animation: messageSlideUp 0.2s ease forwards;
}

.message-item.system .msg-bubble {
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-subtle) !important;
  font-size: 11.5px !important;
  padding: 6px 16px !important;
  border-radius: 16px !important;
  text-align: center;
  font-weight: 400;
}

/* =========================================================================
   CHECKBOX LIST FOR GROUP CHAT CREATION / INVITE
   ========================================================================= */
.friends-select-list {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-minimal);
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}

.select-friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.select-friend-item:hover {
  background-color: var(--bg-hover);
}

.select-friend-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--text-primary);
  cursor: pointer;
}

.select-friend-item label {
  flex-grow: 1;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-tip {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
}

/* =========================================================================
   TEXTAREA CHAT FORM CONVERSION
   ========================================================================= */
.message-form textarea {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 10px 4px;
  resize: none;
  max-height: 120px;
  min-height: 20px;
  line-height: 1.4;
  overflow-y: auto;
}

.message-form textarea::placeholder {
  color: var(--text-muted);
}

.message-form textarea:disabled {
  cursor: not-allowed;
}

/* =========================================================================
   FILE UPLOAD PREVIEW PANEL
   ========================================================================= */
.file-preview-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-minimal);
  padding: 8px 12px;
  margin-bottom: 8px;
  animation: messageSlideUp 0.2s ease forwards;
}

.file-preview-content {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.file-preview-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.file-preview-name {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  flex-grow: 1;
}

.btn-clear-file {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-clear-file:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* =========================================================================
   PROFILE CARD MODAL
   ========================================================================= */
.profile-card-modal {
  width: 320px !important;
  text-align: center;
}

.profile-avatar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.profile-modal-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-subtle);
  background-color: var(--bg-tertiary);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-modal-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.profile-modal-info h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-modal-info p#profile-modal-nickname {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.profile-modal-info p#profile-modal-email {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#btn-profile-friend-added {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-secondary) !important;
  cursor: not-allowed;
}

/* Non-Friend Warning Banner */
.warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 69, 58, 0.15);
  border-bottom: 1px solid rgba(255, 69, 58, 0.3);
  padding: 10px 24px;
  font-size: 13px;
  color: #FF453A;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.warning-banner-text {
  font-weight: 500;
}

.btn-warning-ignore {
  background: transparent;
  border: 1px solid rgba(255, 69, 58, 0.4);
  color: #FF453A;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-warning-ignore:hover {
  background-color: rgba(255, 69, 58, 0.2);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

