/* Import Cyberpunk Fonts — only Exo 2 and Russo One for performance */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;600;700&family=Russo+One&display=swap');

:root {
  /* Основные цвета (заменяют ваши --primary, --secondary, --background) */
  --background-main: #0a0a0f;
  --background-secondary: rgba(26, 26, 46, 0.85);
  --primary-glow: #00ffff;
  /* Cyan */
  --secondary-glow: #ff00ff;
  /* Magenta */
  --accent-glow: #f7ff00;
  /* Yellow */
  --glitch-green: #39ff14;
  /* Toxic Green */
  --warning-glow: #ff9900;
  /* Amber/Orange для кнопок удаления/редактирования */

  /* Типографика - Читабельный Cyberpunk Style */
  --text-color: #d1d1d1;
  --text-meta-color: #8c8ca0;
  --font-primary: 'Exo 2', sans-serif;
  --font-secondary: 'Exo 2', sans-serif;
  --font-headings: 'Russo One', 'Exo 2', sans-serif;
}

/* --- ANIMATIONS --- */
@keyframes glitch-text {

  0%,
  100% {
    clip-path: inset(50% 0 30% 0);
  }

  5% {
    clip-path: inset(10% 0 85% 0);
  }

  10% {
    clip-path: inset(90% 0 5% 0);
  }

  15% {
    clip-path: inset(30% 0 60% 0);
  }

  /* Этот глитч теперь только для декоративных элементов */
}

@keyframes text-flicker {

  0%,
  18%,
  22%,
  25%,
  53%,
  57%,
  100% {
    text-shadow: 0 0 3px var(--primary-glow), 0 0 6px rgba(0, 255, 255, 0.4);
    opacity: 1;
  }

  20%,
  24%,
  55% {
    text-shadow: 0 0 2px var(--primary-glow);
    opacity: 0.85;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 5px var(--primary-glow);
  }

  50% {
    transform: scale(1.02);
    box-shadow: 0 0 25px var(--primary-glow);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 5px var(--primary-glow);
  }
}

@keyframes border-glow {
  from {
    --angle: 0deg;
  }

  to {
    --angle: 360deg;
  }
}

@keyframes static-noise {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-5%, -10%);
  }

  20% {
    transform: translate(-10%, 5%);
  }

  30% {
    transform: translate(5%, -10%);
  }

  40% {
    transform: translate(-5%, 15%);
  }

  50% {
    transform: translate(-10%, 5%);
  }

  60% {
    transform: translate(15%, 0);
  }

  70% {
    transform: translate(0, 10%);
  }

  80% {
    transform: translate(-15%, 0);
  }

  90% {
    transform: translate(10%, 5%);
  }

  100% {
    transform: translate(5%, 0);
  }
}

/* --- INLINE SVG ICONS --- */
.icon {
  display: inline-block;
  vertical-align: -0.125em;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* --- GLOBAL & BODY STYLES --- */
body {
  background-color: var(--background-main);
  background-image:
    linear-gradient(rgba(10, 10, 15, 0.8), rgba(10, 10, 15, 0.8)),
    url('/static/image/fon.jpeg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-color);
  font-family: var(--font-secondary) !important;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  letter-spacing: 0.5px;
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
}

body::after {
  content: "";
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 0 0 / 4px 4px;
  animation: static-noise 8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  opacity: 0.08;
  pointer-events: none;
  z-index: 2;
}


/* --- CUSTOM SCROLLBAR --- */
::-webkit-scrollbar {
  width: 10px;
  background: var(--background-main);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-glow);
  box-shadow: 0 0 10px var(--primary-glow);
  border-radius: 5px;
}

/* --- TYPOGRAPHY & HEADINGS --- */
h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  font-family: var(--font-headings) !important;
  font-weight: 700;
  color: var(--primary-glow);
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: text-flicker 6s infinite ease-in-out;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5), 0 0 10px rgba(0, 255, 255, 0.2);
}

p,
.card-text,
.content-text,
.list-group-item,
label,
li {
  color: #e8e8e8 !important;
  line-height: 1.8;
  font-family: var(--font-secondary) !important;
  letter-spacing: 0.3px;
  font-weight: 400;
  font-size: 1.05rem;
}

small,
.text-muted,
span:not([class]) {
  color: #a8a8b8 !important;
  font-family: var(--font-secondary) !important;
  font-weight: 300;
}

.card-title {
  color: var(--primary-glow) !important;
  font-family: var(--font-primary) !important;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 0 3px rgba(0, 255, 255, 0.3);
}

