:root {
  --bg-primary: #ffffff;
  --bg-inverse: #000000;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #fafafa;
  --bg-input: #eeeeee;
  --border-color: #f0f0f0;

  --text-primary: #000000;
  --text-inverse: #ffffff;
  --text-secondary: #888888;
  --text-tertiary: #bbbbbb;

  --accent-primary: #000000;
  --accent-error: #ff3b3b;
  --accent-pink: #f91880;
  --accent-green: #00a884;
  --primary-color: #000000;

  /* Whatsapp Specific */
  --chat-bg: #ffffff;
  --chat-bubble-out: #000000;
  --chat-bubble-in: #eee;

  --skeleton-bg: #eeeeee;
  --skeleton-shimmer: #f5f5f5;

  --font: "Roboto", sans-serif;

  --sidebar-width: 240px;
  --right-sidebar-width: 280px;
  --feed-width: 500px;
}

/* Desktop-only spacers */
.desktop-only-spacer {
  display: none;
}
@media (min-width: 1181px) {
  .desktop-only-spacer {
    display: block;
    height: 100vh;
  }
}

/* Base Layout Container */
.app-main-layout {
  display: block; /* Default mobile view */
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

@media (min-width: 1181px) {
  .app-main-layout {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #000000;
    --bg-inverse: #ffffff;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-input: #222222;
    --border-color: #222222;

    --text-primary: #ffffff;
    --text-inverse: #000000;
    --text-secondary: #aaaaaa;
    --text-tertiary: #777777;

    --accent-pink: #f91880;
    --accent-green: #00ca9d;
    --accent-primary: #ffffff;
    --primary-color: #ffffff;

    /* Whatsapp Exact Dark Mode */
    --chat-bg: #000000;
    --chat-bubble-out: #eee;
    --chat-bubble-in: #272727;

    --skeleton-bg: #222222;
    --skeleton-shimmer: #333333;
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.material-symbols-outlined {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Spinner */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Chat Preloader (inside stream) */
.chat-preloader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Global Page Transition Preloader */
.page-preloader {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 999999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.page-preloader.active {
  display: flex;
  opacity: 1;
}

/* Custom Scrollbar Configuration */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

button {
  cursor: pointer;
}

input,
textarea {
  border-radius: 50px;
  resize: none;
}

/* Preloader */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

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

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Header Styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem 0.7rem 0.5rem;
  background-color: var(--bg-primary);
  top: 0;
  left: 0;
  position: sticky;
  z-index: 5000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Loading Bar */
#top-loading-bar {
  position: fixed;
  top: 3.3rem;
  left: 0;
  width: 0;
  height: 3px;
  background-color: var(--bg-inverse);
  z-index: 1000001;
  transition:
    width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}
#top-loading-bar.active {
  width: 88%;
  opacity: 1;
}
#top-loading-bar.loading {
  opacity: 1;
  width: 70%; /* Middle state for feedback */
}

/* Removal Animation */
.post-card.removing,
.reel-item.removing {
  animation: postFadeOut 0.4s ease forwards;
  pointer-events: none;
}

@keyframes postFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
  }
  50% {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 1000px;
  }
  100% {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    margin: 0;
    overflow: hidden;
  }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-left .logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  border-radius: 50%;
  transition: background 0.2s;
}

@media (min-width: 1181px) {
  .sidebar-toggle {
    display: none;
  }
}
.sidebar-toggle:hover {
  background: var(--bg-input);
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-primary);
  z-index: 250;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

@media (min-width: 1181px) {
  .sidebar {
    position: fixed;
    top: 0;
    transform: none;
    height: 100vh;
    z-index: 10;
  }

  .sidebar-toggle {
    display: none;
  }
}

@media (max-width: 1180px) {
  .sidebar {
    left: 0;
  }
}

