/* Social Features Styles */

/* Community Two-Column Layout */
.community-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.community-sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.community-sidebar h2 {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

.community-sidebar label {
  font-weight: 500;
  color: var(--text);
}

.community-sidebar input,
.community-sidebar textarea,
.community-sidebar select {
  width: 100%;
}

.community-main {
  min-width: 0;
}

/* Profile Header */
.profile-header-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
}

.cover-photo {
  position: relative;
  height: 240px;
  background: linear-gradient(135deg, var(--primary-strong), var(--accent));
}

.cover-photo-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.3);
}

.profile-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  padding: 28px;
  margin-top: -60px;
  position: relative;
  z-index: 2;
}

.avatar-section {
  position: relative;
  display: inline-block;
}

.avatar-large {
  width: 120px;
  height: 120px;
  font-size: 3rem;
  border: 4px solid var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.avatar-section .btn-sm {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 50%;
}

.profile-details {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.profile-details h2 {
  margin: 0;
}

.profile-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.stat-item {
  display: grid;
  text-align: center;
  gap: 4px;
}

.stat-item strong {
  font-size: 1.6rem;
  color: var(--primary);
}

.stat-item span {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Post Card */
.post-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.post-author {
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}

.post-author-info {
  display: grid;
  gap: 4px;
}

.post-author-name {
  font-weight: 600;
  color: var(--text);
}

.post-author-name:hover {
  color: var(--primary);
}

.post-time {
  font-size: 0.85rem;
  color: var(--muted);
}

.post-actions-menu {
  position: relative;
}

.post-menu-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 180ms ease;
}

.post-menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.post-content {
  margin-bottom: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.post-media {
  margin-bottom: 16px;
  border-radius: 16px;
  overflow: hidden;
}

.post-media img,
.post-media video {
  width: 100%;
  display: block;
}

.post-engagements {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.post-engagement-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.post-actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 100px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 180ms ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.action-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #04111d;
  border-color: transparent;
}

.action-btn i {
  font-size: 1.1rem;
}

/* Emotes Picker */
.emotes-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  z-index: 10;
  display: none;
  margin-bottom: 8px;
}

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

.emote-btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.5rem;
  display: grid;
  place-items: center;
  transition: all 180ms ease;
}

.emote-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.1);
}

/* Comments Section */
.comments-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: none;
}

.comments-section.show {
  display: block;
}

.comment {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin-bottom: 12px;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  display: grid;
  place-items: center;
  font-weight: 600;
  color: #04111d;
  flex-shrink: 0;
}

.comment-content {
  display: grid;
  gap: 6px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.comment-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--muted);
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 12px;
}

.comment-form input {
  margin: 0;
}

/* Friends Grid */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.friend-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  display: grid;
  gap: 12px;
  transition: all 180ms ease;
}

.friend-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.friend-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: #04111d;
  margin: 0 auto;
  overflow: hidden;
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-name {
  font-weight: 600;
}

.friend-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.friend-status.online {
  color: var(--primary);
}

.friend-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Friend Request Card */
.request-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.request-info {
  display: grid;
  gap: 6px;
}

.request-message {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.request-actions {
  display: flex;
  gap: 8px;
}

/* User Card */
.user-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.user-card-info {
  display: grid;
  gap: 4px;
}

.user-card-name {
  font-weight: 600;
}

.user-card-bio {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
}

.badge-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #04111d;
  border-color: transparent;
}

/* Privacy Badge */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Notification Bell */
.notification-bell {
  position: relative;
}

