/* === FEED PAGE === */
/* Allow scroll for pages that need it, but NOT feed */
.main-content:has(#page-communities.active),
.main-content:has(#page-profile.active),
.main-content:has(#page-admin.active) {
  overflow-y: auto !important;
}
#page-feed.active {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.feed-layout {
  display: flex;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.feed-center { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.feed-right { width: 230px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }

/* Community Icons Grid - 3x2 grid like in mockup */
.feed-communities-row {
  margin-bottom: 4px;
  flex: 0 0 63%;
  min-height: 0;
  overflow: hidden;
}
.feed-community-icons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  height: 100%;
}
.feed-community-icon {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center 85%;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.3s ease;
  display: block;
}
.feed-community-icon:hover {
  transform: scale(1.04);
  filter: brightness(1.15);
}

/* Posts Section */
.feed-posts-section {
  margin-bottom: 4px;
  flex: 0 0 27%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.feed-posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.feed-posts-title {
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  opacity: 0.8;
}
.feed-posts-nav {
  display: flex;
  gap: 6px;
}
.carousel-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.carousel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.15);
}
.carousel-btn:active {
  transform: scale(0.92);
}
[data-theme="light"] .carousel-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Posts Carousel */
.feed-posts-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.post-card {
  display: none;
  border-radius: 14px;
  clip-path: inset(0 round 14px);
  will-change: transform, opacity;
  border: none;
  background: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}
.post-card.active {
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.post-card.animating-out {
  display: flex;
  flex-direction: column;
  z-index: 1;
  pointer-events: none;
}

/* Animated elements inside banner */
.post-banner-content .post-header,
.post-banner-content .post-content,
.post-banner-content .post-actions {
  will-change: transform, opacity;
}

.post-banner {
  position: relative;
  width: 100%;
  min-height: 0;
  flex: 1;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: stretch;
  border-radius: 14px;
}

.post-banner-content {
  width: 100%;
  height: 100%;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  overflow-y: auto;
  background: linear-gradient(to right, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.38) 50%, rgba(0,0,0,0.05) 100%);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.post-author-info { flex: 1; }
.post-author-name {
  font-size: 19px;
  font-weight: 600;
  color: #fff;
}
.post-author-role {
  font-size: 14px;
  font-family: var(--font-small);
  color: rgba(255,255,255,0.6);
}

.post-content {
  font-size: 17px;
  font-family: var(--font-small);
  color: rgba(255,255,255,0.9);
  line-height: 1.45;
  max-width: 62%;
}

.post-detail-btn {
  display: none;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.15);
  max-width: 55%;
}
.post-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-family: var(--font-small);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
}
.post-action:hover { color: #fff; }
.post-action img { width: 22px; height: 22px; filter: brightness(0) invert(1); }
.post-action.liked { color: var(--like-color); }
.post-action.liked img { filter: brightness(0) saturate(100%) invert(38%) sepia(79%) saturate(2700%) hue-rotate(334deg) brightness(100%) contrast(101%); }

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.like-pulse { animation: pulse 0.3s ease; }

/* Publish Bar */
.publish-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 24px;
  margin-top: auto;
  transition: var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px) !important;
  border-radius: 50px !important;
  width: 100%;
}
.publish-icon { display: none; }
.publish-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
}
.publish-tab {
  padding: 8px 22px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  font-family: var(--font-small);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
}
.publish-tab:hover {
  background: var(--btn-bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.6);
}
.publish-tab.active {
  background: var(--nav-tab-active-bg);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.6);
}
.publish-add-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.publish-add-btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-border);
}

/* Light theme: keep publish bar text white */
[data-theme="light"] .publish-bar {
  color: #fff;
}
[data-theme="light"] .publish-tab {
  color: rgba(255, 255, 255, 0.8);
}
[data-theme="light"] .publish-tab:hover,
[data-theme="light"] .publish-tab.active {
  color: #fff;
}
[data-theme="light"] .publish-add-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}
[data-theme="light"] .feed-posts-title {
  color: #fff !important;
}
/* Light theme: keep post actions (like/comment) white on dark banner overlay */
[data-theme="light"] .post-action {
  color: rgba(255,255,255,0.7) !important;
}
[data-theme="light"] .post-action:hover {
  color: #fff !important;
}
[data-theme="light"] .post-action img {
  filter: brightness(0) invert(1) !important;
}
[data-theme="light"] .post-action.liked {
  color: var(--like-color) !important;
}
[data-theme="light"] .post-action.liked img {
  filter: brightness(0) saturate(100%) invert(38%) sepia(79%) saturate(2700%) hue-rotate(334deg) brightness(100%) contrast(101%) !important;
}
[data-theme="light"] .post-content {
  color: rgba(255,255,255,0.9) !important;
}
[data-theme="light"] .post-author-name {
  color: #fff !important;
}
[data-theme="light"] .post-author-role {
  color: rgba(255,255,255,0.6) !important;
}
[data-theme="light"] .post-actions {
  border-top-color: rgba(255,255,255,0.15) !important;
}

/* Right Sidebar */
.right-events, .right-announcements {
  padding: 12px;
}
.right-events h3, .right-announcements h3 {
  font-size: 15px;
  margin-bottom: 8px;
}
.events-list-mini, .announcements-list-mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.event-mini:hover { background: var(--bg-glass-hover); }
.event-mini-icon { width: 34px; height: 34px; }
.event-mini-info { flex: 1; }
.event-mini-title {
  font-size: 13px;
  font-family: var(--font-small);
  line-height: 1.3;
}
.event-mini-date {
  font-size: 11px;
  font-family: var(--font-small);
  color: var(--text-muted);
}