/* --- ИСПРАВЛЕНИЕ: Убрана ломающая клики анимация --- */
a {
  color: var(--secondary-glow);
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

a:hover {
  color: var(--accent-glow);
  text-shadow: 0 0 5px rgba(247, 255, 0, 0.4);
  /* Безопасная анимация, не мешающая кликам */
  transform: translateY(-1px);
}

/* ИСПРАВЛЕНИЕ: Добавлены стили для ссылок удаления/редактирования из вашего CSS */
a[onclick],
a[href*="edit"],
a[href*="delete"] {
  color: var(--warning-glow);
  font-weight: 600;
  font-family: var(--font-primary) !important;
  letter-spacing: 0.5px;
}

a[onclick]:hover,
a[href*="edit"]:hover,
a[href*="delete"]:hover {
  color: var(--accent-glow);
  text-shadow: 0 0 5px rgba(247, 255, 0, 0.4);
}


/* --- NAVBAR STYLING (Совместимо с вашим классом .navbar) --- */
.navbar {
  background: rgba(10, 10, 15, 0.8) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--primary-glow);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.navbar .nav-link {
  font-family: var(--font-primary) !important;
  color: var(--text-color) !important;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: var(--primary-glow) !important;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

/* --- CARD & CONTAINER STYLING (Совместимо с .card, .list-group-item) --- */
.card,
.list-group-item {
  background: var(--background-secondary);
  border: 2px solid var(--primary-glow);
  border-radius: 8px;
  margin-bottom: 2rem;
  transition: all 0.4s ease;
  position: relative;
  padding: 20px;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.card-body,
.list-group-item-content {
  background: rgba(241, 241, 241, 0.95);
  /* Darker background for better text contrast */
  padding: 1.5rem;
  border-radius: 6px;
}

.card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

/* --- BUTTONS (Совместимо с .btn, .btn-primary, .btn-secondary и .bi-hand-*) --- */
.btn {
  font-family: var(--font-primary) !important;
  text-transform: uppercase;
  border: 2px solid;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.btn-primary {
  background: transparent;
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.btn-primary:hover {
  background: var(--primary-glow);
  color: var(--background-main);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
}

.btn-secondary,
.bi-hand-thumbs-up,
.bi-hand-thumbs-down {
  background: transparent !important;
  border-color: var(--glitch-green) !important;
  color: var(--glitch-green) !important;
  text-shadow: 0 0 3px rgba(57, 255, 20, 0.4);
  transition: all 0.3s ease !important;
}

.btn-secondary:hover,
.bi-hand-thumbs-up:hover,
.bi-hand-thumbs-down:hover {
  background: var(--glitch-green) !important;
  color: var(--background-main) !important;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

/* --- FORMS & INPUTS (Совместимо с .form-control, .form-select) --- */
.form-control,
.form-select,
textarea {
  background: rgba(10, 10, 15, 0.7);
  border: 1px solid var(--primary-glow);
  color: var(--text-color);
  border-radius: 0;
  font-family: var(--font-secondary) !important;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  font-weight: 400;
  font-size: 1rem;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  background: var(--background-main);
  color: var(--primary-glow);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
  border-color: var(--primary-glow);
  outline: none;
}

/* --- 404 PAGE REDESIGN --- */
.page_404 {
  background: transparent;
  font-family: var(--font-headings) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.four_zero_four_bg {
  height: 400px;
}

.four_zero_four_bg h1 {
  font-size: 10rem;
  position: relative;
  animation: glitch-text 2s infinite linear alternate-reverse;
}

/* Декоративный глитч, не мешает */
.four_zero_four_title {
  font-family: var(--font-headings) !important;
  font-size: 8rem !important;
  font-weight: 700 !important;
  letter-spacing: 3px !important;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5), 0 0 20px rgba(255, 0, 255, 0.3) !important;
}

.contant_box_404 h3 {
  font-size: 2.5rem;
  color: var(--text-color);
  text-shadow: 0 0 3px rgba(255, 0, 255, 0.3);
  font-family: var(--font-primary) !important;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.contant_box_404 p {
  font-size: 1.2rem;
  color: var(--text-color);
  font-family: var(--font-secondary) !important;
  letter-spacing: 0.5px;
  font-weight: 400;
}

.link_404 {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 32px;
  font-family: var(--font-primary) !important;
  text-transform: uppercase;
  border: 2px solid var(--accent-glow);
  border-radius: 6px;
  background: transparent;
  color: var(--accent-glow) !important;
  box-shadow: 0 0 5px rgba(247, 255, 0, 0.4);
  text-decoration: none;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.link_404:hover {
  background: var(--accent-glow);
  color: var(--background-main) !important;
  box-shadow: 0 0 15px rgba(247, 255, 0, 0.6);
}

/* --- CONTENT TEXT TRUNCATION --- */
.content-text {
  max-height: 120px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  position: relative;
}

.read-more-btn {
  color: var(--primary-glow);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: inline-block;
  transition: all 0.2s ease;
  text-decoration: none;
  border-bottom: 1px solid var(--primary-glow);
  font-family: var(--font-primary) !important;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.read-more-btn:hover {
  color: var(--accent-glow);
  text-shadow: 0 0 5px rgba(247, 255, 0, 0.4);
  border-bottom-color: var(--accent-glow);
}

/* --- PROFILE PAGE STYLES --- */
.list-group-item {
  background: rgba(26, 26, 46, 0.6) !important;
  border-color: rgba(0, 255, 255, 0.2) !important;
  margin-bottom: 0.5rem;
  border-radius: 6px !important;
}

.list-group-item a {
  color: var(--primary-glow) !important;
  font-weight: 500;
  text-decoration: none;
}

.list-group-item a:hover {
  color: var(--accent-glow) !important;
}

.list-group-item .text-primary {
  color: #00d9ff !important;
}

.list-group-item .text-danger {
  color: #ff4444 !important;
}

.list-group-item .text-info {
  color: #00ffff !important;
}

.list-group-item small.text-muted {
  color: #b0b0c0 !important;
  font-size: 0.85rem;
}

.list-group-item:hover {
  background: rgba(0, 255, 255, 0.1) !important;
  border-color: var(--primary-glow) !important;
}

/* Улучшаем видимость текста в list-group-item */
.list-group-item,
.list-group-item p {
  color: #e8e8e8 !important;
}

/* Специальные стили для h2 в карточках */
.card h2,
.card-title h2 {
  color: var(--primary-glow) !important;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-family: var(--font-headings) !important;
  letter-spacing: 1.5px;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(0, 255, 255, 0.3);
}

/* Улучшаем контраст для иконок в профиле */
.list-group-item i.bi {
  filter: brightness(1.3);
}

/* --- UTILITY & MISC --- */
textarea {
  resize: none;
}

/* ========== SPA LAYOUT STYLES ========== */

.app-container {
  display: flex;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  padding-top: 60px;
  overflow-x: hidden;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 1000;
  padding-top: env(safe-area-inset-top, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-glow) !important;
  text-decoration: none;
  font-family: var(--font-headings);
  font-size: 1.3rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-link {
  color: var(--text-color) !important;
  text-decoration: none;
  font-family: var(--font-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.3s;
}

.nav-link:hover {
  color: var(--primary-glow) !important;
}

.nav-user {
  color: var(--glitch-green);
  font-family: var(--font-primary);
  font-weight: 600;
}

.main-content {
  flex: 1;
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* ========== CHAT SIDEBAR STYLES ========== */

.chat-sidebar {
  width: 280px;
  background: var(--background-secondary);
  border-right: 2px solid var(--primary-glow);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 60px;
  bottom: 0;
  z-index: 100;
  box-shadow: 5px 0 20px rgba(0, 255, 255, 0.2);
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sidebar search input */
.sidebar-search .form-control {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.2);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.85rem;
}

.sidebar-search .form-control::placeholder {
  color: var(--text-secondary, #999);
}

.sidebar-search .form-control:focus {
  border-color: var(--primary-glow, #0ff);
  box-shadow: 0 0 5px rgba(0, 255, 255, 0.2);
}

/* Sidebar tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.sidebar-tab {
  flex: 1;
  padding: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary, #999);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s;
}

.sidebar-tab:hover {
  color: var(--text-primary, #e0e0e0);
  background: rgba(0, 255, 255, 0.05);
}

.sidebar-tab.active {
  color: var(--primary-glow, #0ff);
  border-bottom: 2px solid var(--primary-glow, #0ff);
  background: rgba(0, 255, 255, 0.08);
}

/* Contact action buttons */
.contact-action-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.contact-add {
  color: var(--primary-glow, #0ff);
}

.contact-add:hover {
  background: rgba(0, 255, 255, 0.15);
}

.contact-remove {
  color: #ff6b6b;
}

.contact-remove:hover {
  background: rgba(255, 107, 107, 0.15);
}

/* No users message */
.no-users-message {
  padding: 20px 15px;
  text-align: center;
  color: var(--text-secondary, #999);
  font-size: 0.85rem;
}

.users-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 5px;
  background: rgba(0, 0, 0, 0.3);
}

.user-item:hover {
  background: rgba(0, 255, 255, 0.1);
}

.user-item.active {
  background: rgba(0, 255, 255, 0.2);
  border: 1px solid var(--primary-glow);
}

.user-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-item.online .user-status-indicator {
  background: var(--glitch-green);
  box-shadow: 0 0 8px var(--glitch-green);
}

.user-item.offline .user-status-indicator {
  background: #666;
}

.user-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.user-avatar-wrapper .user-avatar-small {
  width: 28px;
  height: 28px;
}

.user-avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.15);
  color: #00ffff;
  font-weight: bold;
  font-size: 12px;
}

.user-online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--background-main);
  background: #666;
}

.user-item.online .user-online-dot {
  background: var(--glitch-green);
  box-shadow: 0 0 6px var(--glitch-green);
}

.user-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.user-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-item-time {
  color: var(--text-meta-color);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.user-item-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-last-msg {
  color: var(--text-meta-color);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.user-name {
  color: var(--text-color);
  font-family: var(--font-primary);
  font-weight: 500;
  flex: 1;
}

.chat-back-btn {
  background: none;
  border: none;
  color: var(--primary-glow);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.chat-header-avatar,
.chat-header-avatar-letter {
  display: none;
}

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

.chat-header-online {
  color: var(--glitch-green);
  font-size: 0.75rem;
  display: none;
}

.chat-header-offline {
  color: var(--text-meta-color);
  font-size: 0.75rem;
  display: none;
}

.chat-header-spacer {
  display: none;
}

.unread-badge {
  background: var(--secondary-glow);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-family: var(--font-primary);
  box-shadow: 0 0 8px rgba(255, 0, 255, 0.5);
}

.total-unread-badge {
  background: var(--secondary-glow);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  margin-left: 8px;
  font-family: var(--font-primary);
  box-shadow: 0 0 8px rgba(255, 0, 255, 0.5);
  animation: pulse 2s infinite;
}

/* ========== CHAT WINDOW STYLES ========== */

.chat-window {
  position: fixed;
  left: 280px;
  top: 60px;
  bottom: 0;
  width: 380px;
  min-width: 300px;
  max-width: 600px;
  background: var(--background-secondary);
  border-right: 2px solid var(--primary-glow);
  display: flex;
  flex-direction: column;
  box-shadow: 5px 0 20px rgba(0, 255, 255, 0.2);
  z-index: 99;
  overflow: hidden;
}

.chat-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 2;
  background: transparent;
  transition: background 0.2s;
}

.chat-resize-handle:hover,
body.chat-resizing .chat-resize-handle {
  background: rgba(0, 255, 255, 0.4);
}

body.chat-resizing {
  user-select: none;
  cursor: ew-resize;
}

/* Push main content when chat is open */
body.sidebar-visible.chat-open .main-content {
  margin-left: 660px;
}

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

.chat-user-name {
  color: var(--primary-glow);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 1.1rem;
}

.chat-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 5px;
  transition: color 0.3s;
}

.chat-close:hover {
  color: var(--secondary-glow);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 12px;
  font-family: var(--font-secondary);
}

.message-own {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 200, 200, 0.2));
  border: 1px solid rgba(0, 255, 255, 0.4);
}

.message-other {
  align-self: flex-start;
  background: rgba(255, 0, 255, 0.15);
  border: 1px solid rgba(255, 0, 255, 0.3);
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.8rem;
}

.message-sender {
  color: var(--primary-glow);
  font-weight: 600;
}

.message-time {
  color: var(--text-meta-color);
}

.message-content {
  color: var(--text-color);
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-input-container {
  padding: 15px;
  border-top: 1px solid rgba(0, 255, 255, 0.3);
  display: flex;
  gap: 10px;
}

.chat-input-container textarea {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-glow);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-color);
  font-family: var(--font-secondary);
  resize: none;
  max-height: 100px;
}

.btn-send {
  background: var(--primary-glow);
  border: none;
  border-radius: 8px;
  padding: 10px 15px;
  color: var(--background-main);
  cursor: pointer;
  transition: all 0.3s;
}

.btn-send:hover {
  box-shadow: 0 0 15px var(--primary-glow);
}

/* ========== AUTH FORMS STYLES ========== */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 100px);
  min-height: calc(100dvh - 100px);
  padding: 20px;
}

.auth-card {
  background: var(--background-secondary);
  border: 2px solid var(--primary-glow);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
}

.auth-card-register {
  max-width: 550px;
}

.auth-card h1 {
  margin-bottom: 30px;
  text-align: center;
  font-size: 1.8rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-color);
  font-family: var(--font-primary);
  font-weight: 500;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-row .form-group {
  flex: 1;
}

.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-family: var(--font-secondary);
}

.alert-danger {
  background: rgba(255, 0, 0, 0.2);
  border: 1px solid rgba(255, 0, 0, 0.5);
  color: #ff6b6b;
}

.alert-success {
  background: rgba(0, 255, 0, 0.2);
  border: 1px solid rgba(0, 255, 0, 0.5);
  color: var(--glitch-green);
}

.auth-footer {
  margin-top: 25px;
  text-align: center;
  color: var(--text-meta-color);
}

.auth-footer a {
  color: var(--primary-glow);
  margin-left: 5px;
}

/* ========== POSTS PAGE STYLES ========== */

.posts-page {
  max-width: 800px;
  margin: 0 auto;
}

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

.posts-header h1 {
  margin: 0;
}

.filter-bar {
  margin-bottom: 25px;
}

.sort-buttons,
.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  cursor: pointer;
}

.post-content {
  color: var(--text-color);
  margin: 15px 0;
  line-height: 1.6;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 6.4em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  color: var(--text-meta-color);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.post-meta-mobile {
  display: none;
}

.post-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.like-btn,
.comment-like-btn {
  background: none;
  border: 1px solid var(--glitch-green);
  color: var(--glitch-green);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s;
}

.like-btn:hover,
.comment-like-btn:hover {
  background: var(--glitch-green);
  color: var(--background-main);
}

/* ========== POST PAGE STYLES ========== */

.post-page {
  max-width: 800px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
  color: var(--primary-glow);
}

.post-full {
  margin-bottom: 30px;
}

.post-title {
  margin-bottom: 15px;
}

.post-image {
  max-width: 100%;
  border-radius: 8px;
  margin: 20px 0;
}

.post-content-full {
  white-space: pre-wrap;
  line-height: 1.8;
  margin: 20px 0;
  color: #e8e8e8 !important;
  font-family: var(--font-secondary) !important;
  font-size: 1.05rem;
}

.comments-section {
  margin-top: 30px;
}

.comments-section h2 {
  margin-bottom: 20px;
}

.comment-form {
  margin-bottom: 30px;
}

.comment-form textarea {
  width: 100%;
  margin-bottom: 15px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.comment-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 8px;
  padding: 15px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.comment-author {
  color: var(--primary-glow);
  font-weight: 500;
}

.comment-date {
  color: var(--text-meta-color);
}

.comment-content {
  color: var(--text-color);
  line-height: 1.5;
}

.comment-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

/* ========== CREATE POST STYLES ========== */

.create-post-page {
  max-width: 700px;
  margin: 0 auto;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.category-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}

.category-checkbox:hover {
  border-color: var(--primary-glow);
}

.category-checkbox input[type="checkbox"] {
  accent-color: var(--primary-glow);
}

/* ========== LOADING & ERROR STATES ========== */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-meta-color);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 255, 255, 0.2);
  border-top-color: var(--primary-glow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

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

.error-page {
  text-align: center;
  padding: 60px 20px;
}

.no-posts,
.no-comments {
  text-align: center;
  color: var(--text-meta-color);
  padding: 40px;
}

.login-prompt {
  text-align: center;
  color: var(--text-meta-color);
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

/* ========== TOAST NOTIFICATIONS ========== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--background-secondary);
  border: 1px solid var(--primary-glow);
  border-radius: 8px;
  padding: 15px;
  min-width: 280px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  animation: slideIn 0.3s ease;
}

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

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-fade-out {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.toast-header strong {
  color: var(--primary-glow);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.2rem;
}

.toast-body {
  color: var(--text-color);
  font-family: var(--font-secondary);
}

/* ========== RESPONSIVE DESIGN ========== */

/* --- Small desktop / large tablet (sidebar overlay mode) --- */
@media (max-width: 1100px) {
  .chat-sidebar {
    width: 240px;
  }

  .chat-window {
    left: 240px;
    width: 320px;
    min-width: 260px;
  }

  body.sidebar-visible .main-content {
    margin-left: 240px !important;
  }

  body.sidebar-visible.chat-open .main-content {
    margin-left: 560px !important;
  }
}

/* --- Narrow desktop: sidebar overlays content, chat overlays sidebar --- */
@media (max-width: 900px) {
  .chat-sidebar {
    width: 220px;
  }

  body.sidebar-visible .main-content {
    margin-left: 220px !important;
  }

  /* Chat window overlays everything at this width */
  .chat-window {
    left: 0;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    z-index: 200;
    border-right: none;
  }

  .chat-resize-handle {
    display: none;
  }

  body.sidebar-visible.chat-open .main-content {
    margin-left: 220px !important;
  }

  /* Auth forms: ignore sidebar margin, center on full viewport */
  .auth-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    z-index: 50;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 15, 0.95);
  }

  .auth-card {
    max-width: 420px;
    padding: 30px;
  }

  .auth-card-register {
    max-width: 480px;
  }
}

/* ========== HAMBURGER BUTTON ========== */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--primary-glow);
  color: var(--primary-glow);
  font-size: 1.5rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
}

.hamburger-btn:hover {
  background: rgba(0, 255, 255, 0.15);
}

/* ========== MOBILE MENU OVERLAY ========== */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  backdrop-filter: blur(4px);
}

.mobile-menu {
  position: absolute;
  top: 0;
  right: 0;
  width: 260px;
  height: 100%;
  background: var(--card-bg, #1a1a2e);
  border-left: 2px solid var(--primary-glow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.mobile-menu .mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: var(--text-color, #e0e0e0);
  text-decoration: none;
  border-radius: 8px;
  font-size: 1rem;
  transition: background 0.2s;
}

.mobile-menu .mobile-menu-link:hover,
.mobile-menu .mobile-menu-link.active {
  background: rgba(0, 255, 255, 0.1);
  color: var(--primary-glow);
}

.mobile-menu .mobile-menu-link i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.mobile-menu-user {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
  margin-bottom: 8px;
  color: var(--primary-glow);
  font-weight: bold;
}

/* ========== BOTTOM NAVIGATION BAR ========== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(26, 26, 46, 0.95);
  border-top: 1px solid rgba(0, 255, 255, 0.3);
  z-index: 300;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 0.65rem;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.2s;
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  min-width: 50px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: inherit;
}

.bottom-nav-item .icon {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.bottom-nav-item span {
  font-size: 9px;
  margin-top: 2px;
}

/* Mobile header action buttons (+ and bell) */
.mobile-header-actions {
  display: none;
  align-items: center;
  gap: 4px;
}

.mobile-header-btn {
  color: var(--primary-glow);
  text-decoration: none;
  font-size: 14px;
  padding: 8px;
  border-radius: 50%;
  border: 1px solid var(--primary-glow);
  background: rgba(0, 255, 255, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.mobile-header-btn:hover {
  color: var(--primary-glow);
}

.mobile-header-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #ff00ff;
  color: white;
  border-radius: 10px;
  font-size: 0.55rem;
  min-width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  font-weight: bold;
  box-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--primary-glow);
  font-weight: bold;
}

.bottom-nav-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  background: #ff00ff;
  color: white;
  border-radius: 10px;
  font-size: 0.6rem;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: bold;
  box-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
}

/* --- Tablet / small window --- */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  /* Hide desktop nav-links, show hamburger */
  .nav-links {
    display: none !important;
  }

  .hamburger-btn {
    display: block !important;
  }

  /* Show mobile header actions (+ and bell) when logged in */
  .mobile-header-actions.visible {
    display: flex !important;
  }

  /* Show bottom nav when logged in */
  .bottom-nav.visible {
    display: flex;
  }

  /* ===== MOBILE FEED OVERRIDES (only post cards) ===== */
  .posts-header {
    display: none !important;
  }

  .sort-buttons {
    display: none !important;
  }

  /* Chat window: solid background so content doesn't show through */
  .chat-window {
    background: var(--background-main) !important;
  }

  /* Chat page: fullscreen between header and bottom nav */
  .chat-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: 60px;
    top: calc(60px + env(safe-area-inset-top, 0px));
    bottom: 60px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-height: none;
    height: auto;
    z-index: 250;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .chat-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Chat sidebar backdrop — not needed for fullscreen, but keep for safety */
  .chat-sidebar-backdrop {
    display: none !important;
  }

  /* Chat window fullscreen on mobile — below navbar, no bottom nav */
  .chat-window {
    position: fixed;
    left: 0;
    top: 60px;
    top: calc(60px + env(safe-area-inset-top, 0px));
    bottom: 0;
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    border: none !important;
    border-radius: 0;
    z-index: 350;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }

  /* Hide scrollbar in chat messages on mobile */
  .chat-messages {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .chat-messages::-webkit-scrollbar {
    display: none;
  }

  /* Hide desktop X close button on mobile — back arrow replaces it */
  .chat-close {
    display: none !important;
  }

  /* Chat header: add back arrow and make tappable */
  .chat-header {
    padding: 12px 10px;
    min-height: 50px;
  }

  .chat-resize-handle {
    display: none;
  }

  body.sidebar-visible .main-content,
  body.sidebar-visible.chat-open .main-content {
    margin-left: 0 !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 15px;
    padding-bottom: 75px; /* space for bottom nav */
  }

  /* Auth forms full-width on mobile */
  .auth-container {
    position: static;
    background: none;
    padding: 15px;
    min-height: auto;
  }

  .auth-card {
    max-width: 100%;
    padding: 25px 20px;
  }

  .auth-card-register {
    max-width: 100%;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .posts-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .card,
  .btn,
  .link_404 {
    border-radius: 10px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .nav-user {
    display: none;
  }

  /* Notification dropdown: fullwidth on mobile */
  .notification-dropdown {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    width: auto;
    max-width: 100%;
  }

  /* ===== MOBILE POST CARD (compact feed) ===== */
  .post-card,
  .post-card.card {
    background: rgba(26, 26, 46, 0.7) !important;
    border: 1px solid rgba(0, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 10px !important;
    margin-bottom: 6px !important;
    box-shadow: none !important;
    transform: none !important;
    backdrop-filter: none !important;
  }

  .post-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  .post-card h2,
  .post-card .post-title {
    color: #e0e0e0 !important;
    font-size: 13px !important;
    font-weight: bold !important;
    font-family: var(--font-primary) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
    animation: none !important;
    margin: 0;
    line-height: 1.3;
  }

  .post-card .post-content {
    color: #aaa;
    font-size: 11px;
    margin-top: 4px;
    margin-bottom: 4px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    max-height: 2.6em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .post-card .post-meta {
    display: none !important;
  }

  .post-card .post-meta-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    color: #888;
    margin-top: 6px;
  }

  .post-card .post-meta-mobile .post-meta-left {
    display: flex;
    align-items: center;
    gap: 0;
  }

  .post-card .post-meta-mobile .post-cat-badge {
    background: rgba(0, 255, 255, 0.15);
    color: #00ffff;
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 2px;
  }

  .post-card .post-meta-mobile .post-meta-right {
    color: #666;
    font-size: 10px;
    white-space: nowrap;
  }

  .post-card .post-meta-mobile .post-meta-right::first-letter {
    color: #00ffff;
  }

  .post-card .post-actions {
    display: none !important;
  }

  .posts-list {
    gap: 0;
  }

  /* Compact cards in general on mobile */
  .card,
  .list-group-item {
    margin-bottom: 6px;
    padding: 10px;
  }

  /* ===== MOBILE CATEGORY CHIPS (horizontal scroll) ===== */
  .category-buttons {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding: 6px 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .category-buttons::-webkit-scrollbar {
    display: none;
  }

  .category-buttons .btn,
  .category-buttons a {
    border-radius: 12px !important;
    padding: 3px 8px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
    flex-shrink: 0;
    background: transparent !important;
    border: 1px solid rgba(0, 255, 255, 0.3) !important;
    color: #00ffff !important;
    text-transform: none;
  }

  .category-buttons .btn.active,
  .category-buttons a.active {
    background: #00ffff !important;
    color: #0a0a0f !important;
    font-weight: bold;
    border-color: #00ffff !important;
  }

  /* ===== MOBILE SEARCH BAR ===== */
  .sidebar-search .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 11px;
  }

  .sidebar-search .form-control::placeholder {
    color: #555;
  }

  /* ===== MOBILE CHAT USER ITEM ===== */
  .user-item {
    padding: 10px 12px;
    gap: 10px;
    position: relative;
  }

  .user-item .user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.15);
    border: 2px solid rgba(0, 255, 255, 0.4);
    color: #00ffff;
    flex-shrink: 0;
  }

  .user-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    border: 2px solid #0a0a0f;
  }

  .user-item.online .user-status-indicator {
    background: #39ff14;
  }

  .user-item.offline .user-status-indicator {
    background: #555;
  }

  .user-name {
    color: #e0e0e0;
    font-size: 13px;
    font-weight: bold;
  }

  .user-item .user-time {
    color: #555;
    font-size: 9px;
    text-align: right;
  }

  .user-item .user-last-message {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .unread-badge {
    background: #ff00ff;
    color: white;
    font-size: 9px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
    padding: 0 4px;
  }

  /* ===== MOBILE CHAT CONVERSATION MESSAGES ===== */
  .message-other {
    align-self: flex-start;
    max-width: 75%;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 12px 12px 12px 4px;
    padding: 8px 10px;
  }

  .message-other .message-content {
    color: #d1d1d1;
    font-size: 12px;
  }

  .message-own {
    align-self: flex-end;
    max-width: 75%;
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 12px 12px 4px 12px;
    padding: 8px 10px;
  }

  .message-own .message-content {
    color: #e0e0e0;
    font-size: 12px;
  }

  .message-time {
    color: #555;
    font-size: 8px;
    margin-top: 2px;
  }

  .message img {
    border-radius: 8px;
    max-width: 100%;
  }

  /* ===== MOBILE CHAT HEADER ===== */
  .chat-header {
    background: rgba(26, 26, 46, 0.95);
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
  }

  .chat-back-btn {
    display: flex;
  }

  .chat-header-avatar,
  .chat-header-avatar-letter {
    display: flex;
  }

  .chat-header-online,
  .chat-header-offline {
    display: block;
  }

  .chat-header-spacer {
    display: block;
    flex: 1;
  }

  .chat-header .chat-user-name {
    color: #e0e0e0;
    font-size: 13px;
    font-weight: bold;
  }

  /* ===== MOBILE CHAT INPUT AREA ===== */
  .chat-input-container {
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    padding: 8px;
    display: flex;
    gap: 6px;
    align-items: center;
  }

  .chat-input-container .btn-image {
    color: #00ffff;
    font-size: 20px;
    padding: 4px;
    background: none;
    border: none;
    box-shadow: none;
  }

  .chat-input-container textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px 12px;
    color: var(--text-color);
    font-size: 12px;
  }

  .chat-input-container .btn-send {
    color: #00ffff;
    font-size: 20px;
    padding: 4px;
    background: none;
    border: none;
    min-width: auto;
  }

  /* ===== MOBILE PROFILE PAGE ===== */
  .profile-avatar-img {
    width: 70px;
    height: 70px;
    border: 2px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  }

  .avatar-upload-btn {
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ffff;
    font-size: 0.6rem;
  }

  .profile-info h1 {
    color: #00ffff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
    margin-bottom: 2px;
  }

  .profile-fullname {
    color: #888 !important;
    font-size: 11px;
    margin-bottom: 2px;
  }

  .profile-details {
    color: #555;
    font-size: 9px;
    gap: 6px;
  }

  .profile-stats {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid rgba(0, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 255, 255, 0.1);
    padding: 10px 8px;
    gap: 10px;
  }

  .stat-number {
    color: #00ffff !important;
    font-size: 18px;
    font-weight: bold;
  }

  .stat-label {
    color: #888 !important;
    font-size: 9px;
  }

  .profile-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .profile-tabs::-webkit-scrollbar {
    display: none;
  }

  .profile-tab {
    font-size: 10px;
    padding: 8px 4px;
    color: #555;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .profile-tab.active {
    color: #00ffff;
    border-bottom: 2px solid #00ffff;
    font-weight: bold;
    background: none;
    box-shadow: none;
  }

  .profile-tab:hover {
    background: none;
    border-color: transparent;
    border-bottom-color: rgba(0, 255, 255, 0.3);
  }

  /* ===== CHAT USER LIST — NEW LAYOUT CLASSES ===== */
  .user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
  }

  .user-avatar-wrapper .user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 255, 255, 0.4);
  }

  .user-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.15);
    border: 2px solid rgba(0, 255, 255, 0.4);
    color: #00ffff;
    font-weight: bold;
    font-size: 16px;
  }

  .user-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #0a0a0f;
    background: #555;
  }

  .user-item.online .user-online-dot {
    background: #39ff14;
  }

  .user-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .user-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .user-item-time {
    color: #555;
    font-size: 9px;
    flex-shrink: 0;
    margin-left: 8px;
  }

  .user-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .user-last-msg {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }

  /* ===== CHAT HEADER — NEW LAYOUT CLASSES ===== */
  .chat-back-btn {
    background: none;
    border: none;
    color: #00ffff;
    font-size: 18px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
  }

  .chat-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 255, 255, 0.3);
    flex-shrink: 0;
  }

  .chat-header-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: #00ffff;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
  }

  .chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
  }

  .chat-header-online {
    color: #39ff14;
    font-size: 9px;
  }

  .chat-header-offline {
    color: #555;
    font-size: 9px;
  }

  .chat-header-spacer {
    flex: 1;
  }
}

