:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --bg-hover: #2a2a2a;
  --accent: #e91e63;
  --accent-hover: #c2185b;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #707070;
  --border: #333333;
  --success: #4caf50;
  --online: #4caf50;
  --away: #ff9800;
  --busy: #f44336;
  --bubble-self: #e91e63;
  --bubble-other: #1a0f14;
  --shadow: 0 2px 10px rgba(0,0,0,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --bg-hover: #e8e8e8;
  --accent: #e91e63;
  --accent-hover: #c2185b;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e0e0e0;
  --success: #4caf50;
  --online: #4caf50;
  --away: #ff9800;
  --busy: #f44336;
  --bubble-self: #e91e63;
  --bubble-other: #f0f0f0;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

[data-theme="light"] body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

[data-theme="light"] .left-sidebar {
  background: var(--bg-secondary);
  border-color: var(--border);
}

[data-theme="light"] .chat-main {
  background: var(--bg-secondary);
}

[data-theme="light"] .right-sidebar {
  background: var(--bg-secondary);
}

[data-theme="light"] .messages-container {
  background: var(--bg-secondary);
}

[data-theme="light"] .message-bubble {
  color: var(--text-primary);
}

[data-theme="light"] .input-area {
  background: var(--bg-secondary);
  border-color: var(--border);
}

[data-theme="light"] .input-area input {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="light"] .sidebar-section h3 {
  color: var(--text-primary);
}

[data-theme="light"] .nav-item {
  color: var(--text-secondary);
}

[data-theme="light"] .user-item {
  background: var(--bg-tertiary);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0,0,0,0.5);
}

[data-theme="light"] .rooms-modal .rooms-content {
  background: var(--bg-secondary);
}

[data-theme="light"] .settings-modal-content {
  background: var(--bg-secondary);
}

[data-theme="light"] .profile-modal-content {
  background: var(--bg-secondary);
}

[data-theme="light"] .upload-modal-content {
  background: var(--bg-secondary);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}

[data-theme="light"] .story-ring {
  border-color: var(--border);
}

[data-theme="light"] .story-avatar {
  background: var(--bg-tertiary);
}

[data-theme="light"] .promo-banner {
  background: linear-gradient(135deg, #e91e63, #9c27b0);
  color: white;
}

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: grid;
  grid-template-columns: 60px 1fr 300px;
  height: 100vh;
}

@media (max-width: 768px) {
  .app-container { 
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  .chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-bottom: 50px;
  }
  .chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 50px;
    padding: 5px 15px;
  }
  .messages-container {
    position: fixed;
    top: 50px;
    bottom: 95px;
    left: 0;
    right: 0;
    overflow-y: auto;
  }
  .input-area {
    position: fixed !important;
    bottom: 45px !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    padding: 6px 10px !important;
  }
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
  }
  .right-sidebar { 
    position: fixed;
    right: -310px;
    z-index: 1000;
    transition: right 0.3s ease;
    height: 100%;
    width: 300px;
    top: 0;
    background: var(--bg-secondary);
    display: flex !important;
    box-shadow: -2px 0 10px rgba(0,0,0,0.5);
  }
  .right-sidebar.mobile-open {
    right: 0;
  }
  .left-sidebar { 
    position: fixed; 
    left: -80px; 
    z-index: 1000;
    transition: left 0.3s ease;
    height: calc(100% - 50px);
    width: 70px;
    top: 0;
    background: var(--bg-secondary);
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    overflow-y: auto;
  }
  .left-sidebar.mobile-open {
    left: 0;
  }
  .mobile-menu-btn {
    display: flex !important;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 999;
    width: 40px;
    height: 40px;
  }
  .sidebar-logo {
    margin-top: 60px;
  }
  .chat-header-info {
    padding-left: 45px;
  }
  .private-chat {
    width: 100%;
    right: 0;
    bottom: 0;
    border-radius: 0;
    height: 100%;
  }
  .private-chat-body {
    height: calc(100% - 120px);
  }
  .modal {
    width: 95%;
    max-height: 90vh;
    padding: 20px;
  }
  .auth-box {
    padding: 20px;
  }
  .rooms-content {
    width: 95%;
    max-height: 80vh;
  }
  .toast {
    left: 10px;
    right: 10px;
    bottom: 100px;
  }
  .emoji-picker {
    width: calc(100% - 20px);
    left: 10px !important;
    right: 10px !important;
    bottom: 80px;
    position: fixed;
  }
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .message {
    max-width: 85%;
  }
  .message-content {
    padding: 10px 14px;
    font-size: 14px;
  }
  .message-avatar {
    width: 32px;
    height: 32px;
  }
  .story-item {
    width: 55px;
  }
  .story-ring {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 400px) {
  .chat-header-info h2 { font-size: 14px; }
  .chat-header-info p { font-size: 11px; }
  .message { max-width: 85%; }
  .modal { padding: 15px; }
  .modal h2 { font-size: 20px; }
  .avatar-select {
    grid-template-columns: repeat(4, 1fr);
  }
  .header-btn {
    width: 32px;
    height: 32px;
  }
  .input-btn {
    width: 32px;
    height: 32px;
  }
}

