/* ==========================================================================
   DESIGN SYSTEM & CUSTOM PREMIUM GLASSMORPHISM THEME (Bootstrap 5.3 Extension)
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-hsl: 224, 71%, 4%;
  --shell-hsl: 222, 47%, 7%;
  --panel-hsl: 222, 47%, 10%;
  --card-hsl: 222, 47%, 8%;
  --text-hsl: 210, 40%, 98%;
  --muted-hsl: 215, 20%, 65%;
  
  --bg: hsl(var(--bg-hsl));
  --shell: hsl(var(--shell-hsl));
  --panel: hsl(var(--panel-hsl));
  --card: hsl(var(--card-hsl));
  --text: hsl(var(--text-hsl));
  --muted: hsl(var(--muted-hsl));
  
  --line: rgba(255, 255, 255, 0.08);
  --soft-line: rgba(255, 255, 255, 0.04);
  
  /* Brand Gradients HSL */
  --brand: hsl(344, 100%, 59%);
  --brand-2: hsl(37, 100%, 67%);
  --accent: hsl(193, 100%, 50%);
  --good: hsl(165, 65%, 50%);
  --danger: hsl(356, 100%, 68%);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  
  /* Glassmorphism Defaults */
  --glass-bg: rgba(10, 12, 18, 0.72);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

[data-theme=light] {
  --bg-hsl: 220, 20%, 97%;
  --shell-hsl: 0, 0%, 100%;
  --panel-hsl: 220, 20%, 93%;
  --card-hsl: 0, 0%, 100%;
  --text-hsl: 224, 71%, 4%;
  --muted-hsl: 215, 16%, 47%;
  
  --bg: hsl(var(--bg-hsl));
  --shell: hsl(var(--shell-hsl));
  --panel: hsl(var(--panel-hsl));
  --card: hsl(var(--card-hsl));
  --text: hsl(var(--text-hsl));
  --muted: hsl(var(--muted-hsl));
  
  --line: rgba(16, 18, 24, 0.1);
  --soft-line: rgba(16, 18, 24, 0.05);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 18, 24, 0.06);
  --shadow-lg: 0 16px 48px rgba(16, 18, 24, 0.1);
  
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(16, 18, 24, 0.08);
  --glass-glow: 0 8px 32px 0 rgba(16, 18, 24, 0.03);
}

/* ==========================================================================
   GLOBAL RESET & FONTS
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 47, 115, 0.07), transparent 35%),
    radial-gradient(circle at 88% 82%, rgba(0, 199, 255, 0.06), transparent 35%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--accent);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Lucide Icon override */
.lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
  pointer-events: none;
  vertical-align: middle;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ==========================================================================
   CORE PLATFORM COMPONENTS (Buttons, Forms, Avatares, Badges)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  border-radius: 99px;
  padding: 10px 20px;
  min-height: 40px;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #9b5cff, var(--accent));
  background-size: 150% 150%;
  border: none;
  animation: gradientShift 6s ease infinite;
}
.btn-primary:hover {
  background-position: right center;
  box-shadow: 0 8px 24px rgba(255, 47, 115, 0.25);
}

.btn-light {
  color: var(--text);
  background: var(--glass-bg);
  border-color: var(--glass-border);
  backdrop-filter: blur(12px);
}
.btn-light:hover {
  background: var(--panel);
  border-color: var(--muted);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: rgba(255, 90, 102, 0.3);
  background: transparent;
}
.btn-outline-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Inputs & Form Controls */
.form-control, .form-select {
  background-color: rgba(0, 0, 0, 0.15);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s ease;
}
[data-theme=light] .form-control, [data-theme=light] .form-select {
  background-color: rgba(255, 255, 255, 0.6);
}
.form-control:focus, .form-select:focus {
  outline: none;
  background-color: var(--shell);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 199, 255, 0.15);
}

