/* ===== Sirr Web App Stylesheet ===== */

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

/* ===== Global Smooth Transitions ===== */
button, a, input, textarea, select,
.conv-item, .settings-item, .icon-btn, .fab,
.sidebar-tab, .auth-tab, .btn-gold, .btn-outline {
  transition: background-color 0.15s ease, color 0.15s ease,
              border-color 0.15s ease, opacity 0.15s ease,
              transform 0.15s ease, box-shadow 0.15s ease;
}

/* ===== Better Scrollbars ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ===== Focus Styles for Accessibility ===== */
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ===== Better Button Interactions ===== */
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { cursor: not-allowed; opacity: 0.6; }

:root {
  --bg: #07090F;
  --bg2: #0D1117;
  --surface1: #12121A;
  --surface2: #1A1A24;
  --surface3: #252530;
  --gold: #C9902A;
  --gold-light: #E8B450;
  --gold-dark: #A87520;
  --text: #F0EDE5;
  --text2: #9A9AA0;
  --text3: #6A6A72;
  --red: #E74C3C;
  --green: #2ECC71;
  --teal: #0FB8A0;
  --blue: #3B7CF4;
  --sidebar-width: min(340px, 100vw);
  --header-height: 60px;
  --input-height: 64px;
  --transition: 0.25s ease;
}

html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background: rgba(201,168,76,0.3);
  color: var(--text);
}

::-moz-selection {
  background: rgba(201,168,76,0.3);
  color: var(--text);
}

body {
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
  overflow-x: hidden;
  height: 100vh;
  width: 100%;
}

/* ===== Scrollbars ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text3);
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-center { text-align: center; }

/* ===== Views ===== */
.view {
  display: none;
  width: 100%;
  height: 100%;
}
.view.active {
  display: flex;
}

/* ===== LOGIN VIEW ===== */
#login-view {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

#login-view::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(201,168,76,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: pulseGlow 6s ease-in-out infinite;
}

#login-view::after {
  content: '';
  position: absolute;
  bottom: -300px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 70%);
  pointer-events: none;
  animation: pulseGlow 8s ease-in-out infinite reverse;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 40px 24px;
  position: relative;
  z-index: 1;
}

.auth-logo {
  width: 88px;
  height: 88px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light), var(--gold-dark));
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 16px 48px rgba(201,168,76,0.25);
  animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-logo span {
  font-size: 40px;
  font-weight: 800;
  color: #0A0A0F;
}

.auth-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.auth-subtitle {
  text-align: center;
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-tabs {
  display: flex;
  background: var(--surface1);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: inherit;
}

.auth-tab.active {
  background: var(--surface2);
  color: var(--gold);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  position: relative;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface1);
  border: 1px solid var(--surface3);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
  background: var(--bg);
}

/* Float label effect on focus */
.form-group label {
  transition: color 0.2s ease, transform 0.2s ease;
}

.form-group:focus-within label {
  color: var(--gold);
}

.form-input::placeholder {
  color: var(--text3);
}

.btn-gold {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #0A0A0F;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
  position: relative;
  overflow: hidden;
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(201,168,76,0.4);
}

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

.btn-gold:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Shimmer effect on gold button */
.btn-gold::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-gold:hover::before {
  left: 100%;
}

.btn-outline {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--surface3);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-outline:hover {
  border-color: var(--text3);
  color: var(--text);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--text3);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface3);
}

.auth-error {
  background: rgba(231,76,60,0.1);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--red);
  font-size: 13px;
  display: none;
  animation: shakeError 0.4s ease;
  line-height: 1.5;
}

.auth-error.show {
  display: block;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Loading state for submit button */
.btn-gold.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn-gold.loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(10,10,15,0.3);
  border-top-color: #0A0A0F;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-inline-start: 8px;
  vertical-align: middle;
}

/* ===== MAIN APP VIEW ===== */
#main-view {
  height: 100vh;
  flex-direction: row;
}

/* RTL flip */
[dir="rtl"] #main-view {
  flex-direction: row-reverse;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg2);
  border-left: 1px solid var(--surface1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition);
  z-index: 100;
}

