/* ========== SKELETON LOADING ========== */
@keyframes skeleton-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.3; }
  100% { opacity: 0.6; }
}

.skeleton-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--divider);
  flex-shrink: 0;
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 10px;
  border-radius: 4px;
  background: var(--divider);
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long { width: 95%; }

.skeleton-msg-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 20px;
}

.skeleton-msg-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-msg-line {
  height: 12px;
  border-radius: 4px;
  background: var(--divider);
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-msg-line.name { width: 30%; height: 10px; }
.skeleton-msg-line.body { width: 75%; }
.skeleton-msg-line.body-short { width: 50%; }

.skeleton-pagination-loader {
  border-bottom: 1px dashed var(--divider);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

/* ========== TOGGLES ========== */
.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px dashed var(--divider);
}

.toggle-item:last-child { border: none; }
.toggle-info { flex: 1; }
.toggle-label { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.toggle-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

.toggle {
  width: 48px;
  height: 28px;
  background: var(--grey-400);
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle.active { background: var(--primary); }

.toggle::after {
  content: '';
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: var(--shadow-z1);
}

.toggle.active::after { left: 23px; }

/* ========== TABS ========== */
.tabs {
  display: flex;
  background: var(--bg-neutral);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  border-radius: calc(var(--radius) - 2px);
  font-family: inherit;
}

.tab.active {
  color: var(--text-primary);
  background: var(--bg-paper);
  box-shadow: var(--shadow-z1);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== CARDS ========== */
.card {
  background: var(--bg-neutral);
  border-radius: calc(var(--radius) * 1.5);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }

/* ========== USER LIST ITEMS ========== */
.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: calc(var(--radius) * 1.5);
  cursor: pointer;
  transition: var(--transition);
}

.user-item:hover { background: var(--bg-neutral); }

.user-item-avatar { width: 44px; height: 44px; border-radius: calc(var(--radius) * 1.5); position: relative; }
.user-item-info { flex: 1; min-width: 0; }
.user-item-name { font-size: 0.875rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.user-item-status { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.user-item-action { opacity: 0; transition: var(--transition); }
.user-item:hover .user-item-action { opacity: 1; }

/* ========== INVITE SECTION ========== */
.invite-code-box {
  background: linear-gradient(135deg, rgba(0,167,111,0.08) 0%, rgba(0,167,111,0.02) 100%);
  border-radius: calc(var(--radius) * 2);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
  border: 1px dashed var(--primary);
}

.invite-code {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--primary);
  font-family: 'Inter', monospace;
  margin: 12px 0;
}

.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; }

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: calc(var(--radius) * 1.5);
  border: none;
  background: var(--bg-neutral);
  cursor: pointer;
  transition: var(--transition);
}

.share-btn:hover { transform: translateY(-4px); box-shadow: var(--shadow-z8); }
.share-btn i { font-size: 1.5rem; }
.share-btn span { font-size: 0.6875rem; color: var(--text-secondary); font-weight: 500; }
.share-btn.whatsapp i { color: #25D366; }
.share-btn.telegram i { color: #0088cc; }
.share-btn.twitter i { color: #1DA1F2; }
.share-btn.link i { color: var(--primary); }

/* ========== QR CODE ========== */
.qr-container { display: flex; flex-direction: column; align-items: center; padding: 24px; }

.qr-code {
  width: 200px;
  height: 200px;
  background: white;
  border-radius: calc(var(--radius) * 2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.qr-placeholder {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(45deg, var(--grey-800) 0, var(--grey-800) 2px, white 2px, white 8px);
  opacity: 0.9;
  border-radius: var(--radius);
}

/* ========== ACHIEVEMENTS ========== */
.achievements-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: calc(var(--radius) * 1.5);
  background: var(--bg-paper);
  box-shadow: var(--shadow-z1);
  transition: var(--transition);
}

.achievement:hover { transform: translateY(-4px); box-shadow: var(--shadow-z8); }
.achievement.locked { opacity: 0.5; }

.achievement-icon {
  width: 44px;
  height: 44px;
  border-radius: calc(var(--radius) * 1.5);
  background: linear-gradient(135deg, var(--warning) 0%, #FF8800 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.achievement.locked .achievement-icon { background: var(--grey-400); }
.achievement-name { font-size: 0.6875rem; color: var(--text-secondary); text-align: center; font-weight: 500; }

/* ========== STATS ========== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }

.stat-item {
  text-align: center;
  padding: 16px 8px;
  background: var(--bg-paper);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-z1);
}

.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.6875rem; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

/* ========== DISCOVER GRID ========== */
.discover-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.discover-item {
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  position: relative;
  aspect-ratio: 1;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.discover-item:hover { transform: scale(1.02); }
.discover-item img { width: 100%; height: 100%; object-fit: cover; }
.discover-item video { width: 100%; height: 100%; object-fit: cover; }

.discover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgba(0,0,0,0.8));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
}

.discover-room { font-size: 0.75rem; color: white; font-weight: 600; }
.discover-stats { font-size: 0.6875rem; color: rgba(255,255,255,0.8); display: flex; gap: 12px; margin-top: 4px; }

/* ========== ROOM MEMBERS ========== */
.room-members { max-height: 240px; overflow-y: auto; }

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--divider);
}

.member-item:last-child { border: none; }

.member-role {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-neutral);
  color: var(--text-disabled);
}

.member-role.admin { background: rgba(0,167,111,0.08); color: var(--primary); }

/* ========== TOOLTIPS ========== */
.tooltip-wrapper { position: relative; }

.tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--grey-800);
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 100;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--grey-800);
}

.tooltip-wrapper:hover .tooltip { opacity: 1; visibility: visible; }

/* ========== ACCESSIBILITY CONTROLS ========== */
.a11y-controls { display: flex; align-items: center; gap: 12px; }
.font-control { display: flex; align-items: center; gap: 8px; }

.font-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--divider);
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: var(--transition);
}