/* Custom Switch Toggle */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
}
.switch-row span {
  display: flex;
  flex-direction: column;
}
.switch-row strong {
  font-weight: 700;
  font-size: 14px;
}
.switch-row small {
  color: var(--muted);
  font-size: 12px;
}
.switch-row input[type=checkbox] {
  position: relative;
  width: 44px;
  height: 24px;
  appearance: none;
  background: var(--line);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  transition: background 0.3s ease;
}
.switch-row input[type=checkbox]:checked {
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.switch-row input[type=checkbox]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.switch-row input[type=checkbox]:checked::before {
  transform: translateX(20px);
}

/* Premium Avatars */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--glass-border);
  background-color: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.avatar:hover {
  transform: scale(1.05);
}

/* Verified Badge SVG */
.verified {
  width: 17px;
  height: 17px;
  vertical-align: text-top;
  margin-left: 4px;
}

/* Presence mode dots */
.presence-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--shell);
  background-color: #6b7280;
  box-shadow: var(--shadow-sm);
}
.presence-dot.online {
  background-color: var(--good);
  box-shadow: 0 0 8px var(--good);
}
.presence-dot.busy {
  background-color: var(--brand-2);
  box-shadow: 0 0 8px var(--brand-2);
}
.presence-dot.offline {
  background-color: #6b7280;
}
.presence-dot.is-live {
  animation: pulseLive 1.8s infinite;
}

/* Glass Card class definition */
.glass-panel {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ==========================================================================
   AUTHENTICATION SHIELDS (Login / Register / Landing)
   ========================================================================== */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 460px);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card {
  padding: 40px;
  border-radius: 28px;
}

.auth-card h1 {
  font-size: 30px;
  font-weight: 900;
  margin: 24px 0 8px;
}

.auth-card p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 24px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  font-size: 24px;
  font-weight: 950;
  color: #000;
  border-radius: 14px;
  background: conic-gradient(from 210deg, var(--brand), var(--brand-2), var(--accent), #9b5cff, var(--brand));
  box-shadow: 0 8px 24px rgba(255, 47, 115, 0.3);
  font-family: 'Outfit', sans-serif;
}

.auth-link {
  display: block;
  text-align: center;
  font-weight: 700;
  margin-top: 24px;
  font-size: 14px;
  color: var(--accent);
}
.auth-link:hover {
  text-decoration: underline;
}

.stack {
  display: grid;
  gap: 16px;
}
.stack label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}

.mini-forgot {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ==========================================================================
   APP SHELL / NAVIGATION (Sidebar, Topbar, Rightbar)
   ========================================================================== */

/* Layout Containers */
.app-container {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 32px 18px;
  border-right: 1.5px solid var(--line);
  background: rgba(var(--bg-hsl), 0.5);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 950;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 32px;
  padding-left: 8px;
}
.logo span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  font-size: 18px;
  font-weight: 950;
  color: #000;
  border-radius: 10px;
  background: conic-gradient(from 210deg, var(--brand), var(--brand-2), var(--accent), #9b5cff, var(--brand));
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 4px;
}
.nav-pill i {
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-pill:hover {
  background: var(--soft-line);
  transform: translateX(4px);
}
.nav-pill:hover i {
  color: var(--text);
}
.nav-pill.active {
  background: linear-gradient(135deg, var(--brand), #9b5cff);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 47, 115, 0.2);
}
.nav-pill.active i {
  color: #fff;
}
.nav-pill.danger {
  color: var(--danger);
  margin-top: auto;
}
.nav-pill.danger i {
  color: var(--danger);
}
.nav-pill.danger:hover {
  background: rgba(255, 90, 102, 0.1);
}

.app-shell {
  flex: 1;
  min-width: 0;
  border-right: 1.5px solid var(--line);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  background: rgba(var(--bg-hsl), 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1.5px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
}

.topbar-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}
.topbar-title span {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--soft-line);
  border: 1.5px solid var(--glass-border);
  color: var(--text);
  transition: all 0.2s ease;
}
.icon-btn:hover {
  background: var(--line);
  transform: scale(1.05);
}
#notifCount {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 99px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 6px var(--danger);
}

.rightbar {
  width: 340px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.right-card {
  padding: 20px;
  border-radius: 20px;
}

.mini-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
}
.mini-profile strong {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 800;
}
.mini-profile span {
  font-size: 12px;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}
.section-head span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* ==========================================================================
   FEED & STORIES & POSTS CARDS
   ========================================================================== */

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}
.view.active {
  display: block;
}

