*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-body: #e8edf2;
  --bg-white: #ffffff;
  --bg-light: #f5f7fa;
  --bg-chat: #efeae2;
  --text-dark: #1a1a2e;
  --text-mid: #4a4a6a;
  --text-light: #8e8ea0;
  --accent: #2979ff;
  --accent-hover: #1565c0;
  --accent-light: #e3f0ff;
  --danger: #e53935;
  --success: #43a047;
  --badge-public: #2979ff;
  --border: #e0e4ea;
  --border-light: #eef1f5;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-dark);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
}
html {
  width: 100%;
  overflow-x: hidden;
}

/* ======================== AUTH ======================== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #e3f0ff 0%, #f5f7fa 100%);
}

.auth-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.auth-card p {
  color: var(--text-light);
  margin-bottom: 28px;
  font-size: 14px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 5px;
}
.form-group input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent); }

.btn {
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 6px 0;
}
.btn-ghost:hover { color: var(--accent-hover); }
.btn-sm { padding: 7px 14px; font-size: 13px; }

.auth-guest-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light, #e8eaed);
}
.auth-guest-divider {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 12px;
}
.btn-guest {
  width: 100%;
  margin-top: 8px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-light);
}

.error-msg {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: var(--danger);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

/* ======================== CHAT LAYOUT ======================== */
.chat-app {
  display: none;
  height: 100vh;
}
.chat-app.active {
  display: grid;
  grid-template-columns: 310px 1fr 260px;
}
.chat-app.active > .sidebar,
.chat-app.active > .chat-area,
.chat-app.active > .right-panel {
  min-width: 0;
}
@media (min-width: 769px) {
  .chat-app.active.right-hidden {
    grid-template-columns: 310px 1fr;
  }
  .chat-app.active.right-hidden .right-panel {
    display: none !important;
  }
}

/* ======================== SIDEBAR ======================== */
.sidebar {
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar User Header */
.sidebar-user-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}
.sidebar-user-header .user-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-header .user-header-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-header .user-header-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}
.sidebar-user-header .user-header-status {
  font-size: 11px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-user-header .user-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
}
.role-badge.user-role { background: #78909c; }
.btn-header-icon {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all 0.15s;
}
.btn-header-icon:hover { color: var(--danger); background: #fdecea; }

/* Navigation Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}
.sidebar-tab {
  flex: 1;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
}
.sidebar-tab:hover { color: var(--accent); }
.sidebar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.sidebar-tab .tab-icon { font-size: 18px; }
.tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 16px);
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Search */
.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238e8ea0' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}
.sidebar-search input:focus { border-color: var(--accent); }

/* Sidebar Tab Content */
.sidebar-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.sidebar-tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Room List */
.room-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

/* Online Users List — kart satırlar: members-panel.css */
.online-users-list {
  flex: 1;
  overflow-y: auto;
}
.online-user-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.online-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
}
.online-user-avatar .online-dot-sm {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-white);
}
.online-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  flex: 1;
}
.online-user-status {
  font-size: 11px;
  color: var(--success);
}

/* Chat List — kart satırlar: members-panel.css */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.chat-conversations-list {
  flex: 1;
  overflow-y: auto;
}

.chat-list-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 42px;
  max-height: 42px;
  border-radius: 50%;
  background: var(--bg-light);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.chat-list-avatar img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  display: block;
}
.chat-list-info { flex: 1; min-width: 0; }
.chat-list-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-last-msg {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.chat-list-time {
  font-size: 10px;
  color: var(--text-light);
}
.chat-list-unread {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Empty list message */
.list-empty {
  text-align: center;
  color: var(--text-light);
  padding: 40px 20px;
  font-size: 13px;
}
.list-empty-icon {
  font-size: 36px;
  opacity: 0.2;
  margin-bottom: 8px;
}

.room-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.room-item:hover { background: var(--bg-light); }
.room-item.active { background: var(--accent-light); }

.room-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-light);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.room-item.active .room-avatar { border-color: var(--accent); }

.room-info {
  flex: 1;
  min-width: 0;
}
.room-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.room-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-public {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--badge-public);
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.room-desc {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.room-count-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-light);
}
.room-count-badge svg { width: 14px; height: 14px; }
.room-count-badge.has-users { color: var(--success); }
.room-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