/* Custom Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}
.sidebar.active {
  transform: translateX(0);
}

.sidebar-nav {
  margin-top: 3.3rem;
  padding: 8px 0;
  flex: 1;
}

@media (max-width: 1180px) {
  .sidebar-nav {
    margin-top: 0;
  }
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0.5rem 0.7rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  cursor: pointer;
}
.sidebar-item:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}
.sidebar-item.active {
  color: var(--text-primary);
  background: var(--bg-input);
  font-weight: 600;
}
.sidebar-item .material-symbols-outlined {
  font-size: 24px;
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 15px 0;
}

.sidebar-label {
  padding: 10px 15px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  margin-top: 10px;
}

/* Sidebar Icons - Standardized */
.icon-home,
.icon-search,
.icon-reels,
.icon-chats,
.icon-notes,
.icon-music,
.icon-services,
.icon-courses,
.icon-shop,
.icon-ads {
  color: var(--text-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 15px;
  margin-top: auto;
  margin-bottom: 3rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0.5rem;
}
.footer-links a {
  font-size: 11px;
  color: #808080;
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover {
  color: var(--text-primary);
}
.copyright {
  font-size: 11px;
  color: #808080;
  opacity: 0.8;
}

/* Tabs - Desktop: centered in header */
.tabs-container {
  display: flex;
  gap: 30px;
  align-items: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

@media (min-width: 1181px) {
  .tab-label {
    display: block;
  }
}

/* Hide Add button on desktop */
.tab-btn.tab-btn-add {
  display: none !important;
  text-decoration: none;
}

.tab-btn {
  background: none;
  border: none;
  font-size: 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0.3rem;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  text-decoration: none;
  position: relative;
}

.tab-badge {
  position: absolute;
  top: -2px;
  right: -5px;
  background: var(--accent-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-primary);
  pointer-events: none;
}

.comment-reply-btn:hover {
  color: #fff !important;
  text-decoration: underline;
}

.tab-btn .material-symbols-outlined {
  font-size: 22px;
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
  font-weight: 500;
}
.tab-btn {
  position: relative;
}
.tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: #ff3b3b;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 10px;
  padding: 0 4px;
  font-family: inherit;
  box-sizing: border-box;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.header-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: background 0.15s;
}
.header-icon-btn:hover {
  background: var(--bg-tertiary);
}
.header-icon-btn .material-symbols-outlined {
  font-size: 22px;
}

.sign-in-btn {
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 400;
}

.dots-btn {
  background: none;
  border: none;
  font-size: 18px;
  padding: 0;
  color: var(--text-primary);
}

/* Main Content */
.content-container {
  width: 100%;
  max-width: var(--feed-width, 500px);
  margin: 0 auto;
  padding: 0.5rem;
  box-sizing: border-box;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}
.content-loader {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.post-item,
.chat-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

/* Sign In Modal */
#signin-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 10000;
  flex-direction: column;
  align-items: center;
}

.signin-container {
  margin-top: 5rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  box-sizing: border-box;
}

.signin-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.signin-input {
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--bg-input);
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
}

.signin-input.has-btn {
  padding-right: 90px;
}

.send-otp-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: none;
  padding: 8px 16px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 50px;
}

.btn-full {
  width: 100%;
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
  border: none;
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 5px;
  border-radius: 50px;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: var(--text-primary);
  line-height: 1;
}

.signin-links {
  margin-top: 20px;
  font-size: 12px;
  text-align: center;
  color: var(--text-secondary);
}
.signin-links a {
  color: var(--text-primary);
  text-decoration: none;
  margin: 0 5px;
}

/* Comment Section */
.comments-section {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
}
.comment-input-area {
  margin-bottom: 15px;
}
.comment-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  resize: none;
  min-height: 40px;
  max-height: 150px;
  overflow-y: auto;
}
.comment-input:focus {
  border-color: var(--text-secondary);
}
.comment-send-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-inverse);
  color: var(--bg-primary);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.comment-send-btn:hover {
  opacity: 0.85;
}
.comment-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.comment-send-btn .material-symbols-outlined {
  font-size: 18px;
}
.comment-anon-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.comment-anon-toggle input[type="checkbox"] {
  accent-color: var(--text-primary);
}

/* Comment Items */
.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}
.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.comment-body {
  flex: 1;
  min-width: 0;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-author {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.comment-time {
  font-size: 12px;
  color: var(--text-tertiary);
}
.comment-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
  margin-top: 2px;
  word-wrap: break-word;
}
.comment-actions {
  margin-top: 4px;
}
.comment-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
  font-family: inherit;
}
.comment-like-btn:hover {
  color: var(--text-secondary);
}
.comment-like-btn.comment-liked {
  color: #ff2a2a;
}
.comment-like-btn.comment-liked .material-symbols-outlined {
  font-variation-settings: "FILL" 1;
}
.comment-like-count {
  font-weight: 500;
}

/* Settings Page */
.settings-container {
  max-width: 600px;
  margin: 0 auto 2rem auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.settings-title {
  font-size: 16px;
  font-weight: 600;
}
.profile-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
}