/* Stories row */
.stories-row {
  display: flex;
  gap: 16px;
  padding: 24px;
  overflow-x: auto;
  border-bottom: 1.5px solid var(--line);
  scrollbar-width: none;
}
.stories-row::-webkit-scrollbar {
  display: none;
}

.story {
  width: 76px;
  min-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.story:hover {
  transform: translateY(-2px);
}
.story-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 2.5px;
  background: conic-gradient(from 210deg, var(--brand), var(--brand-2), var(--accent), #9b5cff, var(--brand));
  box-shadow: var(--shadow-sm);
}
.story img, .story video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card);
}
.story.viewed .story-ring {
  background: var(--line);
}
.story.add-story .story-ring {
  background: var(--soft-line);
  border: 1.5px dashed var(--line);
  display: grid;
  place-items: center;
  color: var(--accent);
}
.story.add-story:hover .story-ring {
  border-color: var(--accent);
}
.story small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Composer Shortcut */
.quick-composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin: 24px;
  padding: 16px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.005));
  border: 1.5px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}
.quick-composer:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.quick-composer strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}
.quick-composer span {
  font-size: 12px;
  color: var(--muted);
}

/* Rebuilt Post Card */
.feed-list {
  display: flex;
  flex-direction: column;
}
.post {
  padding: 24px;
  border-bottom: 1.5px solid var(--line);
  transition: background-color 0.2s ease;
  animation: fadeIn 0.3s ease;
}
.post:hover {
  background-color: rgba(255,255,255,0.015);
}
[data-theme=light] .post:hover {
  background-color: rgba(0,0,0,0.008);
}
.post-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}
.post-name {
  font-weight: 850;
  font-size: 15px;
  display: flex;
  align-items: center;
}
.post-body {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: 18px;
  border: 1.5px solid var(--glass-border);
  margin-top: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease;
}
.post-img:hover {
  transform: scale(1.008);
}
.post-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 99px;
  transition: all 0.2s ease;
}
.action:hover {
  color: var(--text);
  background-color: var(--soft-line);
}
.action i {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.action:hover i {
  transform: scale(1.15);
}
.action.active {
  color: var(--brand);
}
.action.active i {
  fill: var(--brand);
  stroke: var(--brand);
  transform: scale(1.2);
}

/* ==========================================================================
   USER PROFILES & SOCIAL GRAPH
   ========================================================================== */

.profile-card {
  position: relative;
  border-bottom: 1.5px solid var(--line);
}

.profile-banner {
  height: 200px;
  background-color: var(--panel);
  background-size: cover;
  background-position: center;
  position: relative;
}

.profile-info {
  padding: 0 24px 24px;
}

.profile-info .avatar {
  width: 110px;
  height: 110px;
  margin-top: -55px;
  border: 5px solid var(--shell);
  position: relative;
  z-index: 5;
}

.profile-info h2 {
  font-size: 26px;
  font-weight: 900;
  margin: 16px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-info p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin: 12px 0 18px;
}

.profile-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-stats span {
  flex: 1;
  min-width: 110px;
  padding: 12px;
  border: 1.5px solid var(--glass-border);
  border-radius: 16px;
  background: var(--soft-line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.profile-stats b {
  display: block;
  font-size: 22px;
  color: var(--text);
  font-weight: 900;
  margin-bottom: 2px;
}

.profile-toolbar {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1.5px solid var(--line);
}

/* Suggestion Card Row */
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1.5px solid var(--soft-line);
}
.suggestion:last-child {
  border-bottom: none;
}
.suggestion b {
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 800;
}
.suggestion-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.suggestion-actions .icon-btn {
  width: 34px;
  height: 34px;
}

/* Rebuilt User Grid/Search Cards */
.search-results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-xl);
}
.user-card .avatar {
  width: 58px;
  height: 58px;
  border-width: 2px;
}
.user-card-body {
  flex: 1;
  min-width: 0;
}
.user-card-body strong {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 850;
}
.user-card-body span {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: block;
}
.user-card-body p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text);
}
.user-card-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   DISCORD-LIKE CHAT INTERFACE
   ========================================================================== */

.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100vh - 74px);
}