/* Left Sidebar */
.left-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none; /* Hide for Firefox */
  -ms-overflow-style: none; /* Hide for IE/Edge */
}

.left-sidebar::-webkit-scrollbar {
  display: none; /* Hide for Chrome/Safari/Edge */
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 20px;
}

.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999;
}

.mobile-menu-btn:hover {
  background: var(--accent);
  color: white;
}

.mobile-close-btn {
  display: none;
}

@media (max-width: 768px) {
  .mobile-close-btn {
    display: flex;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }
}

.mobile-menu-btn:hover {
  background: var(--accent);
  color: white;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.nav-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover, .nav-item.active {
  background: var(--accent);
  color: white;
}

.nav-item i { font-size: 20px; }

.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.sidebar-user {
  margin-top: auto;
  position: relative;
}

.user-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--accent);
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: var(--online);
  border: 2px solid var(--bg-secondary);
  border-radius: 50%;
}

/* Main Chat Area */
.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  height: 100%;
  overflow: hidden;
}

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.chat-header {
  padding: 15px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-header-info h2 { font-size: 18px; font-weight: 600; }
.chat-header-info p { font-size: 13px; color: var(--text-secondary); }

.chat-header-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

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

.message-row {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: fadeIn 0.3s ease;
  margin-bottom: 4px;
}

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

.message-bubble {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.message-row.self .message-bubble {
  background: var(--accent);
  color: white;
}

.message-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.message-row.self .message-sender {
  display: none; /* Already obvious it's you */
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
}

.message-row.self .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.message-text {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-all;
}

.message-media {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.message-media img { max-width: 100%; display: block; }

.youtube-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  min-width: 320px;
  min-height: 180px;
}

.youtube-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.message-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 1;
  transition: var(--transition);
  flex-wrap: wrap;
}

.message:hover .message-actions { opacity: 1; }

.action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 8px;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}
.action-btn.action-reply {
  color: #ffffff;
  border-color: rgba(233, 30, 99, 0.55);
}
.action-btn.action-reply:hover {
  background: rgba(233, 30, 99, 0.2);
}
.action-btn.action-edit {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.45);
}
.action-btn.action-edit:hover {
  background: rgba(255, 209, 102, 0.16);
}
.action-btn.action-delete {
  color: #ff8a8a;
  border-color: rgba(255, 107, 107, 0.45);
}
.action-btn.action-delete:hover {
  background: rgba(255, 107, 107, 0.16);
}
.action-btn.liked { color: var(--accent); }

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.message.outgoing .message-time,
.message.outgoing .message-edited,
.message.outgoing .message-seen {
  color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

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

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Input Area */
.input-area {
  padding: 15px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  position: relative;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border-radius: 24px;
  padding: 8px 16px;
}

.input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}

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

.input-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.input-btn:hover { color: var(--accent); }

.input-btn.send {
  background: var(--accent);
  color: white;
}

.input-btn.send:hover { background: var(--accent-hover); }

/* Right Sidebar */
.right-sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .right-sidebar {
    display: none !important;
  }
  .right-sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    z-index: 1000;
    padding-bottom: 80px;
    overflow-y: auto;
    background: var(--bg-secondary);
    box-shadow: -2px 0 10px rgba(0,0,0,0.5);
  }
}

.sidebar-section {
  padding: 15px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stories */
.stories-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.story-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(45deg, var(--accent), #ff6b6b);
}

.story-ring.viewed { background: var(--border); }

.story-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}