/* New Room Section (admin only) */
.new-room-section {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.new-room-input {
  display: flex;
  gap: 6px;
}
.new-room-input input {
  flex: 1;
  padding: 9px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-size: 13px;
  outline: none;
}
.new-room-input input:focus { border-color: var(--accent); }

/* ======================== CHAT AREA ======================== */
.chat-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-chat);
}

/* Chat Header */
.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.chat-header-info { flex: 1; }
.chat-header-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}
.chat-header-info span {
  font-size: 12px;
  color: var(--text-light);
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-header-actions button {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all 0.15s;
}
.chat-header-actions button:hover { background: var(--bg-light); color: var(--accent); }

/* Announcement bar (legacy — gizli tutulur) */
.announcement-bar {
  display: none !important;
}

/* Oda duyurusu — sohbet alanı içi, süreli */
.room-announcement-float {
  position: sticky;
  top: 8px;
  z-index: 4;
  margin: 0 12px 10px;
  padding: 10px 14px;
  background: #fff8e1;
  border: 1px solid #ffca28;
  border-radius: var(--radius);
  font-size: 13px;
  color: #6d4c00;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.room-announcement-float.room-announcement-hide {
  opacity: 0;
  transform: translateY(-6px);
}
.room-announcement-icon { flex-shrink: 0; font-size: 16px; }
.room-announcement-text { line-height: 1.4; text-align: center; }
body.theme-dark .room-announcement-float {
  background: #3d3520;
  border-color: #8d6e00;
  color: #ffe082;
}

/* Chat notice bar */
.chat-notice {
  padding: 8px 20px;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--accent);
  text-align: center;
}

/* Canlı oda katmanı — mesajlar arkada, sahne üstte (TikTok tarzı) */
.chat-live-shell {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-chat);
  z-index: 1;
}
.chat-live-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg-chat);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.chat-live-shell.has-room-bg {
  background: transparent;
}
.chat-live-shell.has-room-bg:not(.has-live-voice) .chat-live-vignette {
  opacity: 0.65;
}
.chat-live-shell .messages-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  flex: none;
  background: transparent !important;
}
.chat-live-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background:
    linear-gradient(180deg, rgba(8, 10, 20, 0.55) 0%, transparent 38%, transparent 62%, rgba(8, 10, 20, 0.35) 100%);
}
.chat-live-shell.has-live-voice .chat-live-vignette {
  opacity: 1;
}
.chat-live-shell.has-room-bg .chat-live-vignette {
  opacity: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 42%, transparent 68%, rgba(0, 0, 0, 0.22) 100%);
}
.chat-live-shell.has-room-bg.has-live-voice .chat-live-vignette {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0%, transparent 38%, transparent 62%, rgba(0, 0, 0, 0.3) 100%);
}
.chat-live-shell .scroll-bottom-btn {
  position: absolute;
  right: 16px;
  bottom: 12px;
  z-index: 15;
}
.chat-live-shell .typing-bubbles-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  z-index: 12;
  padding: 6px 12px;
  pointer-events: none;
}
.chat-live-shell .typing-bubble {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
}

