/**
 * Social Feed V2 - Alternative card design
 * Social icon on image, vertical layout
 */

/* Wrapper fixes for V2 to prevent footer overlap */
.social-feed-wrapper.social-feed-v2 {
  position: relative;
  z-index: 100;
  background-color: #f0f0f0;
  padding-bottom: 3rem;
  padding-top: 10rem;
  min-height: 500px;
  margin-bottom: 50px;
  overflow: visible;
}

.social-feed-v2 .container {
  position: relative;
  z-index: 10;
}

.social-feed-v2 .social-feed-content {
  min-height: 600px; /* Increased to prevent footer jump */
  overflow: visible;
  position: relative;
  padding-bottom: 40px;
  /* Contain floated elements */
  display: flow-root;
}

/* Fix tab container positioning and styling */
.social-feed-v2 .social-feed-tabs {
  position: relative;
  z-index: 20;
  margin-bottom: 30px;
  display: flex;
  gap: 15px;
  border-bottom: 2px solid var(--bs-gray-200);
  padding-bottom: 0;
  flex-wrap: wrap; /* Allow wrapping on mobile */
}

.social-feed-v2 .social-feed-tab {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--bs-gray-600);
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  margin-bottom: -2px;
  white-space: nowrap; /* Prevent text wrapping */
  flex-shrink: 0; /* Prevent tabs from shrinking */
}

.social-feed-v2 .social-feed-tab:hover {
  color: var(--bs-gray-800);
}

.social-feed-v2 .social-feed-tab.active {
  color: #fdbb30;
  border-bottom-color: #fdbb30;
}

/* Social feed container - masonry will handle layout */
.social-feed-wrapper.social-feed-v2 .social-feed-container {
  margin: 0 auto;
  max-width: 100%;
  padding: 0;
  position: relative;
  /* Clear floats to contain masonry items */
  overflow: hidden;
  min-height: 400px; /* Reserve minimum space */
}

/* Clearfix for social-feed-container */
.social-feed-wrapper.social-feed-v2 .social-feed-container::after {
  content: "";
  display: table;
  clear: both;
}

/* Remove item-list styles since v2 doesn't use that structure */

/* Grid sizer is handled by the card width rules above */
.social-feed-wrapper.social-feed-v2 .grid-sizer {
  visibility: hidden !important;
  height: 0 !important;
}

/* Clickable card link wrapper */
.social-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: auto; /* Don't extend beyond content */
  position: relative;
  z-index: 1;
  /*  overflow: hidden;Contain click area */
}

.social-card-link:hover {
  text-decoration: none;
  color: inherit;
}

/* Base card styles V2 */
.social-card-v2 {
  background-color: var(--bs-white);
  border-radius: 0; /* Sharp corners */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 23px; /* Match gutter for masonry */
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  /* Width is set by masonry responsive rules */
  border: 1px solid var(--bs-gray-200);
  position: relative;
  z-index: 1;
  /* Remove fixed height for masonry effect */
  display: block !important; /* Force display to prevent hiding */
  visibility: visible !important; /* Ensure visibility */
  cursor: pointer;
  padding: 10px; /* Reduced padding for smaller cards */
  break-inside: avoid; /* Prevent breaking inside cards for column layout */
  box-sizing: border-box;
  float: left; /* Important for masonry */
}

.social-card-v2:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--bs-gray-300);
}

/* Image wrapper with social icon overlay */
.card-image-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: #f8f9fa; /* Light gray background */
  border-radius: 0; /* Sharp corners */
  max-height: 500px; /* Limit wrapper height to prevent breaking layout */
  /* Remove fixed padding-top to allow natural image dimensions */
}

.card-image-wrapper img {
  width: 100%;
  height: auto; /* Natural height based on aspect ratio */
  display: block; /* Remove bottom gap */
  object-fit: cover; /* Changed to cover to fit within max-height */
  max-width: 100%;
  max-height: 400px; /* Prevent extremely tall images */
}

/* Stack multiple images vertically within the wrapper */
.card-image-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px; /* Small gap between multiple images */
}

/* Ensure each image fits properly when there are multiple */
.card-image-wrapper img {
  flex-shrink: 0;
  object-fit: cover;
  max-height: 200px; /* Smaller max-height when multiple images */
}

/* Social icon overlay */
.social-icon-overlay {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 32px;  /* Further reduced */
  height: 32px; /* Further reduced */
  background-color: rgba(255, 255, 255, 0.95);
  /* border-radius: 4px; */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  padding: 6px; /* Further reduced */
}

/* Platform-specific colors */
.facebook-card {
  display: block !important; /* Ensure Facebook cards are visible */
  visibility: visible !important;
}

.facebook-card .social-icon-overlay {
  background-color: #1877F2;
}

.twitter-card .social-icon-overlay {
  background-color: #000000; /* Black for X logo */
}

.instagram-card .social-icon-overlay {
  background: linear-gradient(45deg, #F77737 0%, #E1306C 50%, #C13584 100%);
}

.social-card-v2:hover .social-icon-overlay {
  transform: scale(1.05);
  opacity: 0.9;
}

.social-icon-overlay img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
  position: relative;
  filter: brightness(0) invert(1); /* Make logos white */
}