.cover-pic-container {
  width: 100%;
  aspect-ratio: 700 / 200;
  background-color: var(--bg-tertiary);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border-color);
}
.cover-placeholder {
  color: var(--text-tertiary);
  font-size: 14px;
}

.profile-info-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start; /* Increased from -45px to move pic higher */
  padding: 0;
  gap: 15px;
  position: relative;
  z-index: 15;
  margin-top: 0.3rem;
}

.profile-pic {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: 4px solid var(--bg-primary);
  flex-shrink: 0;
  cursor: pointer;
  z-index: 10;
}

.profile-details {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex-grow: 1; /* Matched to the new margin-top overlap */
}
#profile-details-row {
  margin-bottom: 0.5rem;
}
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-name-row h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.edit-icon {
  font-size: 18px !important;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}
.edit-icon:hover {
  color: var(--text-primary);
}

#display-about {
  margin: 5px 0 0 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 200px;
  cursor: pointer;
}

.truncated-bio {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.expanded-bio {
  white-space: normal;
  overflow: visible;
}

.settings-input {
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--bg-input);
  border-radius: 50px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
}

.settings-textarea {
  width: 100%;
  padding: 15px 20px;
  border: 1px solid var(--bg-input);
  border-radius: 20px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

.save-btn {
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
  border: none;
  padding: 12px;
  border-radius: 50px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: 500;
}

.signout-btn {
  background-color: var(--bg-primary);
  color: var(--accent-error);
  border: 1px solid var(--accent-error);
  padding: 12px;
  border-radius: 50px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 30px;
  font-weight: 500;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}
.settings-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.settings-tab:hover {
  color: var(--text-primary);
}
.settings-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
  font-weight: 600;
}
.settings-tab-panel {
  display: none;
}
.settings-tab-panel.active {
  display: block;
}

/* Action icons in tables — smaller */
.action-icon {
  font-size: 18px !important;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.action-icon:hover {
  background: var(--bg-input);
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.media-grid-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-tertiary);
}
.media-grid-item:hover {
  opacity: 0.85;
}
.media-play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#file-input {
  display: none;
}
.header-back {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  gap: 5px;
  font-weight: 500;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10002;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
}
.toast.error {
  background-color: var(--accent-error);
  color: #fff;
}
.toast.success {
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
}

/* Post Cards */
.post-card {
  background-color: var(--bg-primary);
  border-radius: 12px;
  margin-bottom: 2rem;
}
.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.post-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-inverse);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--bg-primary);
}
.post-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-author,
.post-username {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
}
.post-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.post-body {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 15px;
  word-wrap: break-word;
}
.clamp-text {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}

.post-images {
  display: grid;
  gap: 2px;
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
}
.post-images.grid-1 {
  grid-template-columns: 1fr;
}
.post-images.grid-1 .img-wrapper img {
  max-height: 500px;
  object-fit: cover;
}
.post-images.grid-2 {
  grid-template-columns: 1fr 1fr;
}
.post-images.grid-2 .img-wrapper {
  aspect-ratio: 1 / 1;
}
.post-images.grid-3 {
  grid-template-columns: 1fr 1fr;
}
.post-images.grid-3 .img-wrapper:first-child {
  grid-column: span 2;
  aspect-ratio: 2 / 1.2;
}
.post-images.grid-3 .img-wrapper:not(:first-child) {
  aspect-ratio: 1 / 1;
}
.post-images.grid-4 {
  grid-template-columns: 1fr 1fr;
}
.post-images.grid-4 .img-wrapper {
  aspect-ratio: 1 / 1;
}

.img-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-tertiary);
  animation: skeleton-pulse 1.5s infinite ease-in-out;
}
.img-wrapper.loaded {
  animation: none;
  background: transparent;
}
@keyframes skeleton-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}
.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.img-wrapper img.loaded {
  opacity: 1;
}

.comment-highlight {
  animation: comment-pulse 3s forwards;
  border-radius: 8px;
}

@keyframes comment-pulse {
  0% {
    box-shadow: 0 0 0 2px var(--primary-color);
    background-color: rgba(var(--primary-rgb, 12, 110, 253), 0.1);
  }
  100% {
    box-shadow: 0 0 0 0px transparent;
    background-color: transparent;
  }
}
/* Custom Modal System */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-primary);
  width: 90%;
  max-width: 400px;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.modal-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter 0.2s;
}

.modal-btn:active {
  filter: brightness(0.9);
}

.modal-btn-confirm {
  background: var(--primary-color);
  color: var(--bg-primary);
}