/* Messages — WhatsApp-style layout */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background-color: var(--bg-chat);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d9d0c7' fill-opacity='0.35'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Canlı modda mesajlar sahnenin arkasında akar */
.chat-live-shell.has-live-voice .messages-container {
  justify-content: flex-end;
  padding: 12px 14px 80px;
  gap: 6px;
  scroll-behavior: smooth;
  mask-image: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 18%,
    black 32%,
    black 100%
  );
  -webkit-mask-image: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 18%,
    black 32%,
    black 100%
  );
}
.chat-live-shell.has-live-voice .message {
  max-width: 82%;
  margin-left: 0;
  margin-right: auto;
  animation: live-msg-in 0.35s ease;
}
@keyframes live-msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-live-shell.has-live-voice .message.own {
  margin-left: auto;
  margin-right: 0;
}
.chat-live-shell.has-live-voice .message-profile {
  opacity: 0.92;
}
.chat-live-shell.has-live-voice .message-avatar-wrap {
  width: 30px;
  height: 30px;
  font-size: 11px;
}
.chat-live-shell.has-live-voice .message-sender {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.chat-live-shell.has-live-voice .message-bubble {
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  font-size: 13px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-live-shell.has-live-voice .message.own .message-bubble {
  background: rgba(41, 121, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.12);
}
.chat-live-shell.has-live-voice .message-time {
  color: rgba(255, 255, 255, 0.55);
}
.chat-live-shell.has-live-voice .system-message {
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  max-width: 90%;
  margin: 4px auto;
}
.chat-live-shell.has-live-voice .date-separator span {
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
}
.chat-live-shell.has-live-voice .empty-chat {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 78%;
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.own {
  flex-direction: row-reverse;
  margin-left: auto;
}

/* Sol: avatar üstte, isim altta ortalı */
.message-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 42px;
  flex-shrink: 0;
  padding-top: 2px;
}
.message-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(11, 20, 26, 0.15);
}
.message-sender {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.message.own .message-main {
  align-items: flex-end;
}

/* Orta: balon | Sağ: tepkiler */
.message-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}
.message.own .message-bubble-row {
  flex-direction: row-reverse;
}

.message-bubble-wrap {
  position: relative;
  display: inline-block;
  max-width: min(100%, 420px);
}

.message-bubble {
  background: #fff;
  padding: 7px 10px 8px 11px;
  border-radius: 0 12px 12px 12px;
  font-size: 14.2px;
  line-height: 20px;
  word-break: break-word;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  color: #111b21;
}
.message.own .message-bubble {
  background: #d9fdd3;
  border-radius: 12px 0 12px 12px;
}

.message-bubble-content {
  display: block;
}
.message-bubble-content .msg-text-block {
  margin-top: 0;
}
.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.message-time {
  font-size: 11px;
  color: #667781;
  line-height: 1;
  white-space: nowrap;
}
.message-edited {
  font-size: 10px;
  color: #667781;
  opacity: 0.85;
}

/* Balonun sağında tepki alanı */
.message-react-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  align-self: center;
  min-width: 32px;
}
.message-react-trigger {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #8696a0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(11, 20, 26, 0.12);
  transition: background 0.15s, color 0.15s, transform 0.12s;
  opacity: 0.85;
}
.message:hover .message-react-trigger,
.message-react-trigger:focus-visible {
  opacity: 1;
  color: #54656f;
}
.message-react-trigger:hover {
  background: #fff;
  color: #2979ff;
  transform: scale(1.06);
}
.message-react-trigger:active {
  transform: scale(0.96);
}

.message-reactions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.message-reactions:empty {
  display: none;
}
.reaction-chip {
  border: none;
  background: #fff;
  border-radius: 14px;
  padding: 3px 7px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.12);
  border: 1px solid rgba(11, 20, 26, 0.06);
}
.reaction-chip:hover {
  background: #f5f6f6;
}
.reaction-chip.active {
  background: #e7f3ff;
  border-color: rgba(41, 121, 255, 0.25);
}
.reaction-chip span {
  font-size: 10px;
  color: #667781;
  font-weight: 600;
}
.reaction-add-btn {
  border: none;
  background: transparent;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.12s;
}
.reaction-add-btn:hover {
  background: rgba(11, 20, 26, 0.06);
  transform: scale(1.15);
}
.reaction-picker-popup {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  display: flex;
  gap: 0;
  padding: 5px 8px;
  background: #fff;
  border: 1px solid rgba(11, 20, 26, 0.08);
  border-radius: 28px;
  box-shadow: 0 4px 16px rgba(11, 20, 26, 0.18);
  z-index: 30;
}
.message.own .reaction-picker-popup {
  left: auto;
  right: calc(100% + 8px);
}

.typing-bubbles-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 16px 4px;
  min-height: 8px;
  align-items: flex-end;
}
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 6px 12px 6px 6px;
  box-shadow: var(--shadow-sm);
  animation: typing-bubble-in 0.25s ease;
}
@keyframes typing-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.typing-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.typing-bubble-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.typing-bubble-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  height: 14px;
}
.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-dot-pulse 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot-pulse {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
body.theme-dark .typing-bubble {
  background: var(--bg-light);
  border-color: var(--border);
}

/* Chat Input */
.chat-input-area {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
  position: relative;
}
.chat-admin-notice {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  padding: 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chat-input-actions {
  display: flex;
  gap: 2px;
}
.chat-input-actions button {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all 0.15s;
}
.chat-input-actions button:hover { color: var(--accent); }
.chat-input-wrapper input {
  flex: 1;
  padding: 11px 16px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text-dark);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-wrapper input:focus { border-color: var(--accent); }
.btn-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 18px;
}
.btn-send:hover { background: var(--accent-hover); transform: scale(1.05); }

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  gap: 12px;
}
.empty-chat-icon { font-size: 56px; opacity: 0.25; }
.empty-chat h3 { font-size: 18px; color: var(--text-dark); }
.empty-chat p { font-size: 13px; }