.thread-list {
  border-right: 1.5px solid var(--line);
  padding: 18px 12px;
  overflow-y: auto;
  background-color: rgba(var(--panel-hsl), 0.2);
}

.thread {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.thread:hover {
  background-color: var(--soft-line);
}
.thread.active {
  background-color: var(--panel);
  border-left: 3.5px solid var(--accent);
}
.thread b {
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 850;
}
.thread .muted {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.chat-box {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  min-height: 64px;
  padding: 12px 20px;
  border-bottom: 1.5px solid var(--line);
  background-color: rgba(var(--shell-hsl), 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header strong {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 900;
}
.chat-header span {
  font-size: 11px;
  color: var(--muted);
}

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

.chat-message-row {
  animation: slideInBubble 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: bottom center;
}

.bubble {
  max-width: 70%;
  padding: 10px 16px;
  font-size: 14.5px;
  line-height: 1.5;
  border-radius: 18px 18px 18px 4px;
  background-color: var(--panel);
  box-shadow: var(--shadow-sm);
  align-self: flex-start;
}
.bubble.me {
  background: linear-gradient(135deg, var(--brand), #9b5cff);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  align-self: flex-end;
  box-shadow: 0 4px 12px rgba(255, 47, 115, 0.15);
}

.chat-form {
  padding: 16px 20px;
  border-top: 1.5px solid var(--line);
  background-color: rgba(var(--shell-hsl), 0.2);
  display: flex;
  gap: 12px;
}

/* Typing rows */
.typing-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  background-color: var(--soft-line);
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 11px;
  color: var(--muted);
  animation: slideInBubble 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.typing-row span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--muted);
  animation: typingDot 1.4s infinite ease-in-out both;
}
.typing-row span:nth-child(2) { animation-delay: .2s; }
.typing-row span:nth-child(3) { animation-delay: .4s; }
.typing-row b {
  margin-left: 6px;
  font-weight: 700;
}

/* ==========================================================================
   DROPDOWN NOTIFICATIONS & MODALS
   ========================================================================== */

.dropdown-panel {
  display: none;
  position: absolute;
  top: 74px;
  right: 24px;
  width: min(100vw - 32px, 360px);
  max-height: 400px;
  overflow-y: auto;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-xl);
  background-color: var(--panel-solid);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  padding: 10px;
}
.dropdown-panel.open {
  display: block;
  animation: slideDownPanel 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif {
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  font-size: 13px;
  border-bottom: 1.5px solid var(--soft-line);
  transition: background-color 0.2s ease;
}
.notif:hover {
  background-color: var(--soft-line);
}
.notif b {
  font-weight: 800;
}
.notif-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.notif-actions .btn {
  padding: 6px 12px;
  min-height: 30px;
  font-size: 12px;
}

/* Modais HTML5 dialog overrides */
.app-modal {
  width: min(94vw, 520px);
  border: 1.5px solid var(--glass-border);
  border-radius: 28px;
  color: var(--text);
  background-color: var(--panel-solid);
  box-shadow: var(--shadow-lg);
  padding: 0;
  outline: none;
  overflow: hidden;
}
.app-modal::backdrop,
.story-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--soft-line);
  border: 1.5px solid var(--glass-border);
  color: var(--text);
  transition: all 0.2s ease;
}
.modal-close:hover {
  background-color: var(--line);
  transform: rotate(90deg);
}

.modal-head {
  padding: 24px 24px 12px;
  border-bottom: 1.5px solid var(--soft-line);
}
.modal-head h2 {
  font-size: 22px;
  font-weight: 900;
  margin: 0;
}
.modal-head p {
  font-size: 13.5px;
  color: var(--muted);
  margin: 4px 30px 0 0;
}

.modal-form {
  padding: 20px 24px 24px;
}

.composer-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
}
.composer-line textarea {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 120px;
}

/* Upload Dropzone */
.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  background-color: rgba(255,255,255,0.015);
  cursor: pointer;
  text-align: center;
  margin: 16px 0;
  transition: all 0.25s ease;
}
.upload-drop:hover, .upload-drop.dragover {
  border-color: var(--accent);
  background-color: rgba(0, 199, 255, 0.04);
}
.upload-drop span {
  font-weight: 800;
  font-size: 14px;
}
.upload-drop small {
  font-size: 12px;
  color: var(--muted);
}
.upload-drop input[type=file] {
  display: none;
}