.modal-btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.img-wrapper.with-more .more-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 28px;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
}

.post-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  color: var(--text-secondary);
}
.post-actions-left {
  display: flex;
  align-items: center;
  gap: 5px;
}
.post-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.15s;
}
.post-action-btn:hover {
  color: var(--text-primary);
}

.reacted-thumb {
  color: var(--text-primary) !important;
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24 !important;
}

/* Skeleton & Preloader Enhancements */
@keyframes shimmer {
  0% {
    background-position: -468px 0;
  }
  100% {
    background-position: 468px 0;
  }
}

.skeleton {
  background: var(--skeleton-bg);
  background-image: linear-gradient(
    to right,
    var(--skeleton-bg) 0%,
    var(--skeleton-shimmer) 20%,
    var(--skeleton-bg) 40%,
    var(--skeleton-bg) 100%
  );
  background-repeat: no-repeat;
  background-size: 800px 104px;
  display: inline-block;
  position: relative;
  animation-duration: 1s;
  animation-fill-mode: forwards;
  animation-iteration-count: infinite;
  animation-name: shimmer;
  animation-timing-function: linear;
  border-radius: 4px;
}

.post-skeleton {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-skeleton-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.post-skeleton-name {
  width: 120px;
  height: 14px;
}

.post-skeleton-media {
  width: 100%;
  height: 200px;
  border-radius: 8px;
}

.post-skeleton-text {
  width: 80%;
  height: 12px;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 25px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

/* Mobile: Avoid bottom tabs */
@media (max-width: 1180px) {
  .back-to-top {
    bottom: 55px;
    right: 15px;
  }
}

/* Desktop: Align near content container */
@media (min-width: 1181px) {
  .back-to-top {
    left: calc(50% + 320px);
    right: auto;
    bottom: 40px;
  }
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px var(--shadow-color);
}

/* Add UI Modules */
/* Lightbox Styles */
#lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 100000;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
#lightbox-image {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  display: none;
  border-radius: 8px;
}
#lightbox-loader {
  display: none;
  width: 40px;
  height: 40px;
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}
.lightbox-controls {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-controls:hover {
  background: rgba(255, 255, 255, 0.2);
}
#lightbox-close {
  top: 20px;
  right: 20px;
}
#lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}
#lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}
#lightbox-counter {
  position: absolute;
  top: 25px;
  left: 20px;
  color: white;
  font-size: 16px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 20px;
}

.input-group {
  margin-bottom: 15px;
}
.input-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  margin-left: 10px;
}
.select-input {
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--bg-input);
  border-radius: 50px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  appearance: none;
}
.file-upload-wrapper {
  margin-top: 10px;
  padding: 20px;
  border: 1px dashed var(--border-color);
  border-radius: 20px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-tertiary);
}
.file-upload-wrapper:hover {
  background: var(--border-color);
}

/* Add Post - Media Type Tabs */
.add-media-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}
.add-media-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.15s,
    color 0.15s;
}
.add-media-tab .material-symbols-outlined {
  font-size: 18px;
}
.add-media-tab.active {
  background: var(--bg-inverse);
  color: var(--bg-primary);
}

@media (max-width: 400px) {
  .add-media-tab span:not(.material-symbols-outlined) {
    display: none;
  }
}

/* Premium Audio and File Styles */
.post-audio-card,
.post-file-card {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

audio::-webkit-media-controls-panel {
  background-color: #eee;
}

.post-audio-art {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.post-file-card .modal-btn-confirm {
  transition: all 0.2s;
}

.post-file-card .modal-btn-confirm:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
  color: var(--text-inverse);
}
.media-panel {
  display: none;
}
.media-panel.active {
  display: block;
}
#add-post-images {
  display: none;
}
.friends-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.friend-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  border-radius: 20px;
}
.friend-icon {
  width: 40px;
  height: 40px;
  border-radius: 50px;
  background: var(--bg-inverse);
  color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Chats List UI Constraints */
.chat-list-item {
  display: flex;
  align-items: center;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  color: var(--text-primary);
  padding: 0.5rem 0;
}
.chat-list-item:hover {
  background: var(--bg-input);
}
.chat-list-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-inverse);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  color: var(--bg-primary);
  margin-right: 15px;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s;
}
.chat-list-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-list-info {
  flex: 1;
  overflow: hidden;
}
.chat-list-name {
  font-size: 15px;
  color: inherit;
  margin-bottom: 4px;
}
.chat-list-lastmsg {
  font-size: 13px;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
}
.chat-list-time {
  font-size: 11px;
  color: inherit;
}