.notification-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, #f05b73, #ff8361);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Loading Spinner */
.loading-spinner {
  display: grid;
  place-items: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Empty State Enhancement */
.empty-state i {
  color: var(--muted);
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 760px) {
  .community-layout {
    grid-template-columns: 1fr;
  }

  .community-sidebar {
    position: static;
    max-height: none;
  }

  .profile-info {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .avatar-section {
    justify-self: center;
  }

  .profile-stats {
    justify-content: center;
  }

  .post-actions-bar {
    flex-direction: column;
  }

  .action-btn {
    min-width: auto;
  }

  .friends-grid {
    grid-template-columns: 1fr;
  }

  .request-card,
  .user-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .request-actions {
    justify-content: center;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card {
  animation: fadeIn 0.3s ease;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

.toast-success {
  border-color: var(--primary);
}

.toast-error {
  border-color: #f05b73;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Subscribe Button Enhancement */
.subscribe-btn {
  position: relative;
}

.subscribe-btn.subscribed {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #04111d;
  border-color: transparent;
}

/* Friend Request Buttons */
.btn-accept {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #04111d;
}

.btn-reject {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-reject:hover {
  background: linear-gradient(135deg, #f05b73, #ff8361);
  color: #fff;
}

/* Playlists Grid */
.playlists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.playlist-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  transition: all 180ms ease;
}

.playlist-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.playlist-cover-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  border-radius: 0 0 18px 18px;
}

.playlist-cover-overlay h3 {
  color: #fff;
  font-size: 1.2rem;
}

.playlist-info h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: var(--text);
}

.playlist-info p {
  margin: 0;
  font-size: 0.9rem;
}

.playlist-actions {
  display: flex;
  gap: 8px;
}

/* Responsive */
@media (max-width: 760px) {
  .playlists-grid {
    grid-template-columns: 1fr;
  }
}

/* Playlist Items Container */
.playlist-items-container {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.playlist-items-loading {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.playlist-items-loading i {
  margin-right: 8px;
}

.playlist-items-empty {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.playlist-items-list {
  display: grid;
  gap: 12px;
}

/* Playlist Item */
.playlist-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 180ms ease;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.playlist-item-info {
  flex: 1;
  display: grid;
  gap: 4px;
}

.playlist-item-info strong {
  color: var(--text);
  font-size: 0.95rem;
}

.playlist-item-info small {
  color: var(--muted);
  font-size: 0.8rem;
}

.playlist-item-actions {
  display: flex;
  gap: 8px;
}

.playlist-item-actions .btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ==================== STATS BAR (Profile page) ==================== */
.stats-bar {
  display: flex !important;
  flex-direction: row;
  gap: 12px;
  padding: 0;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.stats-bar::-webkit-scrollbar { display: none; }

.stats-bar-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(15px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.stats-bar-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  opacity: 0.8;
  transition: opacity 250ms ease;
}

.stats-bar-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.stats-bar-item:hover::before {
  opacity: 1;
}

.stats-bar-item i {
  color: var(--primary);
  font-size: 1.2rem;
  transition: transform 250ms ease;
  filter: drop-shadow(0 2px 4px rgba(120, 240, 197, 0.3));
}

.stats-bar-item:hover i {
  transform: scale(1.15);
}

.stats-bar-item strong {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stats-bar-item small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats-bar-divider {
  display: none;
}

@media (max-width: 760px) {
  .stats-bar {
    gap: 8px;
  }
  .stats-bar-item {
    padding: 12px 14px;
    gap: 8px;
  }
  .stats-bar-item i {
    font-size: 1rem;
  }
  .stats-bar-item strong {
    font-size: 1.1rem;
  }
  .stats-bar-item small {
    font-size: 0.7rem;
  }
}

/* ==================== COMPACT TAB BAR ==================== */
.tab-bar {
  display: flex !important;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  border: 1px solid var(--line);
  flex-wrap: nowrap;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-button {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-button i { font-size: 0.85rem; }
.tab-button:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.tab-button.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #04111d;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
@media (max-width: 760px) {
  .tab-button {
    padding: 7px 10px;
    font-size: 0.72rem;
    gap: 4px;
  }
  .tab-button i { font-size: 0.75rem; }
}

/* ==================== EMOJI DROPDOWN WITH SEARCH ==================== */
.emoji-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 340px;
  max-height: 380px;
  background: var(--surface-strong, #1a1d25);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.emoji-dropdown.open { display: flex; }

.emoji-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.emoji-search-bar input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  font-size: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
}
.emoji-search-bar input:focus {
  border-color: var(--primary);
}
.emoji-search-bar {
  position: relative;
}
.emoji-search-bar i {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.8rem;
}
.emoji-category-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.emoji-category-tabs::-webkit-scrollbar { display: none; }
.emoji-cat-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.emoji-cat-btn:hover { background: rgba(255,255,255,0.06); }
.emoji-cat-btn.active {
  background: var(--primary);
  color: #04111d;
  font-weight: 600;
}
.emoji-grid-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.emoji-grid-scroll::-webkit-scrollbar { width: 4px; }
.emoji-grid-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s ease;
}
.emoji-item:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.2);
}
.emoji-category-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 4px 4px;
  grid-column: 1 / -1;
}
@media (max-width: 760px) {
  .emoji-dropdown {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
  }
}

/* ==================== WHITEBOARD ==================== */
.whiteboard-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 150;
  display: none;
  flex-direction: column;
  backdrop-filter: blur(4px);
}
.whiteboard-overlay.open { display: flex; }

.whiteboard-toolbar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--line);
}
.whiteboard-toolbar .wb-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.wb-color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.wb-color-btn:hover { transform: scale(1.15); }
.wb-color-btn.active { border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,0.3); }

.wb-size-slider {
  width: 80px;
  accent-color: var(--primary);
}
.wb-tool-btn {
  padding: 5px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.wb-tool-btn:hover { background: rgba(255,255,255,0.12); }
.wb-tool-btn.active { background: var(--primary); color: #04111d; border-color: var(--primary); }

.whiteboard-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.whiteboard-canvas-wrap canvas {
  background: #fff;
  border-radius: 12px;
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

/* ==================== FILE UPLOAD IN CHAT ==================== */
.chat-file-upload-btn { position: relative; }
.chat-file-upload-btn input[type="file"] {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}
.chat-file-preview {
  display: none;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border-top: 1px solid var(--line);
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}
.chat-file-preview.visible { display: flex; }
.chat-file-preview .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.chat-file-preview .file-size {
  color: var(--muted);
  font-size: 0.75rem;
}
.chat-file-preview .file-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.chat-file-preview .file-remove:hover { color: #f05b73; }

/* ==================== GIF PICKER ==================== */
.gif-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-height: 380px;
  background: var(--surface-strong, #1a1d25);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.gif-dropdown.open { display: flex; }

.gif-search-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.gif-search-bar input {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
}
.gif-search-bar input:focus { border-color: var(--primary); }

.gif-grid-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.gif-grid-scroll::-webkit-scrollbar { width: 4px; }
.gif-grid-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.gif-item {
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  aspect-ratio: 4/3;
  background: rgba(255,255,255,0.03);
}
.gif-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.gif-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gif-trending-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 4px;
}
@media (max-width: 760px) {
  .gif-dropdown {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
  }
}

/* ==================== CHAT MESSAGE FILE ATTACHMENT ==================== */
.chat-file-msg {
  padding: 6px;
}
.chat-file-msg a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  transition: background 0.15s ease;
}
.chat-file-msg a:hover { background: rgba(255,255,255,0.1); }
.chat-file-msg .file-icon { font-size: 1.2rem; color: var(--primary); }
.chat-file-msg .file-info { flex: 1; }
.chat-file-msg .file-info .fn { font-weight: 500; }
.chat-file-msg .file-info .fs { font-size: 0.7rem; color: var(--muted); }

/* ==================== CHAT MESSAGE IMAGE ==================== */
.chat-img-msg img {
  max-width: 240px;
  max-height: 200px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.chat-img-msg img:hover { transform: scale(1.02); }

/* ==================== CHAT MESSAGE GIF ==================== */
.chat-gif-msg img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 10px;
  cursor: pointer;
}

/* ==================== CHAT SYSTEM LAYOUT ==================== */
.chat-container-modern {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--surface);
  height: 700px;
  display: flex;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.chat-sidebar {
  width: 280px;
  min-width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.1);
  overflow: hidden;
  z-index: 1;
}

.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==================== CHAT INPUT AREA (HORIZONTAL TOOLBAR) ==================== */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

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

/* Top row: all icon buttons side-by-side */
.chat-input-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chat-input-toolbar::-webkit-scrollbar {
  display: none;
}

/* Bottom row: text input + send button */
.chat-input-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.chat-input-form #chat-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 16px; /* prevents iOS auto-zoom */
}

@media (max-width: 760px) {
  .chat-input-toolbar .icon-btn {
    min-width: 34px;
    min-height: 34px;
    font-size: 0.85rem;
    padding: 6px;
  }
}

.chat-send-btn {
  padding: 12px 16px;
  border-radius: 16px;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

/* Emoji Picker */
.chat-emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border-radius: 12px;
  display: none;
}
.chat-emoji-picker.open {
  display: block;
}

/* Recording buttons */
.chat-record-btn {
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
}
.chat-record-btn.recording {
  color: #f05b73;
  animation: pulse-rec 1s infinite;
}
@keyframes pulse-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Recording indicator bar */
.chat-recording-indicator {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(240, 91, 115, 0.1);
  border-top: 1px solid rgba(240, 91, 115, 0.3);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.chat-recording-indicator.active {
  display: flex;
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f05b73;
  flex-shrink: 0;
  animation: pulse-rec 1s infinite;
}

/* Recording preview (video) */
.chat-recording-preview {
  display: none;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  background: #000;
  flex-shrink: 0;
}
.chat-recording-preview.active {
  display: block;
}

/* Back button (mobile only by default hidden) */
.chat-back-btn {
  display: none;
}

/* Mobile open/close buttons */
.chat-mobile-open-btn {
  display: none;
  margin-bottom: 12px;
  padding: 12px 20px;
  border-radius: 16px;
  background: var(--primary);
  color: #04111d;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.chat-mobile-close-btn {
  display: none;
  margin: 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
}

/* Voice/video messages in chat */
.chat-voice-msg audio {
  width: 100%;
  max-width: 260px;
  border-radius: 8px;
}
.chat-video-msg video {
  width: 100%;
  max-width: 260px;
  border-radius: 12px;
  display: block;
}

.chat-room-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chat-room-item.active {
  background: var(--primary-dim);
  border-left: 3px solid var(--primary);
}

.chat-message-me {
  align-self: flex-end;
}

.message-bubble {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.message-bubble:hover {
  transform: scale(1.01);
}

.ttt-cell:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.chat-participants-panel {
  background: rgba(0, 0, 0, 0.2);
}

.participant-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ==================== MOBILE CHAT ==================== */
@media (max-width: 768px) {
  .chat-mobile-open-btn { display: flex; }
  .chat-mobile-close-btn {
    display: block;
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
    padding: 4px 10px;
    font-size: 0.75rem;
    z-index: 5;
    border-radius: 8px;
  }

  /* Container: full-screen overlay, vertical stack */
  .chat-container-modern {
    position: fixed; inset: 0; z-index: 1000;
    border-radius: 0; height: 100dvh; width: 100vw;
    display: none;
    flex-direction: column !important;
  }
  .chat-container-modern.mobile-open { display: flex; }

  /* Sidebar: compact strip at top */
  .chat-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-height: 160px;
    flex-shrink: 0;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    position: relative;
    z-index: 2;
    background: var(--surface);
  }
  .chat-sidebar-header {
    padding: 8px 12px !important;
  }
  .chat-sidebar-header h3 {
    font-size: 0.9rem !important;
    margin: 0 !important;
  }
  .chat-sidebar-header .search-box {
    display: none !important;
  }

  /* Room list: horizontal scrolling strip */
  .chat-rooms-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 6px !important;
    padding: 4px 8px 8px !important;
    min-height: 50px !important;
    align-items: center !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chat-rooms-list::-webkit-scrollbar { display: none; }

  /* Room items: compact pills — override inline styles from JS */
  .chat-room-item {
    flex-shrink: 0 !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    white-space: nowrap !important;
    margin-bottom: 0 !important;
    gap: 6px !important;
    font-size: 0.8rem !important;
    border-left: none !important;
    max-width: none !important;
    background: rgba(255,255,255,0.06) !important;
  }
  .chat-room-item.active {
    border-left: none !important;
    background: var(--primary) !important;
    color: #04111d !important;
  }
  /* Shrink avatar inside room item on mobile */
  .chat-room-item .avatar {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.7rem !important;
    min-width: 24px !important;
    min-height: 24px !important;
  }
  .chat-room-item .avatar img {
    width: 100% !important;
    height: 100% !important;
  }
  /* Hide last-message text and time — show only room name */
  .chat-room-item > div:last-child p,
  .chat-room-item > div:last-child small {
    display: none !important;
  }
  .chat-room-item > div:last-child {
    overflow: hidden !important;
    max-width: 120px !important;
  }
  .chat-room-item > div:last-child strong {
    font-size: 0.8rem !important;
  }
  /* Hide online indicator on mobile pills */
  .chat-room-item .online-indicator {
    width: 6px !important;
    height: 6px !important;
  }

  /* Main chat area: always visible, fills remaining space */
  .chat-main {
    flex: 1;
    min-width: 0;
    display: flex !important;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow: hidden;
  }

  /* Back button not needed — sidebar always visible */
  .chat-back-btn { display: none !important; }

  .chat-participants-panel { display: none !important; }

  .chat-record-btn,
  .chat-emoji-btn {
    min-width: 40px;
    min-height: 40px;
  }
}