.announcement-mini {
  padding: 7px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.announcement-mini:hover { background: var(--bg-glass-hover); }
.announcement-mini-title {
  font-size: 13px;
  font-family: var(--font-small);
  margin-bottom: 3px;
}
.announcement-mini-text {
  font-size: 11px;
  font-family: var(--font-small);
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Friends Online */
.right-friends {
  padding: 12px;
}
.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.friends-header h3 {
  font-size: 15px;
  margin: 0;
}
.friends-arrow {
  font-size: 22px;
  color: var(--online-color);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.friends-arrow:hover {
  background: var(--bg-glass-hover);
  transform: translateX(2px);
}
.friends-avatars {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 4px;
  padding-bottom: 4px;
}
.friends-avatars::-webkit-scrollbar {
  display: none;
}
.friend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  cursor: pointer;
}
.friend-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
}
.friend-avatar-wrap img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.friend-item:hover .friend-avatar-wrap img {
  transform: scale(1.08);
}
.friend-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  background: var(--online-color);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}
.friend-name {
  font-size: 11px;
  font-family: var(--font-small);
  color: var(--text-secondary);
  max-width: 44px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Friends Dropdown (small, near section) === */
#friends-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 150;
  background: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: none;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 0;
}
.friends-modal {
  position: fixed;
  bottom: 60px;
  right: 18px;
  width: 360px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: rgba(20, 20, 35, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.friends-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.friends-modal .modal-header h3 { font-size: 18px; margin: 0; }
.friends-modal .modal-close {
  font-size: 24px;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}
.friends-modal .modal-close:hover { color: #fff; }

.friends-modal-search { margin-bottom: 10px; }
.friends-modal-search input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 12px;
  font-family: var(--font-small);
}
.friends-modal-search input::placeholder { color: rgba(255, 255, 255, 0.35); }

.friends-modal-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.friends-modal-tab {
  padding: 7px 16px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-family: var(--font-small);
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: var(--transition);
}
.friends-modal-tab.active,
.friends-modal-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.friends-modal-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.friends-modal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}
.friends-modal-item:hover { background: rgba(255, 255, 255, 0.06); }

.friends-modal-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}
.friends-modal-avatar-wrap img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}
.friends-modal-avatar-wrap .online-dot,
.friends-modal-avatar-wrap .offline-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid rgba(20, 20, 35, 0.95);
}
.friends-modal-avatar-wrap .online-dot { background: var(--online-color); }
.friends-modal-avatar-wrap .offline-dot { background: var(--text-muted); }

.friends-modal-info { flex: 1; min-width: 0; }
.friends-modal-name { font-size: 15px; color: #fff; margin-bottom: 2px; }
.friends-modal-status { font-size: 12px; font-family: var(--font-small); color: rgba(255,255,255,0.45); }
.friends-modal-status.online { color: var(--online-color); }

.friends-modal-action {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-family: var(--font-small);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.friends-modal-action.add-btn { background: var(--accent); color: #fff; }
.friends-modal-action.add-btn:hover { opacity: 0.85; }
.friends-modal-action.remove-btn {
  background: rgba(255, 71, 87, 0.15);
  color: #ff4757;
  border: 1px solid rgba(255, 71, 87, 0.2);
}
.friends-modal-action.remove-btn:hover { background: rgba(255, 71, 87, 0.25); }

/* === Friend Avatar Popup === */
.friend-popup {
  position: fixed;
  z-index: 200;
  min-width: 180px;
  padding: 8px;
  background: rgba(20, 20, 35, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.friend-popup-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-small);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.friend-popup-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.friend-popup-action img { width: 16px; height: 16px; opacity: 0.7; }

/* Light theme overrides — Friends dropdown */
[data-theme="light"] .friends-modal {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .friends-modal .modal-header h3 { color: var(--text-primary); }
[data-theme="light"] .friends-modal .modal-close { color: rgba(0,0,0,0.4); }
[data-theme="light"] .friends-modal .modal-close:hover { color: var(--text-primary); }
[data-theme="light"] .friends-modal-search input {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}
[data-theme="light"] .friends-modal-search input::placeholder { color: rgba(0,0,0,0.35); }
[data-theme="light"] .friends-modal-tab {
  color: rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .friends-modal-tab.active,
[data-theme="light"] .friends-modal-tab:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.07);
  border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .friends-modal-name { color: var(--text-primary); }
[data-theme="light"] .friends-modal-status { color: rgba(0,0,0,0.4); }
[data-theme="light"] .friends-modal-item:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .friends-modal-avatar-wrap .online-dot,
[data-theme="light"] .friends-modal-avatar-wrap .offline-dot {
  border-color: rgba(255,255,255,0.97);
}
/* Light theme — Friend popup */
[data-theme="light"] .friend-popup {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .friend-popup-action { color: var(--text-primary); }
[data-theme="light"] .friend-popup-action:hover { background: rgba(0, 0, 0, 0.06); }

/* === Profile View Actions === */
.profile-view-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.profile-view-btn {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-small);
  cursor: pointer;
  transition: var(--transition);
}
.profile-view-btn.message-btn { background: var(--accent); color: #fff; }
.profile-view-btn.message-btn:hover { opacity: 0.85; }
.profile-view-btn.friend-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.profile-view-btn.friend-btn:hover { background: rgba(255, 255, 255, 0.12); }
.profile-view-btn.friend-btn.is-friend {
  background: rgba(255, 71, 87, 0.12);
  color: #ff4757;
  border-color: rgba(255, 71, 87, 0.2);
}
.profile-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-small);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
}
.profile-back-btn:hover { color: var(--text-primary); }

/* Responsive */
@media (max-width: 1024px) {
  .feed-right { display: none; }
}
@media (max-width: 768px) {
  .feed-layout { flex-direction: column; }
}