[dir="ltr"] .sidebar {
  border-left: none;
  border-right: 1px solid var(--surface1);
}

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

.sidebar-brand {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 18px;
}

.icon-btn:hover {
  background: var(--surface1);
  color: var(--gold);
}

.sidebar-search {
  padding: 12px 16px;
  flex-shrink: 0;
}

.search-box {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface1);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.search-box:focus {
  border-color: var(--gold);
  background: var(--bg);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.1);
}

.search-box:not(:focus) {
  border-color: transparent;
}

.search-box::placeholder {
  color: var(--text3);
}

/* Sidebar tabs */
.sidebar-tabs {
  display: flex;
  padding: 0 12px;
  gap: 4px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--surface1);
}

.sidebar-tab {
  flex: 1;
  padding: 10px 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: color var(--transition);
}

.sidebar-tab.active {
  color: var(--gold);
}

.sidebar-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  right: 50%;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  transition: left 0.25s ease, right 0.25s ease;
}

.sidebar-tab.active::after {
  left: 20%;
  right: 20%;
}

/* Conversation list */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.conv-item:hover {
  background: var(--surface1);
}

.conv-item:active {
  transform: scale(0.99);
}

.conv-item.active {
  background: var(--surface1);
  border: 1px solid rgba(201,168,76,0.2);
}

.conv-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.conv-avatar .online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--bg2);
  box-shadow: 0 0 6px rgba(46,204,113,0.5);
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(46,204,113,0.4); }
  50% { box-shadow: 0 0 8px rgba(46,204,113,0.7); }
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

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

.conv-time {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  margin-inline-start: 8px;
}

.conv-preview {
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conv-preview-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #0A0A0F;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(201,168,76,0.35);
  animation: badgePop 0.3s ease;
}

@keyframes badgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Group/Channel indicators */
.conv-avatar.group-avatar {
  background: rgba(52,152,219,0.2);
  color: var(--blue);
}

.conv-avatar.channel-avatar {
  background: rgba(46,204,113,0.2);
  color: var(--green);
}

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

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  animation: fadeInUp 0.5s ease;
}

.empty-icon {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  opacity: 0.25;
  animation: floatIcon 4s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.chat-empty h3 {
  font-size: 20px;
  color: var(--text2);
  margin-bottom: 8px;
  font-weight: 600;
}

.chat-empty p {
  font-size: 14px;
  color: var(--text3);
  max-width: 320px;
  text-align: center;
  line-height: 1.6;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat header */
.chat-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--surface1);
  background: var(--bg2);
  flex-shrink: 0;
}

.chat-header-back {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 20px;
  border-radius: 8px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  padding: 2px;
  box-sizing: content-box;
  min-width: 44px;
  min-height: 44px;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-name {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-status {
  font-size: 12px;
  color: var(--text3);
}

.chat-header-status.online {
  color: var(--teal);
}

.chat-header-status.typing {
  color: var(--gold);
}

.chat-header-actions {
  display: flex;
  gap: 4px;
}

/* Messages area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Date separator */
.date-separator {
  text-align: center;
  padding: 12px 0;
}

.date-separator span {
  background: var(--surface1);
  padding: 4px 14px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text3);
}

/* Message bubbles */
.message-row {
  display: flex;
  margin-bottom: 2px;
  animation: fadeInMsg 0.2s ease;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.outgoing {
  justify-content: flex-end;
}

[dir="rtl"] .message-row.outgoing {
  justify-content: flex-start;
}

[dir="rtl"] .message-row.incoming {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 16px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-row.outgoing .message-bubble {
  background: #1E1E36;
  border-bottom-right-radius: 4px;
  border-inline-start: 3px solid var(--gold);
}

[dir="rtl"] .message-row.outgoing .message-bubble {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 4px;
}

.message-row.incoming .message-bubble {
  background: #232338;
  border-bottom-left-radius: 4px;
}

[dir="rtl"] .message-row.incoming .message-bubble {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 2px;
}

.message-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.message-time {
  font-size: 11px;
  color: var(--text3);
}

.message-status {
  font-size: 14px;
  color: var(--text3);
}

.message-status.delivered {
  color: var(--text2);
}

.message-status.read {
  color: var(--gold);
}

/* Typing indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--gold);
}

.typing-indicator.show {
  display: flex;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: typingBounce 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 typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Message input */
.message-input-area {
  padding: 12px 20px;
  border-top: 1px solid var(--surface1);
  background: var(--bg2);
  flex-shrink: 0;
}

.message-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 16px;
  background: var(--surface1);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  transition: all var(--transition);
}

.message-input:focus {
  border-color: rgba(201,168,76,0.3);
}

.message-input::placeholder {
  color: var(--text3);
}

.send-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border: none;
  border-radius: 50%;
  color: #0A0A0F;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(201,168,76,0.4);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.send-btn:active:not(:disabled) {
  transform: scale(0.9);
}

/* Flip send icon for RTL */
[dir="rtl"] .send-btn svg {
  transform: scaleX(-1);
}

/* ===== PROFILE/SETTINGS PANELS ===== */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.panel-overlay.show {
  opacity: 1;
  visibility: visible;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg2);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  visibility: hidden;
}