.system-message {
  text-align: center;
  color: var(--text-mid);
  font-size: 12px;
  padding: 8px 16px;
  max-width: 100%;
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  margin: 4px auto;
  width: fit-content;
}

/* ======================== RIGHT PANEL ======================== */
.right-panel {
  background: var(--bg-white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.right-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.right-panel-header .panel-count {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* Stats row */
.right-panel-stats {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.stat-item {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-right: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}
.stat-item:last-child { border-right: none; }
.stat-item:hover { background: var(--bg-light); }
.stat-icon { font-size: 20px; color: var(--text-light); margin-bottom: 4px; }
.stat-value { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.stat-label { font-size: 10px; color: var(--text-light); text-transform: uppercase; }

/* Members list — kart satırlar: members-panel.css */
.members-list {
  flex: 1;
  overflow-y: auto;
}
.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  position: relative;
}
.member-online-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-white);
}
.member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty right panel */
.right-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  font-size: 13px;
  gap: 8px;
  padding: 20px;
  text-align: center;
}
.right-panel-empty .panel-empty-icon { font-size: 40px; opacity: 0.2; }

/* ======================== USER MENU ======================== */
.sidebar-user-header {
  cursor: pointer;
  position: relative;
  z-index: 20;
  overflow: visible;
}

.online-user-item-self {
  cursor: default;
}
.user-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 8px;
  right: 8px;
  width: auto;
  max-width: none;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
}
.user-menu-item {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-menu-item:hover { background: var(--bg-light); }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger:hover { background: #fdecea; }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ======================== MODALS ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-light); color: var(--text-dark); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-body .form-group { margin-bottom: 16px; }
.modal-body .form-group:last-child { margin-bottom: 0; }
.modal-body .btn { margin-top: 8px; }
.modal-body .form-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-success { color: var(--success); font-size: 13px; margin-top: 8px; }
.modal-error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* Admin action list in chat admin modal */
.admin-action-list { display: flex; flex-direction: column; gap: 8px; }
.admin-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.admin-action-item:hover { background: var(--accent-light); }
.admin-action-icon { font-size: 20px; }
.admin-action-info { flex: 1; }
.admin-action-title { font-size: 14px; font-weight: 600; }
.admin-action-desc { font-size: 12px; color: var(--text-light); }

/* Target user select */
.user-select-list { max-height: 200px; overflow-y: auto; margin: 8px 0; }
.user-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
}
.user-select-item:hover { background: var(--accent-light); }
.user-select-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px;
}