/* --- Very narrow (phone) --- */
@media (max-width: 480px) {
  .nav-container {
    padding: 0 10px;
    gap: 10px;
  }

  .chat-sidebar {
    width: 100%;
  }

  .main-content {
    padding: 10px;
    padding-bottom: 70px;
  }

  .auth-card {
    padding: 20px 15px;
  }

  .auth-card h1 {
    font-size: 1.4rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-stats {
    gap: 15px;
  }

  .profile-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0;
  }

  .profile-tab {
    font-size: 10px;
    padding: 8px 4px;
  }

  .post-card {
    padding: 10px !important;
  }

  .post-card h2 {
    font-size: 13px !important;
  }

  .post-meta {
    font-size: 9px;
    gap: 4px;
  }

  .filter-bar {
    flex-direction: column;
    gap: 8px;
  }

  .category-buttons {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 6px !important;
  }

  .sort-buttons {
    flex-wrap: wrap;
    gap: 4px;
  }

  .comment-card {
    padding: 10px;
  }

  .admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table {
    font-size: 0.8rem;
    min-width: 500px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 70px;
  }

  .toast {
    min-width: auto;
  }

  .bottom-nav-item {
    font-size: 9px;
    min-width: 44px;
    padding: 6px 4px;
  }

  .bottom-nav-item .icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
  }
}