/* Chat Item More Menu */
.chat-item-more {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-tertiary);
  transition:
    background 0.2s,
    color 0.2s;
}
.chat-item-more:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 15px var(--shadow-color);
  z-index: 1000;
  min-width: 130px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeInDown 0.2s ease;
}

.chat-menu-item {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    background 0.2s,
    color 0.2s;
  cursor: pointer;
}
.chat-menu-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.chat-menu-item.danger {
  color: #ff4d4d;
}
.chat-menu-item.danger:hover {
  background: rgba(255, 77, 77, 0.1);
  color: #ff4d4d;
}

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

/* ===========================
   WhatsApp Engine Combines 
   =========================== */

.chat-header {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  z-index: 10;
}

.chat-header-left {
  display: flex;
  align-items: center;
}
.chat-header-left span {
  color: var(--chat-header-text, var(--bg-primary)) !important;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin-right: 15px;
}

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

.chat-info {
  flex: 1;
}
.chat-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}
.chat-status {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.chat-nav-arrows {
  display: flex;
  gap: 0;
  margin-left: auto;
}
.chat-nav-btn {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 2px;
  border-radius: 6px;
  transition:
    background 0.15s,
    color 0.15s;
  line-height: 1;
}
.chat-nav-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-stream {
  flex: 1;
  background-color: var(--chat-bg);
  overflow-y: auto;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-box {
  max-width: 75%;
  padding: 4px 10px;
  min-width: 100px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  color: var(--text-primary);
}

.message-in {
  align-self: flex-start;
  background-color: var(--chat-bubble-in);
  border-top-left-radius: 0;
}

.message-out {
  align-self: flex-end;
  background-color: var(--chat-bubble-out);
  border-top-right-radius: 0;
  color: var(--bg-primary);
}

.message-text {
  margin-bottom: 8px;
  padding: 0;
}

.message-time {
  font-size: 10px;
  color: var(--text-secondary);
  position: absolute;
  bottom: 2px;
}

.chat-footer {
  background-color: var(--bg-tertiary);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-attach-icon {
  color: var(--text-secondary);
  scroll-behavior: smooth;
  cursor: pointer;
  padding: 8px;
}

.chat-input-box {
  flex: 1;
  border: none;
  padding: 12px 15px;
  border-radius: 20px;
  outline: none;
  font-size: 15px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.chat-send-btn {
  background-color: var(--bg-inverse);
  color: var(--bg-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

/* Message Actions Toolbar */
.message-actions {
  display: flex;
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px 4px;
  gap: 2px;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.msg-action-icon {
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-primary);
  transition:
    background 0.15s,
    color 0.15s;
}
.msg-action-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Message Attachments */
.msg-attachment {
  margin-bottom: 6px;
}
.msg-attachment-img {
  max-width: 200px;
  max-height: 300px;
  border-radius: 6px;
  cursor: pointer;
  display: block;
  object-fit: cover;
}
.msg-attachment-video {
  max-width: 200px;
  max-height: 300px;
  border-radius: 6px;
  display: block;
}
.msg-attachment-file a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(128, 128, 128, 0.1);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  word-break: break-all;
}
.msg-attachment-file a:hover {
  background: rgba(128, 128, 128, 0.2);
}

/* Multi-image grid in chat bubbles */
.msg-img-grid {
  display: grid;
  gap: 3px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
  max-width: 260px;
}
.msg-img-grid-2 {
  grid-template-columns: 1fr 1fr;
}
.msg-img-grid-3 {
  grid-template-columns: 1fr 1fr;
}
.msg-img-grid-3 .msg-grid-item:first-child {
  grid-column: span 2;
}
.msg-img-grid-4 {
  grid-template-columns: 1fr 1fr;
}
.msg-grid-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
}
.msg-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.msg-grid-item .more-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Upload Progress Bar */
.upload-progress-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 15px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}
.upload-progress-fill {
  height: 4px;
  background: var(--bg-inverse);
  border-radius: 4px;
  width: 0%;
  flex: 1;
  transition: width 0.2s ease;
  position: relative;
}
.upload-progress-bar::before {
  content: "";
  position: absolute;
  left: 0;
  height: 4px;
  border-radius: 4px;
  background: var(--border-color);
  width: 100%;
}
.upload-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 35px;
  text-align: right;
}

/* Deleted Message */
.message-deleted {
  color: var(--text-tertiary) !important;
  font-size: 13px;
}

/* Online Status */
.status-online {
  color: #22c55e !important;
  font-weight: 500;
}

/* Attachment Preview Bar */
.attach-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 15px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}
.attach-preview-content {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cropper Modal */
.crop-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.crop-modal-header {
  width: 90%;
  max-width: 600px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  color: #fff;
}
.crop-modal-body {
  width: 90%;
  max-width: 600px;
  max-height: 60vh;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
}
.crop-modal-body img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
}
.crop-modal-footer {
  width: 90%;
  max-width: 600px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 0;
}
.crop-cancel-btn {
  padding: 8px 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}
.crop-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.crop-confirm-btn {
  padding: 8px 28px;
  border-radius: 8px;
  border: none;
  background: #fff;
  color: #000;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}
.crop-confirm-btn:hover {
  background: #e0e0e0;
}

/* User Posts Table */
.user-posts-list-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 0;
}
.user-posts-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
  font-size: 14px;
}
.user-posts-table th,
.user-posts-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.user-posts-table th {
  color: var(--text-secondary);
  font-weight: 600;
}
.user-posts-table tr:last-child td {
  border-bottom: none;
}
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}
.pagination-controls button {
  background: var(--bg-inverse);
  color: var(--bg-primary);
  border: none;
  padding: 6px 15px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
}
.pagination-controls button:disabled {
  background: var(--bg-input);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Post Dropdown Menu Actions */
.post-dropdown-menu {
  border: 1px solid var(--border-color);
}
.post-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s ease;
}
.post-menu-item:last-child {
  border-bottom: none;
}
.post-menu-item:hover {
  background: var(--bg-secondary);
}
.post-menu-item .material-symbols-outlined {
  font-size: 18px;
}