.story-username {
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-story {
  position: relative;
}

.add-story .story-ring {
  background: var(--bg-tertiary);
}

.add-story i {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 2px solid var(--bg-secondary);
}

/* Online Users */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.user-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.user-item-info { flex: 1; min-width: 0; }
.user-item-name { font-size: 14px; font-weight: 500; }
.user-item-status { font-size: 12px; color: var(--text-muted); }

.user-online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--bg-secondary);
}

/* Promo Banner */
.promo-banner {
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  border-radius: var(--radius);
  padding: 15px;
  text-align: center;
}

.promo-banner h4 { font-size: 14px; margin-bottom: 8px; }
.promo-banner p { font-size: 12px; opacity: 0.8; margin-bottom: 10px; }
.promo-banner button {
  background: white;
  color: var(--accent);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}

/* Login Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 30px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.modal h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--accent);
}

.modal input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 15px;
  outline: none;
}

.modal input:focus { border-color: var(--accent); }

.avatar-select {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.avatar-option {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.avatar-option:hover, .avatar-option.selected {
  border-color: var(--accent);
}

.modal button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.modal button:hover { background: var(--accent-hover); }

/* Story Modal */
.story-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.story-content {
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  position: relative;
}

.story-content img {
  width: 100%;
  border-radius: var(--radius);
}

.story-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  color: white;
  cursor: pointer;
  background: rgba(0,0,0,0.5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-user {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.7);
  padding: 8px 16px;
  border-radius: 20px;
}

.story-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Add Story Modal Enhancements */
#addStoryModal .rooms-content {
  max-width: 400px;
}

#addStoryModal input[type="text"] {
  transition: border-color 0.2s;
}

#addStoryModal input[type="text"]:focus {
  border-color: var(--accent);
  outline: none;
}

#addStoryModal button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

#addStoryModal .sample-img-btn {
  transition: transform 0.2s, border-color 0.2s;
}

#addStoryModal .sample-img-btn:hover {
  transform: scale(1.05);
  border-color: var(--accent) !important;
}
  right: 20px;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.story-user {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.story-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

/* Private Chat */
.private-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 500;
}