/* --- Extra narrow (320px phones like iPhone SE) --- */
@media (max-width: 360px) {
  h1 {
    font-size: 1.2rem;
  }

  .nav-brand span {
    display: none;
  }

  .main-content {
    padding: 8px;
    padding-bottom: 70px;
  }

  .auth-card {
    padding: 15px 10px;
  }

  .post-card {
    padding: 10px;
  }

  .bottom-nav {
    height: 54px;
  }

  .bottom-nav-item span {
    display: none;
  }

  .bottom-nav-item .icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
  }
}

/* ========== PROFILE PAGE STYLES ========== */

.profile-page {
  max-width: 800px;
  margin: 0 auto;
}

.profile-card {
  margin-bottom: 25px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 25px;
  margin-bottom: 20px;
}

.profile-avatar {
  font-size: 4rem;
  color: var(--primary-glow);
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
  position: relative;
}

.profile-avatar-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-glow);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--primary-glow);
  color: var(--primary-glow);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s;
}

.avatar-upload-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

/* ========== CHAT AVATAR STYLES ========== */

.user-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(0, 255, 255, 0.3);
}

.message-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 4px;
}

.message-avatar-icon {
  font-size: 1.1rem;
  vertical-align: middle;
  margin-right: 4px;
  color: var(--text-meta-color);
}