/* Reels Layout Styles */
.reels-wrapper {
  padding: 0;
  max-width: 100%;
  height: calc(100vh - 60px);
}
.reels-scroller {
  height: 100%;
  width: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  background: var(--bg-primary);
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.reels-scroller::-webkit-scrollbar {
  display: none;
}
.reel-item {
  height: 100%;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
}
.reel-video-wrapper {
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 450px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto;
}
.reel-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.reel-overlay-right {
  position: absolute;
  right: 15px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  z-index: 5;
}
.reel-action-btn {
  background: transparent;
  border: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  padding: 0;
}
.reel-action-btn .material-symbols-outlined {
  font-size: 32px;
  margin-bottom: 5px;
  transition: transform 0.2s;
  color: #fff;
}
.reel-action-btn:active .material-symbols-outlined {
  transform: scale(0.9);
}
.reel-action-btn .action-count {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.reel-overlay-bottom {
  position: absolute;
  left: 15px;
  bottom: 36px;
  right: 70px;
  color: #fff;
  z-index: 5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.reel-overlay-bottom .reel-author {
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.reel-overlay-bottom .reel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #fff;
}
.reel-overlay-bottom .reel-desc {
  font-size: 14px;
  line-height: 1.4;
}
.reel-more-btn {
  font-weight: 600;
  cursor: pointer;
  margin-left: 2px;
  opacity: 0.8;
}

/* Reel Seek Bar */
.reel-seek-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 9;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.4));
  opacity: 1;
  pointer-events: auto;
}
.reel-time-elapsed,
.reel-time-total {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  min-width: 30px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  user-select: none;
}
.reel-seek-bar {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  transition: height 0.15s ease;
}
.reel-seek-container:hover .reel-seek-bar {
  height: 5px;
}
.reel-seek-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 0%;
  transition: none;
}
.reel-seek-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.reel-seek-container:hover .reel-seek-thumb {
  opacity: 1;
}

@media (max-width: 1180px) {
  .reel-action-btn .material-symbols-outlined {
    font-size: 24px;
    margin-bottom: 2px;
  }
  .reel-action-btn .action-count {
    font-size: 11px;
  }
  .reel-overlay-right {
    gap: 15px;
  }
  .reel-video-wrapper {
    height: 100%;
    width: 100%;
    border-radius: 0;
    max-width: 100%;
    margin: 0;
  }
  .reels-wrapper {
    height: calc(100dvh - 60px) !important;
  }
  .tabs-container {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    justify-content: space-around;
    gap: 0;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 6px 0;
    z-index: 9000;
    padding-bottom: env(safe-area-inset-bottom, 6px);
  }
  .tab-btn {
    flex: 1;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 4px 0;
    border-bottom: none;
  }
  .tab-btn.active {
    border-bottom: none;
    color: var(--text-primary);
  }
  .tab-badge {
    top: 0px;
    right: 50%;
    transform: translateX(18px);
    font-size: 8px;
    min-width: 14px;
    height: 14px;
    line-height: 14px;
    padding: 0 3px;
  }
  /* Hide Add button on mobile */
  .tab-btn.tab-btn-add {
    display: none !important;
  }
  .content-container {
    padding-bottom: 65px;
  }
  .header-right
    .material-symbols-outlined:not(.apps-icon):not(.add-icon-trigger) {
    display: none;
  }
  .header-right .apps-icon,
  .header-right .add-icon-trigger {
    display: flex !important;
  }
  .content-container {
    margin-top: 0rem;
  }
}