[dir="rtl"] .panel {
  right: auto;
  left: 0;
  transform: translateX(-100%);
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

.panel.show {
  transform: translateX(0);
  visibility: visible;
}

.panel-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--surface1);
  flex-shrink: 0;
}

.panel-header h2 {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: #0A0A0F;
  margin: 0 auto 16px;
}

.profile-name {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-email {
  text-align: center;
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 24px;
}

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

.settings-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition);
}

.settings-item:hover {
  background: var(--surface1);
}

.settings-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface1);
  font-size: 16px;
}

.settings-item-text {
  flex: 1;
}

.settings-item-text .label {
  font-size: 14px;
  font-weight: 500;
}

.settings-item-text .desc {
  font-size: 12px;
  color: var(--text3);
}

.settings-item.danger .label {
  color: var(--red);
}

.settings-item:active {
  transform: scale(0.98);
}

.settings-item.danger:hover {
  background: rgba(231,76,60,0.08);
}

/* ===== NEW CHAT / SEARCH USERS MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 440px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--bg2);
  border-radius: 16px;
  border: 1px solid var(--surface3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.25s ease;
}

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

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

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

.user-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition);
}

.user-result-item:hover {
  background: var(--surface1);
}

.user-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
}

.user-result-info {
  flex: 1;
}

.user-result-info .name {
  font-size: 14px;
  font-weight: 600;
}

.user-result-info .email {
  font-size: 12px;
  color: var(--text3);
}

/* ===== CHANNEL VIEW ===== */
.channel-banner {
  padding: 24px 20px;
  background: var(--surface1);
  text-align: center;
  border-bottom: 1px solid var(--surface2);
}

.channel-banner-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(46,204,113,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
  color: var(--green);
}

.channel-banner h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.channel-banner p {
  font-size: 13px;
  color: var(--text2);
}

.channel-subscriber-count {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

.channel-post {
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface1);
}

.channel-post-text {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.channel-post-meta {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Channel input (admin only) */
.channel-input-area {
  padding: 12px 20px;
  border-top: 1px solid var(--surface1);
  background: var(--bg2);
}

.channel-post-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold, #C9902A);
  margin-bottom: 4px;
}

.channel-post-views {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text3);
}

/* Channel subscribe/subscribed bar in main chat area */
.channel-subscribe-bar {
  padding: 12px 20px;
  border-top: 1px solid var(--surface1);
  background: var(--bg2);
  display: flex;
  justify-content: center;
  align-items: center;
}

.channel-subscribe-bar .channel-subscribe-btn {
  padding: 10px 32px;
  font-size: 15px;
  border-radius: 8px;
  cursor: pointer;
}

.channel-subscribed-bar {
  padding: 10px 20px;
  border-top: 1px solid var(--surface1);
  background: var(--bg2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text3);
}

.channel-unsubscribe-link {
  background: none;
  border: none;
  color: var(--text3);
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

/* ===== LOADING SPINNER ===== */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  color: var(--text3);
  font-size: 14px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background: var(--surface2);
  border: 1px solid var(--surface3);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 400px;
}