.private-chat-header {
  padding: 12px 15px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.private-chat-body {
  height: 300px;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.private-chat-input {
  padding: 12px 15px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.private-chat-input input {
  flex: 1;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--text-primary);
  outline: none;
}

.private-message {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

.private-message.sent {
  background: var(--bubble-self);
  align-self: flex-end;
}

.private-message.received {
  background: var(--bubble-other);
  align-self: flex-start;
}

/* Notification Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1001;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Hidden */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Mobile Responsive */
@media (max-width: 600px) {
  .chat-header-info h2 { font-size: 16px; }
  .message { max-width: 85%; }
  .modal { padding: 20px; }
  .rooms-content { width: 95%; padding: 15px; max-height: 80vh; overflow-y: auto; }
  .rooms-content::-webkit-scrollbar { width: 4px; }
  .rooms-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .toast {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: 80px;
  }
  .emoji-picker {
    width: calc(100% - 40px);
    left: 20px;
    right: 20px;
  }
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 20px;
  width: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  padding: 10px;
}

.emoji-category {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.emoji-cat-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.emoji-cat-btn:hover, .emoji-cat-btn.active {
  background: var(--bg-tertiary);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-btn {
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.emoji-btn:hover {
  background: var(--bg-tertiary);
  transform: scale(1.2);
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: var(--transition);
}

.theme-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

/* Light Theme */
body.light {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --bg-hover: #e8e8e8;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e0e0e0;
  --bubble-other: #f0f0f0;
}

/* Rooms */
.rooms-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.rooms-content {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
}

.rooms-content::-webkit-scrollbar {
  width: 6px;
}

.rooms-content::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.rooms-content::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.rooms-content h3 {
  margin-bottom: 15px;
  color: var(--accent);
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
  max-height: 300px;
  overflow-y: auto;
}

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

.room-item:hover, .room-item.active {
  background: var(--bg-hover);
  border: 1px solid var(--accent);
}

.room-item i {
  color: var(--accent);
  font-size: 18px;
}

.room-item-info { flex: 1; }
.room-item-name { font-weight: 500; }
.room-item-count { font-size: 12px; color: var(--text-muted); }

.create-room {
  display: flex;
  gap: 10px;
}

.create-room input {
  flex: 1;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

.create-room button {
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Auth Avatar Select */
.auth-avatar-select {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.auth-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.auth-avatar:hover, .auth-avatar.selected {
  border-color: var(--accent);
  transform: scale(1.1);
}

/* Loading Skeleton */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skeleton-loader {
  width: 100%;
  max-width: 600px;
  padding: 20px;
}

.skeleton-header {
  height: 60px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 20px;
  animation: shimmer 1.5s infinite;
}

.skeleton-messages {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.skeleton-msg {
  height: 60px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  animation: shimmer 1.5s infinite;
}

.skeleton-msg:nth-child(2) { width: 70%; }
.skeleton-msg:nth-child(3) { width: 50%; }

.skeleton-input {
  height: 50px;
  background: var(--bg-secondary);
  border-radius: 24px;
  margin-top: 20px;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  padding: 10px 15px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  outline: none;
}

.search-bar input:focus { border-color: var(--accent); }

.search-bar button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
}

.search-highlight {
  background: var(--accent);
  color: white;
  padding: 2px 4px;
  border-radius: 3px;
}

/* Reply Preview */
.reply-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--accent);
  margin: 4px 10px;
  border-radius: 4px;
  min-height: 40px;
}

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

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

.reply-label {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}

.reply-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-style: italic;
  line-height: 1.3;
}

.reply-preview button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

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

/* Message Reply Preview (WhatsApp Style) */
.message-reply-preview {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 6px;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}

.message-reply-preview:hover {
  background: rgba(0, 0, 0, 0.1);
}

.reply-bar {
  width: 3px;
  background: var(--accent);
  min-height: 100%;
}

.reply-info {
  flex: 1;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.15);
}

.reply-sender {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.reply-text {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.highlight-message {
  animation: highlightFade 2s ease-out;
}

@keyframes highlightFade {
  0% { background: rgba(255, 255, 0, 0.3); }
  100% { background: transparent; }
}

/* Message Actions Menu */
.message-actions-menu {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px;
  z-index: 100;
  box-shadow: var(--shadow);
  display: none;
}

.message-actions-menu.show {
  display: block;
}

.message-actions-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.message-actions-menu button:hover {
  background: var(--bg-hover);
}

.message-actions-menu button.danger {
  color: #f44336;
}

/* Edited Badge */
.message-edited {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 5px;
  font-style: italic;
}

/* Private Chat Status */
.private-chat-info {
  display: flex;
  flex-direction: column;
}

.private-chat-name {
  font-weight: 500;
  font-size: 14px;
}

.private-chat-status {
  font-size: 11px;
  color: var(--online);
}

.private-chat-status.offline {
  color: var(--text-muted);
}

/* Seen Indicator */
.message-seen {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.message-seen.read {
  color: var(--accent);
}

/* Profile Modal */
.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto;
}

.profile-actions button {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Confirm Dialog */
.confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}

.confirm-content {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 25px;
  width: 90%;
  max-width: 350px;
  text-align: center;
}

.confirm-content h3 {
  margin-bottom: 10px;
  color: var(--text-primary);
}

.confirm-content p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Link Preview */
.link-preview {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 8px;
}

.link-preview-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.link-preview-content {
  padding: 10px;
}

.link-preview-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 5px;
}

.link-preview-desc {
  font-size: 12px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-url {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* GIF Grid */
.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.gif-grid img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.2s;
}

.gif-grid img:hover {
  transform: scale(1.05);
}

.emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.emoji-tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}

.emoji-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Sound Toggle */
.sound-on { color: var(--accent) !important; }
.sound-off { color: var(--text-muted) !important; }

/* Mobile Pull to Refresh */
.pull-to-refresh {
  text-align: center;
  padding: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Touch Actions */
.message.touch-active .message-actions {
  opacity: 1;
}

@media (max-width: 768px) {
  .message-actions {
    opacity: 1 !important;
  }
  .emoji-picker {
    width: calc(100% - 20px) !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 100px !important;
    position: fixed !important;
  }
  .gif-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    max-height: 150px;
  }
  .gif-grid img {
    height: 50px !important;
    width: 100%;
    object-fit: cover;
  }
  .message {
    max-width: 65%;
    font-size: 12px;
    margin: 2px 0;
    padding: 0 !important;
  }
  .message-avatar {
    width: 20px !important;
    height: 20px !important;
    font-size: 10px !important;
    margin-right: 4px;
  }
  .message-sender {
    font-size: 9px !important;
    margin-bottom: 0;
  }
  .message-text {
    font-size: 11px !important;
    padding: 4px 6px !important;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .message-content {
    padding: 2px 4px !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
  }
  .message {
    max-width: 72%;
    font-size: 13px;
    margin: 4px 0;
    padding: 0 !important;
  }
  .message-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    margin-right: 6px;
  }
  .message-sender {
    font-size: 10px !important;
    margin-bottom: 2px;
  }
  .message-text {
    font-size: 13px !important;
    padding: 8px 10px !important;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .message-content {
    padding: 4px 6px !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
  }
  .message-reply-preview {
    padding: 4px 0;
    gap: 6px;
    margin-bottom: 2px;
  }
  .reply-sender {
    font-size: 10px;
  }
  .reply-text {
    font-size: 10px;
  }
  .message-time {
    font-size: 10px !important;
    margin-top: 2px;
    padding: 0 4px;
  }
  .message-actions {
    gap: 5px !important;
    margin-top: 6px;
    padding: 0;
  }
  .action-btn {
    font-size: 11px !important;
    min-height: 26px;
    padding: 5px 8px !important;
  }
  .message-media {
    max-width: 70%;
    width: 70%;
    margin: 6px 0;
  }
  .message-media img {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 120px !important;
    object-fit: contain;
  }
  .message-media video {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 120px !important;
    object-fit: contain;
  }
  .youtube-embed {
    width: 70% !important;
    max-width: 70% !important;
    max-height: 120px !important;
  }
  .youtube-embed iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 100px;
  }
}

/* Error State */
.error-message {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid #f44336;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-message button {
  margin-left: auto;
  padding: 5px 10px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.mobile-bottom-bar {
  display: none;
}

.mobile-bar-btn {
  background: var(--bg-tertiary);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
}

.mobile-bar-btn:active {
  background: var(--accent);
  color: white;
}

.mobile-radio-btn.playing {
  background: var(--accent);
  color: white;
}

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    gap: 10px;
    justify-content: space-between;
    z-index: 1100;
  }
  .reply-preview {
    padding: 6px 10px;
    margin: 0 0 6px 0;
    font-size: 11px;
  }
  .reply-text {
    font-size: 11px;
    max-width: 100%;
  }
}

/* ========== Enhanced Settings Modal ========== */
.settings-modal-content {
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.settings-header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.settings-avatar-section {
  position: relative;
  display: inline-block;
  margin-bottom: 15px;
}

.settings-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  border: 3px solid var(--border);
}

.change-avatar-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-secondary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.settings-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  background: var(--bg-tertiary);
  padding: 5px;
  border-radius: var(--radius);
}

.settings-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}

.settings-tab.active {
  background: var(--accent);
  color: white;
}

.settings-tab:hover:not(.active) {
  background: var(--bg-hover);
}

.settings-tab-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.settings-tab-content.hidden {
  display: none;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-section label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.settings-section label i {
  color: var(--accent);
}

.settings-section input,
.settings-section textarea,
.settings-section select {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
}

.settings-section input:focus,
.settings-section textarea:focus,
.settings-section select:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-section textarea {
  min-height: 80px;
  resize: vertical;
}

.disabled-input {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
}

.level-requirement {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.level-requirement i {
  color: var(--accent);
}

.status-options {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.status-option:hover {
  background: var(--bg-hover);
}

.status-option input {
  display: none;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.online { background: var(--online); }
.status-dot.away { background: var(--away); }
.status-dot.busy { background: var(--busy); }

.status-option:has(input:checked) {
  background: var(--accent);
  color: white;
}

.account-stats {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.stat-box {
  flex: 1;
  padding: 15px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.danger-zone {
  border: 1px solid #f44336;
  border-radius: var(--radius);
  padding: 15px;
  margin-top: 20px;
}

.danger-zone h4 {
  color: #f44336;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-btn {
  width: 100%;
  padding: 12px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: #d32f2f;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.save-btn {
  flex: 2;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.save-btn:hover {
  background: var(--accent-hover);
}

.cancel-btn {
  flex: 1;
  padding: 14px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.2s;
}

.cancel-btn:hover {
  background: var(--bg-hover);
}

/* ========== Right Sidebar Tabs ========== */
.right-sidebar-tabs {
  display: flex;
  padding: 10px;
  gap: 5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.right-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: all 0.2s;
}

.right-tab.active {
  background: var(--accent);
  color: white;
}

.right-tab:hover:not(.active) {
  background: var(--bg-hover);
}

.right-tab-content {
  flex: 1;
  overflow-y: auto;
}

.right-tab-content.hidden {
  display: none;
}

/* ========== Friends Section ========== */
.friends-filter {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
}

.filter-btn {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--accent);
  color: white;
}

.friends-list {
  max-height: 250px;
  overflow-y: auto;
}

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

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

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.friend-info {
  flex: 1;
}

.friend-name {
  font-weight: 500;
  font-size: 14px;
}

.friend-status {
  font-size: 11px;
  color: var(--text-muted);
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
}

.add-friend-section {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.add-friend-section input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
}

.add-friend-section button {
  padding: 8px 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
}

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

/* ========== Gifts Section ========== */
.gifts-category {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.gift-cat {
  padding: 5px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.gift-cat.active {
  background: var(--accent);
}

.gifts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gift-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.gift-item:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.gift-item span {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.gift-item:hover span {
  color: white;
}

.gift-balance {
  margin-top: 15px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gift-balance i {
  color: gold;
}

.gift-balance span {
  color: gold;
  font-weight: bold;
}

/* ========== Upload Modal ========== */
.upload-modal-content {
  max-width: 450px;
}

.upload-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}

.upload-tab {
  flex: 1;
  padding: 12px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.upload-tab.active {
  background: var(--accent);
  color: white;
}

.upload-area {
  padding: 15px 0;
}

.upload-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.upload-option {
  text-align: center;
}

.upload-option h4 {
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-size: 13px;
}

.upload-option input {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  margin-bottom: 10px;
}

.upload-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.upload-btn:hover {
  background: var(--accent-hover);
}

.upload-or {
  text-align: center;
  color: var(--text-muted);
  position: relative;
}

.upload-or::before,
.upload-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}

.upload-or::before { left: 0; }
.upload-or::after { right: 0; }

.sample-content {
  margin-top: 20px;
}

.sample-content h4 {
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-size: 13px;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.sample-img {
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.sample-img:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.close-modal-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: 15px;
  transition: background 0.2s;
}

.close-modal-btn:hover {
  background: var(--bg-hover);
}

/* ========== Enhanced Profile Modal ========== */
.profile-modal-content {
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.profile-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
  position: relative;
}

.profile-cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.3));
}

.close-profile-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-header {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  padding: 0 20px;
  margin-top: -50px;
  position: relative;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  border: 4px solid var(--bg-secondary);
}

.profile-info {
  flex: 1;
  padding-bottom: 10px;
}

.profile-info h3 {
  font-size: 22px;
  margin: 0;
}

.profile-info p {
  margin: 5px 0 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-info .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  display: inline-block;
}

.last-seen {
  color: var(--text-muted);
  font-size: 12px !important;
}

.profile-tabs {
  display: flex;
  padding: 15px 20px;
  gap: 5px;
  border-bottom: 1px solid var(--border);
  margin-top: 15px;
}

.profile-tab {
  flex: 1;
  padding: 10px 5px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}

.profile-tab.active {
  background: var(--accent);
  color: white;
}

.profile-tab-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.profile-tab-content.hidden {
  display: none;
}

.profile-bio {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 15px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-detail-item i {
  width: 20px;
  color: var(--accent);
}

.profile-stats {
  display: flex;
  justify-content: space-around;
  padding: 15px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-top: 10px;
}

.profile-stats .stat-box {
  text-align: center;
}

.profile-stats .stat-value {
  display: block;
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
}

.profile-stats .stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.profile-friends-header,
.profile-gifts-header,
.profile-media-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.profile-friends-header h4,
.profile-gifts-header h4,
.profile-media-header h4 {
  font-size: 14px;
  color: var(--text-secondary);
}

.friends-count {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-friends-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.profile-friend-item {
  text-align: center;
  cursor: pointer;
}

.profile-friend-item .friend-avatar {
  width: 50px;
  height: 50px;
  margin: 0 auto 5px;
}

.profile-friend-item span {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
}

.profile-gifts-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 15px;
}

.gift-stat {
  text-align: center;
}

.gift-stat-value {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: gold;
}

.gift-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-gifts-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0;
}

.gift-sent-item {
  min-width: 50px;
  height: 50px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.media-item {
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.profile-actions {
  display: flex;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid var(--border);
}

.action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.action-btn.primary {
  background: var(--accent);
  color: white;
}

.action-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

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