/* ==========================================
   SIGNIN PAGE
   ========================================== */
body.signin-body {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-primary);
}

.signin-page {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  gap: 60px;
  box-sizing: border-box;
}

.signin-brand {
  flex: 1;
  display: flex;
  justify-content: center;
  flex-direction: column;
}
.signin-brand p {
  font-size: 32px;
  color: var(--text-secondary);
  min-height: 1.5em;
  overflow: hidden;
  position: relative;
}

/* Sample Pages Utility */
.sample-page-hero {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-secondary);
  border-radius: 24px;
  margin-bottom: 20px;
}
.hero-icon {
  font-size: 64px;
  color: var(--accent-primary, #000);
  margin-bottom: 15px;
}
.sample-page-hero h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.sample-page-hero p {
  color: var(--text-tertiary);
  font-size: 15px;
  max-width: 400px;
  margin: 0 auto;
}
.sample-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}
.sample-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}
.sample-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary, #000);
}
.sample-card-icon {
  font-size: 32px;
  margin-bottom: 15px;
  color: var(--text-secondary);
}
.sample-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}
.sample-card p {
  font-size: 14px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* 404 Page Styles */
.error-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}
.error-code {
  font-size: 120px;
  font-weight: 900;
  letter-spacing: -5px;
  line-height: 1;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #000, #444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.error-msg {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 300px;
}
.back-btn {
  background: #000;
  color: #fff;
  padding: 12px 30px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: opacity 0.2s;
}
.back-btn:hover {
  opacity: 0.8;
}

.text-segment {
  display: block;
  opacity: 0;
  animation: sideUp 0.8s ease-out forwards;
}

@keyframes sideUp {
  0% {
    opacity: 0;
    transform: translateY(20px) translateX(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

.brand-text {
  font-size: clamp(64px, 16vw, 200px);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -3px;
  line-height: 1;
  user-select: none;
}

.signin-side {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.signin-form-wrapper {
  width: 100%;
  max-width: 380px;
}

.explore-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--text-primary);
  border-radius: 50px;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.show-apps-btn {
  align-self: flex-start;
  width: auto !important;
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 24px !important;
  margin-bottom: 20px;
}

.show-apps-btn span {
  font-size: 20px;
}

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

.signin-body .signin-container {
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin-top: 0;
}

.signin-body .signin-title {
  color: var(--text-primary);
}

.signin-body .signin-input {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.signin-body .signin-input::placeholder {
  color: var(--text-tertiary);
}

.signin-body .signin-input:focus {
  border-color: var(--text-secondary);
}

.signin-body .send-otp-btn {
  color: var(--text-primary);
  border-color: var(--border-color);
}

.signin-body .signin-links a {
  color: var(--text-tertiary);
}

.signin-body .signin-links a:hover {
  color: var(--text-primary);
}
.signin-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 13px;
  color: #808080;
}
@media (max-width: 600px) {
  .signin-footer {
    font-size: 11px;
  }
}
.signin-footer a {
  text-decoration: none;
  color: #808080;
  margin-right: 0.3rem;
}
.signin-footer p {
  margin-top: 0.2rem;
}

@media (max-width: 1180px) {
  .sidebar {
    left: 0;
  }
}

@media (max-width: 1180px) {
  .signin-page {
    flex-direction: column;
    padding: 40px 20px;
    gap: 40px;
  }

  .signin-brand {
    flex: none;
  }

  .brand-text {
    font-size: 72px;
    letter-spacing: -2px;
  }

  .signin-side {
    flex: none;
    width: 100%;
  }
  .signin-brand {
    flex: 1;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
  }
  .signin-brand p {
    font-size: 18px;
    text-align: center;
  }
  .show-apps-btn {
    align-self: center;
  }
}
/* Reels Comment Drawer (Bottom Sheet) */
.reels-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}
.reels-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}
.reels-drawer-content {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  height: 70vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.reels-drawer-backdrop.active .reels-drawer-content {
  transform: translateY(0);
}
.reels-drawer-header {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.reels-drawer-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  margin-bottom: 10px;
}
.reels-drawer-title-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.reels-drawer-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.reels-drawer-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 5px;
}
.reels-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 15px;
}
.reels-drawer-input-area {
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Home Feed Inline Comments */
.inline-comments-box {
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
  padding: 10px 0;
}
.inline-comment-input {
  resize: none;
  min-height: 34px;
  max-height: 120px;
  overflow-y: auto;
}
.inline-comments-list {
  max-height: 350px;
  overflow-y: auto;
}

@media (max-width: 1180px) {
  .reels-drawer-content {
    max-width: none;
    height: 75vh;
  }
  .toast {
    padding: 8px 16px;
    font-size: 13px;
  }
}
/* Apps Modal Overlay */
.apps-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.apps-overlay.active {
  display: flex;
  opacity: 1;
}

.apps-content {
  background: var(--bg-primary);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 24px;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  transition: transform 0.3s ease;
}

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

.apps-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.close-apps-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 24px;
}