.toast.error {
  border-color: rgba(231,76,60,0.4);
  background: rgba(231,76,60,0.15);
}

.toast.success {
  border-color: rgba(46,204,113,0.4);
  background: rgba(46,204,113,0.15);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text3);
  text-align: center;
  flex: 1;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text2);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 260px;
}

/* ===== FAB ===== */
.fab {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border: none;
  color: #0A0A0F;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201,168,76,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 50;
}

[dir="rtl"] .fab {
  left: auto;
  right: 24px;
}

.fab:hover {
  transform: scale(1.08) rotate(90deg);
  box-shadow: 0 6px 28px rgba(201,168,76,0.5);
}

.fab:active {
  transform: scale(0.95) rotate(90deg);
}

/* ===== CONNECTION STATUS BAR ===== */
.connection-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

.connection-bar.show {
  transform: translateY(0);
}

.connection-bar.connecting {
  background: var(--gold);
  color: #0A0A0F;
}

/* ===== TABLET (768px - 1024px) ===== */
@media (max-width: 1024px) and (min-width: 769px) {
  :root { --sidebar-width: 300px; }
  .panel { width: 340px; }
}

/* ===== MOBILE (max 768px) ===== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --input-height: 56px;
  }

  /* Sidebar takes full width, chat area hidden until chat opened */
  .sidebar {
    width: 100% !important;
    position: absolute;
    top: 0; bottom: 0;
    z-index: 10;
    border: none;
    transition: transform 0.25s ease;
  }

  .chat-area {
    width: 100%;
    position: absolute;
    left: 0; right: 0;
    top: 0; bottom: 0;
  }

  /* Mobile show/hide logic:
     Default: sidebar visible, chat hidden.
     When sidebar-hidden is added (by JS on opening a chat), hide sidebar, show chat.
     Also support the .chat-open class on app-container. */
  .sidebar { display: flex; }
  .chat-area { display: none; }

  /* JS adds .sidebar-hidden when a chat is opened */
  .sidebar.sidebar-hidden {
    display: none !important;
  }
  .sidebar.sidebar-hidden ~ .chat-area,
  .sidebar-hidden + .chat-area {
    display: flex !important;
  }

  /* Also support .chat-open class */
  .app-container.chat-open .sidebar { display: none; }
  .app-container.chat-open .chat-area { display: flex; }

  /* Back button in chat header */
  .chat-header-back {
    display: flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  /* Touch-friendly button sizes */
  .icon-btn, .fab, button.conv-ctx-item,
  button.context-menu-item, .send-btn,
  .sidebar-tab, .conv-filter-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Panel full width on mobile */
  .panel {
    width: 100% !important;
    max-width: 100%;
  }

  /* Modal full width on mobile */
  .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh;
    margin: 5vh auto;
  }

  /* Auth container full width */
  .auth-container {
    width: 90%;
    max-width: 400px;
    padding: 24px 20px;
  }

  .auth-logo {
    width: 72px;
    height: 72px;
    font-size: 28px;
  }

  .auth-title { font-size: 24px; }

  /* Message bubbles wider on mobile */
  .message-bubble {
    max-width: 85% !important;
  }

  /* Chat header less padding */
  .chat-header {
    padding: 0 12px;
    gap: 8px;
  }

  /* Chat area less padding */
  .messages-area {
    padding: 12px;
  }

  /* Empty state smaller */
  .empty-icon {
    width: 80px;
    height: 80px;
  }

  .empty-state {
    padding: 24px 16px;
  }

  /* FAB smaller on mobile */
  .fab {
    width: 48px;
    height: 48px;
    bottom: 16px;
  }
  [dir="ltr"] .fab { left: 16px; }
  [dir="rtl"] .fab { right: 16px; }

  /* Sidebar search */
  .sidebar-search { padding: 8px 12px; }
  .sidebar-tabs { padding: 0 8px; }

  /* Scrollbar thinner on mobile */
  ::-webkit-scrollbar { width: 3px; }

  /* Form inputs - prevent iOS zoom */
  .form-input, textarea, select, input[type="text"] {
    padding: 10px 14px;
    font-size: 16px;
  }

  .form-group { margin-bottom: 12px; }
  .auth-form { gap: 12px; }

  /* Context menus full width at bottom on mobile */
  .message-context-menu, .conv-context-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    border-radius: 16px 16px 0 0;
    max-width: 100%;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  /* Dialog overlay scroll fix */
  .sirr-dialog-overlay, .settings-overlay {
    -webkit-overflow-scrolling: touch;
  }

  /* Self-destruct timer select touch-friendly */
  .self-destruct-select {
    min-height: 36px;
    font-size: 14px;
  }
}