/* Visual Local Media Preview */
.media-preview-box {
  width: 100%;
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: none;
}
.media-preview-box img, .media-preview-box video {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
}

/* Story view Modal */
.story-modal {
  width: auto;
  max-width: 95vw;
  border: none;
  background: transparent;
  outline: none;
  padding: 0;
}
.story-modal img, .story-modal video {
  display: block;
  max-width: min(440px, 92vw);
  max-height: 80vh;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 2.5px solid var(--glass-border);
}

/* Comments Modal list */
.comments-modal {
  width: min(94vw, 580px);
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 340px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.comment-item {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--soft-line);
}
.comment-item .avatar {
  width: 36px;
  height: 36px;
}
.comment-item b {
  font-size: 13.5px;
  font-weight: 800;
}
.comment-item p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
}
.comment-item .muted {
  font-size: 11px;
}

/* Requirement items */
.verify-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 24px 16px;
}
.requirement {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background-color: var(--soft-line);
}
.requirement.ok {
  border-color: rgba(46, 211, 166, 0.4);
  background-color: rgba(46, 211, 166, 0.05);
}
.requirement.ok .icon-btn {
  color: var(--good);
  background-color: rgba(46, 211, 166, 0.1);
}
.requirement .icon-btn {
  width: 36px;
  height: 36px;
  border-color: transparent;
}
.requirement strong {
  font-size: 14px;
  font-weight: 800;
}
.requirement span {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}
.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background-color: var(--line);
  margin-top: 8px;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
}

/* ==========================================================================
   ADMIN CONTROL ROOM DASHBOARD (Glass Dashboard Extension)
   ========================================================================== */

.admin-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}
.admin-head h1 {
  font-size: 32px;
  font-weight: 950;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat {
  padding: 20px;
  border-radius: 20px;
}

.admin-panel {
  padding: 24px;
  border-radius: 24px;
  margin-bottom: 24px;
}
.admin-panel h2 {
  font-size: 18px;
  font-weight: 850;
  margin-bottom: 20px;
}

.table-responsive {
  border-radius: 12px;
  overflow: hidden;
}

.table-dark {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--line);
  margin-bottom: 0;
}
.table-dark th {
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom-width: 2px;
}
.table-dark td {
  padding: 12px 16px;
  font-size: 13.5px;
}

.admin-post, .verify-request {
  padding: 16px 0;
  border-bottom: 1.5px solid var(--soft-line);
}
.admin-post:last-child, .verify-request:last-child {
  border-bottom: none;
}

/* ==========================================================================
   HARDWARE ACCELERATED TRANSITIONS & KEYFRAMES & MICRO-INTERACTIONS
   ========================================================================== */

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

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

@keyframes pulseLive {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 12px var(--good); }
}