.post-1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.post-1 a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.post-1 img {
  width: 46px;
  height: 46px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--bg-tertiary);
}

.post-1 p {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-1 p:last-child {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
}

@media (max-width: 1180px) {
  .apps-content {
    padding: 1rem;
    height: 90vh;
    max-height: none;
    border-radius: 24px 24px 0 0;
  }
}

/* Connection Status Toast */
.connection-toast {
  position: fixed;
  bottom: 0px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 15px;
  z-index: 99999999;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.connection-toast.active {
  transform: translateY(0);
}

.connection-toast-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  max-width: 90vw;
  pointer-events: auto;
}

.connection-toast.offline .connection-toast-inner {
  background: #ff4b2b; /* Vibrant Red for Offline */
  color: #fff;
}

.connection-toast.online .connection-toast-inner {
  background: #00c851; /* Vibrant Green for Back Online */
  color: #fff;
}

.connection-toast .material-symbols-outlined {
  font-size: 20px;
}

/* Image Preview Removal Button */
.preview-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  z-index: 5;
}

.preview-remove-btn:hover {
  background: #ff4b2b;
  color: #fff;
  transform: scale(1.1);
}
.follow-plus-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-inverse);
  color: var(--bg-primary);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  margin-left: 0;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  vertical-align: middle;
}
.follow-plus-btn .material-symbols-outlined {
  font-size: 14px;
  font-weight: bold;
}
.follow-plus-btn:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
  transform: scale(1.1);
}
.follow-plus-btn.is-following {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}
.suggest-item-sidebar:hover,
.following-item-sidebar:hover {
  background: var(--bg-tertiary) !important;
}

/* Community Rules Section */
.rules-container {
  margin-bottom: 20px;
  border-radius: 12px;
  background: var(--bg-primary);
  overflow: hidden;
  transition: all 0.3s ease;
}

.rules-details {
  width: 100%;
}

.rules-summary {
  list-style: none;
  padding: 12px 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
}

.rules-summary::-webkit-details-marker {
  display: none;
}

.rules-summary .arrow {
  font-size: 18px;
  transition: transform 0.3s ease;
  color: var(--text-secondary);
}

.rules-details[open] .rules-summary .arrow {
  transform: rotate(180deg);
}

.rules-content {
  padding: 0 16px 16px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.rules-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.rules-list li::before {
  content: "•";
  color: var(--accent-pink);
  font-weight: bold;
}

.rules-warning {
  color: var(--accent-error) !important;
  font-weight: 600;
}

/* Gdoop Premium Toggle Switch */
.gdoop-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.gdoop-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.gdoop-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  transition: 0.3s;
  border-radius: 34px;
}

.gdoop-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--bg-primary);
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gdoop-switch input:checked + .gdoop-slider {
  background-color: var(--accent-primary);
}

.gdoop-switch input:checked + .gdoop-slider:before {
  transform: translateX(16px);
  background-color: var(--bg-primary);
}

/* Chat Page Specific Layout Fixes */
.chat-page-body {
  background: var(--bg-primary);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  max-width: 1000px;
  overflow: hidden;
  overscroll-behavior: none;
}

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

.chat-stream {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-footer {
  flex-shrink: 0;
  background-color: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.attach-preview-bar {
  flex-shrink: 0;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