/* ===== SMALL PHONES (max 414px) ===== */
@media (max-width: 414px) {
  .auth-container {
    width: 94%;
    padding: 20px 16px;
  }

  .auth-logo {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }

  .auth-title { font-size: 22px; }
  .auth-subtitle { font-size: 13px; }

  .message-bubble {
    max-width: 90% !important;
  }

  .chat-header {
    padding: 0 8px;
    gap: 6px;
  }

  .messages-area { padding: 8px; }

  .empty-icon {
    width: 64px;
    height: 64px;
  }

  .conv-item { padding: 10px 12px; }
  .conv-avatar { width: 44px; height: 44px; font-size: 16px; }
}

/* ===== VERY SMALL PHONES (max 320px) ===== */
@media (max-width: 320px) {
  .auth-container { padding: 16px 12px; }
  .auth-logo { width: 56px; height: 56px; font-size: 22px; }
  .auth-title { font-size: 20px; }

  .modal-content {
    width: 98vw !important;
    max-width: 98vw !important;
    border-radius: 12px;
  }

  .message-bubble { max-width: 92% !important; }
  .chat-header { min-height: 50px; }
  .conv-item { padding: 8px 10px; height: auto; min-height: 64px; }
}

/* ===== LARGE DESKTOP (1440px+) ===== */
@media (min-width: 1440px) {
  :root { --sidebar-width: 380px; }
  .messages-area { max-width: 900px; margin: 0 auto; }
  .message-bubble { max-width: 55%; }
}

/* ===== SAFE AREA (notch phones) ===== */
@supports (padding: env(safe-area-inset-top)) {
  .chat-header {
    padding-top: env(safe-area-inset-top);
  }
  .chat-input-area {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar {
    padding-top: env(safe-area-inset-top);
  }
}

/* ===== CREATE GROUP / CHANNEL FORM ===== */
.create-form-group {
  margin-bottom: 16px;
}

.create-form-group label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
}

.member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface2);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text);
}

.member-chip .remove-chip {
  cursor: pointer;
  color: var(--text3);
  font-size: 14px;
}

.member-chip .remove-chip:hover {
  color: var(--red);
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--surface3);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-switch.on {
  background: var(--gold);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-switch.on::after {
  transform: translateX(20px);
}

/* ===== SECRET CHAT BANNER ===== */
.secret-chat-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(201,144,42,0.08);
  border-bottom: 1px solid rgba(201,144,42,0.15);
  color: var(--gold);
  font-size: 12px;
  font-weight: 500;
}

.secret-chat-banner.hidden {
  display: none;
}

.self-destruct-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 12px;
  color: var(--teal);
  font-size: 12px;
}

.self-destruct-timer.hidden {
  display: none;
}

/* ===== ONLINE STATUS DOT IN HEADER ===== */
.online-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  margin-inline-end: 4px;
  box-shadow: 0 0 6px rgba(15,184,160,0.5);
  animation: onlinePulse 2s ease-in-out infinite;
}

.online-status-dot.hidden {
  display: none;
}

/* ===== CONNECTION BAR IMPROVEMENTS ===== */
.connection-bar {
  gap: 8px;
}

.connection-bar-icon {
  display: flex;
  align-items: center;
}

.connection-bar-text {
  font-size: 13px;
}

.connection-bar.reconnecting {
  background: var(--gold);
  color: #0A0A0F;
}

.connection-bar.connected {
  background: var(--teal);
  color: #fff;
}

/* ===== REPLY PREVIEW BAR ===== */
.reply-preview {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--surface1);
  border-inline-start: 3px solid var(--gold);
  border-top: 1px solid var(--surface3);
  gap: 12px;
  animation: slideDown 0.15s ease;
}