.font-btn:hover { background: var(--bg-neutral); border-color: var(--primary); }
.font-size-display { font-size: 0.8125rem; min-width: 44px; text-align: center; font-weight: 600; }

/* ========== NOTIFICATION TABS ========== */
.notif-tabs {
  display: flex;
  background: var(--bg-neutral);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 16px;
}

.notif-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: var(--transition);
  font-family: inherit;
}

.notif-tab.active {
  color: var(--text-primary);
  background: var(--bg-paper);
  box-shadow: var(--shadow-z1);
}

.notif-tab:hover:not(.active) { color: var(--text-primary); }

/* ========== STARRED MESSAGES ========== */
.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius) * 1.5);
  object-fit: cover;
}

.profile-avatar-camera {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  background: var(--bg-paper);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--divider);
}

.profile-avatar-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.starred-item {
  padding: 16px 24px;
  border-bottom: 1px dashed var(--divider);
  transition: var(--transition);
}

.starred-item:hover { background: var(--bg-neutral); }

.starred-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.starred-item-chat {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.starred-item-unstar {
  background: rgba(255,171,0,0.12);
  border: none;
  color: var(--warning);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.starred-item-unstar:hover { background: rgba(255,171,0,0.2); }

.starred-item-body {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--bg-neutral);
  border-radius: var(--radius);
  border-left: 3px solid var(--warning);
}

.starred-item-body:hover { background: rgba(145, 158, 171, 0.16); }

.starred-item-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.starred-item-text {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.starred-item-media {
  max-width: 160px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 6px;
}

.starred-item-media img { width: 100%; display: block; border-radius: var(--radius); }

.starred-item-time {
  font-size: 0.6875rem;
  color: var(--text-disabled);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========== HEADER MENU (HAMBURGER DROPDOWN) ========== */
.header-menu-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-paper);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  min-width: 210px;
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  border: 1px solid var(--border-color, rgba(0,0,0,0.08));
}

.header-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.13s;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.header-dropdown-item i {
  width: 18px;
  text-align: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.header-dropdown-item:hover {
  background: var(--bg-neutral);
}

.header-dropdown-item:hover i {
  color: var(--primary);
}

.header-dropdown-item.danger { color: var(--danger, #f44336); }
.header-dropdown-item.danger i { color: var(--danger, #f44336); }

.header-dropdown-divider {
  height: 1px;
  background: var(--border-color, var(--divider));
  margin: 4px 0;
}

/* Join Room header button */
.header-join-btn {
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: var(--radius);
}

/* Pencil edit button inside h3#chatName */
.header-edit-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  vertical-align: middle;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  color: var(--text-disabled);
}

.header-edit-btn:hover {
  background: rgba(0,167,111,0.1);
  color: var(--primary);
  opacity: 1 !important;
}

/* Similar rooms link in subheader */
#chatStatusSimilar a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s;
}

#chatStatusSimilar a:hover { opacity: 0.75; }

/* Similar rooms modal list items hover handled inline */