@keyframes typingDot {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@keyframes slideInBubble {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popMenu {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Shimmer Loading Skeletons */
.skeleton-card {
  height: 120px;
  margin: 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(90deg, var(--soft-line) 25%, var(--line) 50%, var(--soft-line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Toast animations */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-msg {
  background: var(--panel-solid);
  border: 1.5px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 20px;
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Loader Screen Overlay */
#globalLoader {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#globalLoader.loading {
  display: block;
  opacity: 0.6;
}

/* Active Alert Pill for SSE feed alerts */
.new-post-alert-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px auto;
  padding: 8px 18px;
  border-radius: 99px;
  background-color: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(0, 199, 255, 0.25);
  cursor: pointer;
  width: fit-content;
  animation: slideUp 0.25s ease forwards;
}
.new-post-alert-pill:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS (Mobile bottom sheet, Offcanvas sidebars)
   ========================================================================== */

/* Mobile Bottom Navigation Bar (Bottom sheet helper) */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(var(--bg-hsl), 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1.5px solid var(--line);
  z-index: 95;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.mobile-bottom-bar .nav-pill-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  gap: 3px;
}
.mobile-bottom-bar .nav-pill-mobile.active {
  color: var(--accent);
}
.mobile-bottom-bar .nav-pill-mobile i {
  width: 22px;
  height: 22px;
}

/* Hide elements when screens scale down */
@media (max-width: 1100px) {
  .rightbar {
    display: none;
  }
  .app-shell {
    border-right: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .app-shell {
    margin-left: 0;
    width: 100%;
    padding-bottom: 74px; /* Space for bottom navigation */
  }
  .topbar {
    padding: 12px 18px;
  }
  .mobile-bottom-bar {
    display: flex;
  }
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .thread-list {
    display: block; /* Will toggled in UI if active thread selected */
  }
  .chat-box {
    display: none;
  }
  .chat-layout.in-chat .thread-list {
    display: none;
  }
  .chat-layout.in-chat .chat-box {
    display: flex;
  }
}

@media (max-width: 480px) {
  .post-body {
    margin-left: 0;
  }
  .post-img {
    width: 100%;
    margin-left: 0;
  }
  .post-actions {
    margin-left: 0;
    justify-content: space-around;
  }
  .post-name {
    font-size: 13.5px;
  }
  .post {
    padding: 16px 14px;
  }
  .quick-composer {
    margin: 16px 14px;
  }
  .stories-row {
    padding: 16px 14px;
  }
  .auth-card {
    padding: 24px 18px;
  }
}

/* Responsive Table Mobile Stacking Layout */
@media (max-width: 768px) {
  table.responsive-stack-table,
  table.responsive-stack-table thead,
  table.responsive-stack-table tbody,
  table.responsive-stack-table th,
  table.responsive-stack-table td,
  table.responsive-stack-table tr {
    display: block;
    width: 100% !important;
  }
  table.responsive-stack-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  table.responsive-stack-table tr {
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  table.responsive-stack-table td {
    border: none;
    border-bottom: 1.5px solid var(--line);
    position: relative;
    padding-left: 45% !important;
    text-align: right;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  table.responsive-stack-table td:last-child {
    border-bottom: none;
  }
  table.responsive-stack-table td:before {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 40%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    color: var(--muted);
    content: attr(data-label);
  }
}

/* Micro-animation spring pop for DM hover actions bar */
.message-hover-actions {
  display: none;
  animation: popMenu 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: bottom center;
}
.chat-message-row:hover .message-hover-actions {
  display: flex !important;
}

/* 60FPS Page content visibility optimization */
.post {
  content-visibility: auto;
  contain-intrinsic-size: 400px;
}

/* Tab button animation bar */
.profile-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 24px;
  justify-content: center;
  gap: 32px;
}
.profile-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--muted);
  position: relative;
  transition: color 0.2s ease;
}
.profile-tab-btn:hover {
  color: var(--text);
}
.profile-tab-btn.active {
  color: var(--accent);
}
.profile-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1.5px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 99px;
}

/* Instagram-like dynamic posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.grid-item {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--glass-border);
  background-color: var(--panel);
  cursor: pointer;
}
.grid-item img, .grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.grid-item:hover img, .grid-item:hover video {
  transform: scale(1.05);
}
.grid-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  transition: opacity 0.2s ease;
}
.grid-item:hover .grid-item-overlay {
  opacity: 1;
}

/* Settings categorization grid panel layout */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  min-height: 400px;
}
.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1.5px solid var(--line);
  padding-right: 16px;
}
.settings-tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.2s ease;
  text-align: left;
}
.settings-tab-btn:hover {
  background-color: var(--soft-line);
  color: var(--text);
}
.settings-tab-btn.active {
  background-color: var(--panel);
  color: var(--accent);
}
.settings-pane {
  display: none;
  animation: fadeIn 0.25s ease;
}
.settings-pane.active {
  display: block;
}

/* Stories visual progress bar tracker */
.story-progress-container {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  z-index: 20;
}
.story-progress-bar {
  flex: 1;
  height: 3px;
  background-color: rgba(255, 255, 255, 0.35);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.story-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background-color: #fff;
  transition: width 0.1s linear;
}

/* Message Seen delivery status lines */
.message-status-line {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.message-status-line.me {
  justify-content: flex-end;
}

/* Accessibility outlined focus states */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}