.reply-preview.hidden {
  display: none;
}

.reply-preview.editing {
  border-inline-start-color: var(--blue);
}

.reply-preview-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reply-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
}

.reply-preview.editing .reply-preview-name {
  color: var(--blue);
}

.reply-preview-text {
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}

.reply-preview-close:hover {
  color: var(--text);
}

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

/* ===== MESSAGE STATUS INDICATORS ===== */
.message-status-icon {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 3px;
}

.message-status-icon.sent svg {
  color: var(--text3);
}

.message-status-icon.delivered svg {
  color: var(--text2);
}

.message-status-icon.read svg {
  color: var(--gold);
}

/* ===== FORWARD INDICATOR ===== */
.message-forwarded {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
}

.message-forwarded svg {
  flex-shrink: 0;
}

/* ===== VOICE MESSAGE UI ===== */
.voice-message {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  padding: 4px 0;
}

.voice-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  color: #0A0A0F;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
}

.voice-play-btn:hover {
  transform: scale(1.08);
}

.voice-play-btn:active {
  transform: scale(0.95);
}

.voice-waveform {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.voice-waveform-bar {
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.voice-waveform-bar.active {
  opacity: 1;
}

.voice-duration {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
}

/* ===== IMAGE/MEDIA IN MESSAGES ===== */
.message-media {
  margin: 4px 0;
  border-radius: 12px;
  overflow: hidden;
  max-width: 320px;
}

.message-media img {
  width: 100%;
  display: block;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.message-media img:hover {
  opacity: 0.9;
}

.message-media-loading {
  width: 200px;
  height: 150px;
  background: var(--surface3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== UNREAD COUNT BADGE (SIDEBAR) ===== */
.sidebar-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--gold);
  color: #0A0A0F;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  margin-inline-start: 4px;
  animation: badgePop 0.3s ease;
}

/* ===== ATTACH BUTTON IN MESSAGE INPUT ===== */
.message-input-row .attach-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text3);
}

.message-input-row .attach-btn:hover {
  color: var(--gold);
  background: var(--surface1);
}

/* ===== RTL SUPPORT ADDITIONS ===== */
[dir="rtl"] .reply-preview {
  border-inline-start: 3px solid var(--gold);
}

[dir="rtl"] .secret-chat-banner {
  direction: rtl;
}

[dir="rtl"] .voice-message {
  direction: rtl;
}

[dir="rtl"] .message-forwarded {
  direction: rtl;
}

/* ===== MEDIA VIEWER OVERLAY (click-to-zoom) ===== */
.media-viewer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-viewer-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  animation: fadeIn 0.2s ease;
}

.media-viewer-img {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  animation: scaleIn 0.25s ease;
}

.media-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.media-viewer-close:hover {
  background: rgba(255,255,255,0.3);
}

@keyframes scaleIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== FILE MESSAGE IN CHAT ===== */
.message-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.message-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-file-name {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

/* ===== SAVED MESSAGES ===== */
.saved-avatar {
  background: linear-gradient(135deg, var(--gold), var(--gold-light)) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saved-avatar svg {
  stroke: #0A0A0F;
}

.saved-message-bubble {
  border-inline-start: 3px solid var(--gold) !important;
}

.saved-from {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 4px;
}

.saved-unsave-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 2px;
  margin-inline-start: 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.saved-unsave-btn:hover {
  color: var(--red);
}

/* ===== SECRET CHAT ACTIVE STATE ===== */
.secret-chat-active {
  border-top: 2px solid rgba(201, 144, 42, 0.3);
}

.secret-chat-active .messages-container,
.secret-chat-active #messages-container {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(201, 144, 42, 0.02) 20px,
    rgba(201, 144, 42, 0.02) 40px
  );
}

.self-destruct-select {
  background: var(--surface2);
  border: 1px solid var(--surface3);
  color: var(--teal);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.self-destruct-select:focus {
  border-color: var(--teal);
}

/* ===== BLOCKED USER ITEMS ===== */
.blocked-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.blocked-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-unblock-btn:hover {
  background: var(--red) !important;
  color: #fff !important;
}