/* ======================== CONTEXT MENU ======================== */
.context-menu {
  position: fixed;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 2000;
  min-width: 180px;
  padding: 4px 0;
}
.context-menu-item {
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s;
}
.context-menu-item:hover { background: var(--bg-light); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: #fdecea; }
.context-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Room owner badge in header */
.room-owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #fff3e0;
  color: #e65100;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ======================== EMOJI PICKER ======================== */
.emoji-picker {
  padding: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 320px;
  max-height: 200px;
  overflow-y: auto;
  position: absolute;
  bottom: 60px;
  left: 16px;
}
.emoji-btn {
  width: 32px; height: 32px;
  border: none; background: none;
  font-size: 18px; cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.emoji-btn:hover { background: var(--bg-light); }

/* ======================== SCROLLBAR ======================== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5cad3; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a8b4; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1024px) {
  .chat-app.active { grid-template-columns: 1fr !important; }
  .chat-app.active.right-hidden { grid-template-columns: 1fr !important; }
}

/* ======================== COMFORT / UX ======================== */
body.theme-dark {
  --bg-body: #0f1419;
  --bg-white: #1a2332;
  --bg-light: #243044;
  --bg-chat: #1e2a3a;
  --text-dark: #e8edf2;
  --text-mid: #b0b8c4;
  --text-light: #7a8494;
  --border: #2d3a4d;
  --border-light: #243044;
  --accent-light: #1a3050;
}
body.theme-dark .messages-container {
  background-color: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23182229' fill-opacity='0.8'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
body.theme-dark .message-bubble { background: #202c33; color: #e9edef; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.35); }
body.theme-dark .message.own .message-bubble { background: #005c4b; color: #e9edef; }
body.theme-dark .message-time,
body.theme-dark .message-edited { color: rgba(233, 237, 239, 0.63); }
body.theme-dark .message-sender { color: inherit; }
body.theme-dark .system-message { background: rgba(36,48,68,0.9); color: var(--text-mid); }

.chat-input-wrapper:not(.wa-composer) textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 14px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  line-height: 1.4;
}
.chat-input-wrapper textarea:focus { outline: none; border-color: var(--accent); }
.chat-input-wrapper { flex-wrap: wrap; align-items: flex-end; }
.char-counter {
  width: 100%;
  text-align: right;
  font-size: 11px;
  color: var(--text-light);
  padding: 0 4px 2px;
  order: 10;
}
.char-counter.warn { color: #f9a825; }
.char-counter.limit { color: var(--danger); }

.scroll-bottom-btn {
  position: absolute;
  right: 24px;
  bottom: 88px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 5;
  transition: transform 0.15s, opacity 0.15s;
}
.scroll-bottom-btn:hover { transform: scale(1.05); }
.chat-area { position: relative; }

.date-separator {
  text-align: center;
  margin: 14px 0 10px;
  font-size: 12.5px;
  color: #54656f;
}
.date-separator span {
  background: rgba(255, 255, 255, 0.92);
  padding: 5px 12px 6px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  font-weight: 500;
}
body.theme-dark .date-separator span { background: #182229; color: rgba(233, 237, 239, 0.75); box-shadow: none; }

.mention { color: var(--accent); font-weight: 600; }
.mention-self { background: var(--accent-light); padding: 0 2px; border-radius: 3px; }
.msg-link { color: var(--accent); text-decoration: underline; word-break: break-all; }

.message-bubble.deleted {
  font-style: italic;
  opacity: 0.75;
  background: var(--bg-light) !important;
  color: var(--text-light) !important;
}
.message-edited { font-size: 10px; opacity: 0.7; margin-left: 4px; }
.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  padding: 0 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.message.own .message-actions {
  justify-content: flex-end;
}
.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
  pointer-events: auto;
}
.msg-action-btn {
  border: none;
  background: transparent;
  color: #667781;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.msg-action-btn:hover { background: rgba(11, 20, 26, 0.06); color: var(--accent); }

.msg-attachment-image img {
  max-width: 330px;
  max-height: 280px;
  border-radius: 6px;
  margin-top: 2px;
  display: block;
}
.msg-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(11, 20, 26, 0.05);
  border-radius: 8px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.msg-text-block { margin-top: 0; }

body.theme-dark .message-react-trigger {
  background: #233138;
  color: rgba(233, 237, 239, 0.65);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
body.theme-dark .message-react-trigger:hover {
  background: #2a3942;
  color: #e9edef;
}
body.theme-dark .reaction-chip {
  background: #233138;
  border-color: rgba(233, 237, 239, 0.08);
}
body.theme-dark .reaction-chip span { color: rgba(233, 237, 239, 0.63); }
body.theme-dark .reaction-picker-popup { background: #233138; border-color: rgba(233, 237, 239, 0.08); }

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
.settings-toggle input { width: 18px; height: 18px; }

.package-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-light, #e3f0ff);
  color: var(--accent, #2979ff);
  margin-left: auto;
  margin-right: 6px;
  white-space: nowrap;
}
.perm-hidden { display: none !important; }

.voice-panel {
  padding: 10px 14px;
  background: var(--bg-light, #f5f7fa);
  border-top: 1px solid var(--border-light, #e8eaed);
}
.voice-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.voice-panel-title { font-size: 13px; font-weight: 600; color: var(--text-mid, #5f6368); }
.voice-panel-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-voice {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  background: #fff;
  cursor: pointer;
}
.btn-voice-primary { background: var(--accent, #2979ff); color: #fff; border-color: var(--accent); }
.btn-voice-active { background: #e8f5e9; border-color: #43a047; color: #2e7d32; }
.btn-voice-xs { font-size: 11px; padding: 2px 8px; margin-left: 4px; }
.voice-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.voice-slot {
  width: 72px;
  min-height: 80px;
  border-radius: 10px;
  border: 2px dashed var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  position: relative;
  background: #fff;
}
.voice-slot.filled {
  border-style: solid;
  border-color: var(--slot-color, #2979ff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.voice-slot.empty { opacity: 0.55; font-size: 18px; color: var(--text-light); }
.voice-slot.muted { opacity: 0.65; }
.voice-slot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--slot-color, #2979ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}
.voice-slot-name {
  font-size: 10px;
  margin-top: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.voice-live-badge { color: #e53935; font-size: 10px; }
.voice-muted-badge { font-size: 10px; }
.voice-slot-mod {
  position: absolute;
  top: 2px;
  right: 2px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
}
.voice-queue { margin-top: 8px; font-size: 12px; color: var(--text-light); }
.voice-queue-hint { font-size: 12px; color: var(--accent); margin-left: 6px; }
.voice-slot.on-cam { box-shadow: 0 0 0 2px #7b1fa2; }
.voice-cam-badge { font-size: 10px; }
.voice-slot-mod.cam { right: 22px; background: #7b1fa2; }

.voice-video-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid var(--border-light);
  max-height: 140px;
  overflow-y: auto;
}
.voice-video-tile {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}
.voice-video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.voice-video-tile.local { border: 2px solid var(--accent); }
.voice-video-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Sesli/kamera sahnesi — canlı yayın üst katman (TikTok / Yalla) */
.voice-stage-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
  color: #fff;
  background: linear-gradient(
    180deg,
    rgba(10, 12, 28, 0.92) 0%,
    rgba(10, 12, 28, 0.65) 45%,
    rgba(10, 12, 28, 0.15) 78%,
    transparent 100%
  );
  padding-bottom: 28px;
}
.chat-live-shell.has-room-bg .voice-stage-wrap {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.22) 42%,
    rgba(0, 0, 0, 0.08) 72%,
    transparent 100%
  );
}
.voice-stage-wrap .voice-stage,
.voice-stage-wrap button,
.voice-stage-wrap .voice-tile {
  pointer-events: auto;
}
.voice-stage {
  padding: 8px 14px 4px;
  max-width: 100%;
}
.chat-live-shell.has-live-voice .voice-stage-scroll {
  justify-content: center;
  gap: 16px;
  padding: 8px 16px 12px;
  max-height: min(42vh, 340px);
}
.chat-live-shell.has-live-voice .voice-tile {
  flex: 0 0 84px;
  width: 84px;
  height: 108px;
}
.chat-live-shell.has-live-voice .voice-tile-ring {
  width: 72px;
  height: 72px;
  top: 2px;
}
.chat-live-shell.has-live-voice .voice-tile-avatar,
.chat-live-shell.has-live-voice .voice-tile-video {
  top: 6px;
  width: 68px;
  height: 68px;
}
.chat-live-shell.has-live-voice .voice-tile-plus {
  top: 26px;
  font-size: 26px;
}
.voice-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.voice-stage-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}
.voice-stage-stats {
  font-size: 11px;
  opacity: 0.7;
}
.voice-stage-scroll {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(38vh, 300px);
  padding: 4px 8px 8px;
  -webkit-overflow-scrolling: touch;
}
.voice-stage-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.voice-stage-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.voice-tile {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 96px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}
.voice-tile-empty .voice-tile-ring {
  border: 2px dashed rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}
.voice-tile-empty.disabled { opacity: 0.35; cursor: default; }
.voice-tile-plus {
  position: absolute;
  top: 22px;
  font-size: 22px;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.voice-tile-ring {
  position: absolute;
  top: 4px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 3px solid var(--ring-color, #2979ff);
  transition: box-shadow 0.2s, transform 0.2s;
}
.voice-tile.speaking .voice-tile-ring {
  box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.35), 0 0 16px var(--ring-color, #2979ff);
  animation: voice-pulse 1.2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.voice-tile-avatar {
  position: absolute;
  top: 10px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  z-index: 1;
}
.voice-tile-video {
  position: absolute;
  top: 10px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 2;
}
.voice-tile.has-screen {
  flex: 0 0 180px;
  width: 180px;
  height: 128px;
}
.voice-tile.has-screen .voice-tile-ring {
  top: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 24px);
  border-radius: 10px;
}
.voice-tile.has-screen .voice-tile-avatar {
  display: none;
}
.voice-tile.has-screen .voice-tile-video {
  top: 4px;
  left: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 24px);
  border-radius: 8px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.9);
}
.chat-live-shell.has-live-voice .voice-tile.has-screen {
  flex: 0 0 220px;
  width: 220px;
  height: 148px;
}
.chat-live-shell.has-live-voice .voice-tile.has-screen .voice-tile-video {
  width: calc(100% - 8px);
  height: calc(100% - 24px);
  border-radius: 10px;
  object-fit: contain;
}
.voice-tile-name {
  position: absolute;
  bottom: 0;
  font-size: 10px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  opacity: 0.9;
}
.voice-tile-menu {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.voice-tile.is-me .voice-tile-menu {
  background: rgba(41, 121, 255, 0.85);
}
.voice-tile-cam-icon,
.voice-tile-mute-icon,
.voice-tile-source-icon {
  position: absolute;
  bottom: 18px;
  right: 4px;
  font-size: 10px;
  z-index: 3;
}
.voice-tile-source-icon {
  bottom: 32px;
  right: 6px;
  font-size: 11px;
}
.vs-btn.vs-settings {
  min-width: 36px;
  padding: 6px 10px;
}
.voice-settings-form .settings-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}
.voice-rank-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.5);
}
.voice-rank-badge.rank-vip { background: linear-gradient(135deg, #ffd700, #ff8c00); color: #1a1a1a; }
.voice-rank-badge.rank-gold { background: #ffc107; color: #333; }
.voice-rank-badge.rank-gumus { background: #b0bec5; color: #263238; }
.voice-rank-badge.rank-operator { background: #7b1fa2; color: #fff; }

.voice-stage-queue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-bottom: 6px;
  opacity: 0.85;
}
.voice-queue-chip {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: 12px;
}
.voice-stage-actions {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}
.voice-stage-actions-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.vs-btn {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}
.vs-btn.vs-join,
.vs-btn.vs-cam.active,
.vs-btn.vs-screen.active { background: var(--accent, #2979ff); border-color: var(--accent); }
.voice-tile-screen-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 14px;
  z-index: 3;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.vs-btn.vs-leave { background: rgba(229, 57, 53, 0.85); border-color: transparent; }
.vs-btn-xs { font-size: 10px; padding: 1px 6px; margin-left: 4px; }
.voice-queue-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 193, 7, 0.25);
  color: #ffecb3;
}
.voice-mod-menu {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-width: 140px;
}
.voice-mod-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: #fff;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}
.voice-mod-menu button:hover { background: #f5f5f5; }

/* Avatar images */
.avatar-has-image,
.user-avatar-sm.avatar-has-image,
.message-avatar-wrap.avatar-has-image,
.member-avatar.avatar-has-image,
.online-user-avatar.avatar-has-image,
.chat-list-avatar.avatar-has-image,
.profile-view-avatar.avatar-has-image {
  overflow: hidden;
  padding: 0;
  background: transparent !important;
}
.avatar-has-image img,
.user-avatar-sm.avatar-has-image img,
.message-avatar-wrap.avatar-has-image img,
.member-avatar.avatar-has-image img,
.online-user-avatar.avatar-has-image img,
.chat-list-avatar.avatar-has-image img,
.profile-view-avatar.avatar-has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.profile-view-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}
.member-avatar-slot,
.online-user-avatar-slot {
  position: relative;
  flex-shrink: 0;
}
.avatar-picker-section { margin-bottom: 16px; }
.avatar-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-light);
  margin: 8px 0;
}
.avatar-pick-item {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, transform 0.12s;
}
.avatar-pick-item:hover { transform: scale(1.05); }
.avatar-pick-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.avatar-pick-item img { width: 100%; height: 100%; object-fit: cover; }
.avatar-custom-block { margin: 12px 0; }
.avatar-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  border: 1px dashed var(--border);
  cursor: pointer;
  font-size: 13px;
}
.avatar-upload-btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { font-size: 12px; padding: 4px 10px; }