.profile-info h1 {
  margin: 0 0 5px 0;
  font-size: 1.8rem;
}

.profile-fullname {
  color: var(--text-meta-color) !important;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.profile-details {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--text-meta-color);
}

.profile-details span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 255, 255, 0.2);
}

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

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-glow) !important;
  font-family: var(--font-headings);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-meta-color) !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-tab {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.3);
  color: var(--text-color);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 500;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-tab:hover {
  border-color: var(--primary-glow);
  background: rgba(0, 255, 255, 0.1);
}

.profile-tab.active {
  background: rgba(0, 255, 255, 0.2);
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.profile-tab-content {
  min-height: 100px;
}

.profile-activity-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.profile-activity-item:hover {
  border-color: var(--primary-glow);
  background: rgba(0, 255, 255, 0.05);
}

.profile-activity-title {
  color: var(--primary-glow);
  font-family: var(--font-primary);
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.profile-activity-content {
  color: var(--text-color);
  margin: 8px 0;
  line-height: 1.5;
}

.profile-activity-meta {
  color: var(--text-meta-color);
  font-size: 0.85rem;
  display: flex;
  gap: 15px;
}

/* ========== CHAT IMAGE STYLES ========== */

.btn-image {
  background: none;
  border: 1px solid var(--primary-glow);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--primary-glow);
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
}

.btn-image:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.chat-image-preview {
  padding: 10px 15px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.image-preview-container {
  position: relative;
  display: inline-block;
}

.image-preview-container img {
  max-width: 150px;
  max-height: 100px;
  border-radius: 8px;
  border: 1px solid var(--primary-glow);
}

.image-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--secondary-glow);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.message-image-wrapper {
  margin: 8px 0;
}

.message-image {
  max-width: 250px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s;
  border: 1px solid rgba(0, 255, 255, 0.2);
}

.message-image:hover {
  transform: scale(1.02);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

/* ========== REPORT BUTTON ========== */
.report-btn {
  background: none;
  border: none;
  color: var(--text-secondary, #8899aa);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  margin-left: auto;
}

.report-btn:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

/* ========== ADMIN PANEL ========== */
.admin-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

.admin-page h1 {
  margin-bottom: 1.5rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-tab {
  padding: 0.5rem 1.2rem;
  border: 1px solid rgba(0, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary, #e0e0e0);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab.active,
.admin-tab:hover {
  background: rgba(0, 255, 255, 0.15);
  border-color: rgba(0, 255, 255, 0.5);
  color: #00ffff;
}

.admin-filter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.admin-filter-btn.active {
  background: rgba(0, 255, 255, 0.2);
  border-color: #00ffff;
  color: #00ffff;
}

.admin-item {
  margin-bottom: 1rem;
  padding: 1rem;
}

.admin-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.admin-item-type {
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
}

.admin-item-date {
  color: var(--text-secondary, #8899aa);
  font-size: 0.85rem;
  margin-left: auto;
}

.admin-item-body p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.admin-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.badge-warning {
  background: #ffc107;
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.badge-success {
  background: #28a745;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.badge-danger {
  background: #dc3545;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.badge-secondary {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.admin-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

.admin-table th {
  color: #00ffff;
  font-weight: 600;
  white-space: nowrap;
}

.admin-table tr:hover {
  background: rgba(0, 255, 255, 0.05);
}

.role-select {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-primary, #e0e0e0);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85rem;
}

/* Adjust main content when sidebar is visible (default desktop > 1100px) */
@media (min-width: 1101px) {
  body.sidebar-visible .main-content {
    margin-left: 280px;
  }

  body.sidebar-visible.chat-open .main-content {
    transition: margin-left 0.2s ease;
  }
}

/* ========== NOTIFICATION BELL & DROPDOWN ========== */

.notification-bell-container {
  position: relative;
  display: inline-block;
}

.notification-bell-container .nav-link {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--secondary-glow, #ff00ff);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  box-shadow: 0 0 6px var(--secondary-glow, #ff00ff);
  pointer-events: none;
}

.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--background-secondary, rgba(26, 26, 46, 0.95));
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.1);
  color: var(--primary-glow, #00ffff);
  font-family: var(--font-heading, 'Rajdhani', sans-serif);
}

.notification-dropdown-header .btn-link {
  color: var(--primary-glow, #00ffff);
  font-size: 0.8rem;
  text-decoration: none;
  opacity: 0.8;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.notification-dropdown-header .btn-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.notification-list {
  padding: 4px 0;
}

.notification-item {
  display: block;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

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

.notification-item.notification-unread {
  background: rgba(0, 255, 255, 0.08);
  border-left: 3px solid var(--primary-glow, #00ffff);
}

.notification-text {
  font-size: 0.85rem;
  color: var(--text-color, #d1d1d1);
  line-height: 1.35;
}

.notification-time {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 3px;
}

.notification-list .no-posts {
  padding: 16px 14px;
  text-align: center;
  font-size: 0.85rem;
}

/* Infinite scroll loading indicator */
.loading-more {
  display: flex;
  justify-content: center;
  padding: 20px;
}

/* Show more comments button */
.show-more-wrapper {
  display: flex;
  justify-content: center;
  padding: 15px 0;
}

.show-more-btn {
  cursor: pointer;
}

/* ========== LEGAL PAGES (Terms, Privacy) ========== */
.legal-page {
  max-width: 800px;
  margin: 0 auto;
}

.legal-card {
  padding: 2rem;
  line-height: 1.7;
}

.legal-card h1 {
  margin-bottom: 0.5rem;
}

.legal-card h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.legal-card ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.legal-card li {
  margin-bottom: 0.3rem;
}

.legal-updated {
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}