/* Card content */
.card-content {
  padding: 16px 0 0 0; /* Only top padding since card has side padding */
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Date styling */
.social-card-v2 .post-date {
  color: var(--bs-gray-600);
  font-size: 1.1rem;
  margin-bottom: 12px;
  font-weight: 500;
}

/* Post text */
.social-card-v2 .post-text {
  color: var(--bs-gray-800);
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 16px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}

.social-card-v2 .post-text h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--bs-gray-900);
}

.social-card-v2 .post-text p {
  margin-bottom: 0;
}

/* Ensure text doesn't get underlined on hover */
.social-card-link:hover .post-text,
.social-card-link:hover .post-date {
  text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  /* Responsive tabs for mobile */
  .social-feed-v2 .social-feed-tabs {
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto; /* Allow horizontal scroll if needed */
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    flex-wrap: nowrap; /* Prevent wrapping, allow scroll instead */
    padding-bottom: 2px; /* Space for scrollbar */
  }
  
  .social-feed-v2 .social-feed-tab {
    padding: 8px 12px;
    font-size: 0.9rem;
    flex: 0 0 auto; /* Don't grow or shrink */
  }
  
  /* Hide scrollbar but keep functionality */
  .social-feed-v2 .social-feed-tabs::-webkit-scrollbar {
    height: 3px;
  }
  
  .social-feed-v2 .social-feed-tabs::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .social-feed-v2 .social-feed-tabs::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 3px;
  }
  
  .social-card-v2 .post-text {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  
  .social-card-v2 {
    padding: 8px; /* Less padding on mobile */
  }
  
  /* Even smaller logos on mobile */
  .social-icon-overlay {
    width: 28px;
    height: 28px;
    padding: 5px;
  }
}

/* Remove duplicate grid styles - using item-list styles instead */

/* Loading animation for V2 */
.social-card-v2 {
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
  position: relative;
  z-index: 2;
}

.social-card-v2:nth-child(1) { animation-delay: 0.1s; }
.social-card-v2:nth-child(2) { animation-delay: 0.15s; }
.social-card-v2:nth-child(3) { animation-delay: 0.2s; }
.social-card-v2:nth-child(4) { animation-delay: 0.25s; }
.social-card-v2:nth-child(5) { animation-delay: 0.3s; }
.social-card-v2:nth-child(6) { animation-delay: 0.35s; }

/* Video indicator for Twitter/Instagram */
.card-image-wrapper .video-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-indicator::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 20px solid white;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 4px;
}

/* Hashtag and mention styling */
.social-card-v2 .post-text a {
  color: #1DA1F2;
  text-decoration: none;
  font-weight: 500;
}

.social-card-v2 .post-text a:hover {
  text-decoration: underline;
}

/* Social feed wrapper adjustments for V2 */
.social-feed-wrapper.social-feed-v2 {
  position: relative;
  z-index: 100;
  padding-bottom: 40px;
  min-height: 400px;
  background-color: transparent;
}

/* Ensure content area has proper z-index */
.social-feed-wrapper.social-feed-v2 .social-feed-content {
  position: relative;
  z-index: 10;
}

/* Tab styling for V2 */
.social-feed-wrapper.social-feed-v2 .social-feed-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 0;
}

.social-feed-wrapper.social-feed-v2 .social-feed-tab {
  padding: 15px 25px;
  cursor: pointer;
  font-weight: 600;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

.social-feed-wrapper.social-feed-v2 .social-feed-tab:hover {
  color: #333;
}

.social-feed-wrapper.social-feed-v2 .social-feed-tab.active {
  color: #fdbb30;
  border-bottom-color: #fdbb30;
}

/* Hide non-active content properly */
.social-feed-wrapper.social-feed-v2 .social-feed-content {
  display: none;
}

.social-feed-wrapper.social-feed-v2 .social-feed-content.active {
  display: block;
}

/* Card width for masonry - v2 uses .social-card-v2 */
.social-feed-wrapper.social-feed-v2 .grid-sizer,
.social-feed-wrapper.social-feed-v2 .social-card-v2 {
  width: calc(25% - 17.25px); /* 4 columns default - smaller cards */
  position: relative; /* Ensure proper positioning context */
}

/* Medium screens - 5 columns for even smaller cards */
@media (min-width: 992px) and (max-width: 1199px) {
  .social-feed-wrapper.social-feed-v2 .grid-sizer,
  .social-feed-wrapper.social-feed-v2 .social-card-v2 {
    width: calc(20% - 18.4px); /* 5 columns */
  }
}

/* Large screens - 5 columns for smaller cards */
@media (min-width: 1200px) {
  .social-feed-wrapper.social-feed-v2 .grid-sizer,
  .social-feed-wrapper.social-feed-v2 .social-card-v2 {
    width: calc(20% - 18.4px); /* 5 columns */
  }
}

/* Tablet - 3 columns */
@media (max-width: 991px) {
  .social-feed-wrapper.social-feed-v2 .grid-sizer,
  .social-feed-wrapper.social-feed-v2 .social-card-v2 {
    width: calc(33.333% - 15.33px); /* 3 columns */
  }
}

/* Mobile - 1 column */
@media (max-width: 576px) {
  .social-feed-wrapper.social-feed-v2 .grid-sizer,
  .social-feed-wrapper.social-feed-v2 .social-card-v2 {
    width: 100%; /* 1 column on mobile */
  }
}

/* Very small screens - additional tab adjustments */
@media (max-width: 480px) {
  .social-feed-v2 .social-feed-tab {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  
  .social-feed-v2 .social-feed-tabs {
    gap: 5px;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}