/* Avatar styles */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 8%;
  object-fit: cover;
}

.avatar-sm {
  width: 30px;
  height: 30px;
}

.avatar-lg {
  width: 150px;
  height: 150px;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #6c757d;
  color: white;
  font-weight: bold;
  border-radius: 8%;
}

/* Post styles */
.post-image {
  max-height: 400px;
  object-fit: contain;
}

.post-card {
  transition: transform 0.2s;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Comment styles */
.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 8%;
  align-self: flex-start;
}

/* User profile card */
.user-card {
  transition: transform 0.2s;
}

.user-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Vote buttons */
.vote-btn.active {
  background-color: #0d6efd;
  color: white;
}

/* Image upload preview */
.image-preview {
  max-height: 200px;
  object-fit: contain;
  margin-top: 10px;
}

/* Custom utilities */
.cursor-pointer {
  cursor: pointer;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Add these styles at the end of the file */

.clickable-card {
  cursor: pointer;
  position: relative;
}

.clickable-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.no-card-click {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

/* Footer always at bottom styles */
html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Text shadow for better visibility on image backgrounds */
.text-shadow-1 {
  text-shadow: 0 0.04rem 0.11rem rgba(0, 0, 0, 0.3);
}

/* Ensure clickable cards maintain pointer on hover */
.card-cover.clickable-card {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1; /* Default z-index */
}

.card-cover.clickable-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  z-index: 2; /* Higher z-index on hover to prevent overlap issues */
}

/* Ensure avatar placeholder works within dark cards */
.card-cover .rounded-circle.border {
  object-fit: cover;
}

/* Square aspect ratio container */
.square-aspect-ratio {
  position: static;
  width: 100%;
  padding-bottom: 0;
  height: auto;
}

.square-aspect-ratio .card {
  position: static;
  height: auto;
}

/* Make image posts taller and text-only posts shorter */
.card-cover {
  transition: transform 0.3s ease;
}

.card-cover:hover {
  transform: translateY(-6px);
}

/* Square aspect ratio container for posts with images */
.square-post-container {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* Creates 1:1 aspect ratio */
  height: 0;
  overflow: visible; /* Changed from hidden to visible to allow shadow to expand */
  margin-bottom: 15px; /* Add margin to prevent overlap with content below */
}

/* Position the card absolutely inside the container to maintain aspect ratio */
.square-post-container .card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Ensure content stays at the bottom */
.square-post-container .card .d-flex.flex-column {
  justify-content: space-between;
  height: 100%;
  position: relative;
  z-index: 2; /* Add this to ensure content is above the gradient */
}

/* Add a gradient overlay for better text readability on image posts */
.square-post-container .card:before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
  z-index: 1; /* Add this to ensure the gradient is beneath the content */
}

.scrollarea::-webkit-scrollbar {
  width: 6px;
}

.scrollarea::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.scrollarea::-webkit-scrollbar-track {
  background-color: #f8f9fa;
}

/* Fixed comment section styles */
.comment-container {
  display: block;
  z-index: 100;
}

@media (max-width: 991.98px) {
  .comment-container {
    position: static !important;
    width: auto !important;
    height: auto !important;
  }
}

/* Toast notification styles */
.toast-container {
  min-width: 200px;
  max-width: 350px;
}

.toast {
  opacity: 1 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Ensure toasts stand out on dark backgrounds */
.toast .toast-header {
  background-color: rgba(255, 255, 255, 0.85);
}

.toast .btn-close-white {
  filter: invert(1) grayscale(100%) brightness(200%);
}
/* Masonry grid styling */
.grid-item {
  margin-bottom: 15px;
}

/* Remove the square aspect ratio and replace with flexible cards */
.square-aspect-ratio {
  position: static;
  width: 100%;
  padding-bottom: 0;
  height: auto;
}

.square-aspect-ratio .card {
  position: static;
  height: auto;
}

/* Make image posts taller and text-only posts shorter */
.card-cover {
  transition: transform 0.3s ease;
}

.card-cover:hover {
  transform: translateY(-6px);
}

/* Square aspect ratio container for posts with images - Fix overflow and hover issue */
.square-post-container {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* Creates 1:1 aspect ratio */
  height: 0;
  overflow: visible; /* Changed from hidden to visible to allow shadow to expand */
  margin-bottom: 15px; /* Add margin to prevent overlap with content below */
}

/* Consolidate hover effects and prevent transform conflicts */
.card-cover.clickable-card {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1; /* Default z-index */
}

.card-cover.clickable-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  z-index: 2; /* Higher z-index on hover to prevent overlap issues */
}

/* Remove duplicate hover transforms */
.clickable-card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Override existing transform properties to avoid conflicts */
.card-cover:hover {
  transform: translateY(-6px);
}

/* Floating navigation styling */
.nav-dropdown {
  min-width: 250px;
  transition: all 0.3s ease;
}

#navToggle {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.nav-dropdown a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

@keyframes warning-danger-pulse {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

.badge-static-muted {
  background-color: var(--bs-border-color);
  font-weight: bold;
  font-size: 0.65rem;
  margin-right: -0.5rem;
  top: -0.1rem;
  position: relative;
}

.badge-pulse {
  background-color: var(--bs-danger);
  font-weight: bold;
  font-size: 0.9rem;
  animation: warning-danger-pulse 0.55s infinite;
}

.trophy-first {
  color: #ffd700;
  text-shadow: 0 2px 8px #ffd900;
}

.trophy-second {
  color: #aeaeae;
  text-shadow: 0 2px 5px #aeaeaebc;
}

.trophy-third {
  color: #986028;
  text-shadow: 0 2px 2px #98602882;
}

.trophy-other {
  color: #545454;
}
.mention {
  font-weight: bold;
  color: #ffffff; /* Bootstrap primary color */
}
.mention:hover {
  text-decoration: underline !important;
}

/* Emoji reaction styles */
.reaction-popup {
  position: absolute;
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  z-index: 1050;
  max-width: 276px;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.reaction-emoji {
  width: 24px;
  height: 24px;
  margin: 4px;
  cursor: pointer;
  transition: transform 0.1s;
}

.reaction-emoji:hover {
  transform: scale(1.2);
}

.reactions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reaction-item {
  display: flex;
  align-items: center;
  background-color: rgba(var(--bs-secondary-rgb), 0.1);
  border: 1px solid var(--bs-border-color);
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.reaction-emoji-display {
  width: 1.3em;
  height: 1.3em;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  transform-origin: left center;
}

.reaction-count {
  font-size: 12px;
  margin-left: 8px;
  font-weight: bold;
  color: var(--bs-body-color);
}

/* Image preview modal styles */
.image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.image-preview-content {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.image-preview-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

.image-preview-close:hover {
  opacity: 0.7;
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  font-size: 24px;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.3s ease;
  z-index: 10000;
}

.image-preview-nav:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

.image-preview-nav.prev {
  left: 30px;
}

.image-preview-nav.next {
  right: 30px;
}

.image-preview-counter {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10000;
}

/* Make images clickable */
.clickable-image {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.clickable-image:hover {
  transform: scale(1.02);
}

/* System comments */
.system-comment {
  background: none;
  border-bottom: 1px solid var(--bs-border-color);
  min-height: 38px;
  height: auto;
  padding-top: 0.02rem;
  padding-bottom: 0.02rem;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  color: rgba(var(--bs-body-color-rgb), 0.25);
}

/* Make dark theme backgrounds darker */
[data-bs-theme="dark"] {
  --bs-body-bg: #18191a !important;
  --bs-secondary-bg: #232526 !important;
  --bs-card-bg: #222325 !important;
  --bs-modal-bg: #18191a !important;
  --bs-border-color: #343536 !important;
  --bs-body-color: #e4e6eb !important;
}

/* Make footer and main backgrounds darker in dark mode */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] main,
[data-bs-theme="dark"] footer {
  background-color: #18191a !important;
}

/* Make card backgrounds darker in dark mode */
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .user-card,
[data-bs-theme="dark"] .card-cover {
  background-color: #222325 !important;
}

/* Make modal and overlays darker in dark mode */
[data-bs-theme="dark"] .image-preview-modal {
  background-color: rgba(10, 10, 10, 0.97) !important;
  backdrop-filter: blur(12px);
}

/* Make toast backgrounds darker in dark mode */
[data-bs-theme="dark"] .toast,
[data-bs-theme="dark"] .toast .toast-header {
  background-color: #232526 !important;
  color: #e4e6eb !important;
}

/* Make nav dropdown darker in dark mode */
[data-bs-theme="dark"] .nav-dropdown {
  background-color: #232526 !important;
}

/* Make reaction popup darker in dark mode */
[data-bs-theme="dark"] .reaction-popup {
  background-color: #232526 !important;
  border-color: #343536 !important;
}

/* Make gradient overlays on image posts darker in dark mode */
[data-bs-theme="dark"] .square-post-container .card:before {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
}

.comments-title {
  font-weight: bold;
  font-size: 0.98rem;
  color: #aeaeae;
}

.comments-background {
  background-color: #222325;
}

.comment-normal-bg {
  background-color: #00000036;
}

.comment-alt-bg {
  background-color: #00000052;
}
