/* Media Gallery/Lightbox Styles */

/* Facebook-Style Feed Layout */
.fb-feed {
  width: min(100%, 720px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view-more {
  display: flex;
  justify-content: center;
  margin-top: clamp(24px, 4vw, 40px);
}

.view-projects-link {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 9px 10px 9px 24px;
  border: 1px solid #1d4ed8;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(110deg, #1d4ed8, #2563eb);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
  font-size: 0.95rem;
  font-weight: 750;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.view-projects-link:hover {
  color: #fff;
  background: linear-gradient(110deg, #1e40af, #1d4ed8);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
  transform: translateY(-2px);
}

.view-projects-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 4px;
}

.view-projects-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #1d4ed8;
  background: #fff;
  font-size: 1.2rem;
  transition: transform 180ms ease;
}

.view-projects-link:hover .view-projects-arrow {
  transform: translateX(2px);
}

.fb-post {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
  overflow: hidden;
}

/* Post Header */
.fb-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.fb-post-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fb-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  overflow: hidden;
  background: #e4e6eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fb-post-info {
  display: flex;
  flex-direction: column;
}

.fb-post-author-name {
  font-size: 15px;
  font-weight: 600;
  color: #050505;
  margin: 0;
}

.fb-post-time {
  font-size: 13px;
  color: #65676b;
}

.fb-post-options {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: #65676b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.fb-post-options:hover {
  background: #e4e6eb;
}

.fb-post-options:disabled {
  cursor: default;
}

.fb-post-options:disabled:hover {
  background: transparent;
}

/* Post Content */
.fb-post-content {
  padding: 4px 16px 16px;
}

.fb-post-title {
  font-size: 16px;
  font-weight: 600;
  color: #050505;
  margin: 0 0 8px 0;
}

.fb-post-text {
  font-size: 15px;
  color: #050505;
  line-height: 1.4;
  margin: 0;
  white-space: pre-wrap;
}

/* Post Media */
.fb-post-media {
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.fb-media-single {
  display: grid;
  width: 100%;
  min-height: 0;
  place-items: center;
  cursor: pointer;
  background: #111827;
}

.fb-media-single img,
.fb-media-single video {
  display: block;
  width: 100%;
  height: clamp(220px, 52vw, 460px);
  object-fit: contain;
  background: #0f172a;
}

.fb-video-player {
  cursor: auto;
}

.fb-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 4 / 3;
  max-height: 440px;
  gap: 4px;
  overflow: hidden;
  background: #111827;
}

.fb-media-grid-2 {
  grid-template-rows: 1fr;
}

.fb-media-grid-3 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.fb-media-grid-3 .fb-media-item:first-child {
  grid-row: span 2;
}

.fb-media-item {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  cursor: pointer;
  background: #e4e6eb;
}

.fb-media-item img,
.fb-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.fb-media-item:hover img,
.fb-media-item:hover video {
  transform: scale(1.05);
}

.fb-video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0f172a;
}

.fb-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.fb-more-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

/* Post Stats */
.fb-post-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 14px;
  color: #65676b;
  border-bottom: 1px solid #e5e7eb;
}

.fb-likes-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.fb-like-number {
  font-weight: 600;
  font-size: 14px;
}

.fb-comments-count {
  font-size: 14px;
}

/* Post Actions */
.fb-post-actions {
  display: flex;
  padding: 8px 16px 12px;
  gap: 8px;
}

.fb-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #65676b;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s;
}

.fb-action-btn:hover {
  background: #f0f2f5;
}

.fb-action-btn:disabled {
  color: #65676b;
  cursor: default;
  opacity: 1;
}

.fb-action-btn:disabled:hover {
  background: transparent;
}

/* Post Media Grid Layouts (Legacy - kept for backward compatibility) */
.post-media {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #f3f4f6;
}

.media-single {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  cursor: pointer;
  overflow: hidden;
}

.media-single img,
.media-single video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.media-single:hover img,
.media-single:hover video {
  transform: scale(1.05);
}

.play-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  pointer-events: none;
  transition: all 0.3s;
}

.media-single:hover .play-indicator {
  background: rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Media Grid for Multiple Images */
.media-grid {
  display: grid;
  gap: 4px;
  aspect-ratio: 16/9;
}

.media-grid-2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.media-grid-3 {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr;
}

.media-grid-3 .media-item:first-child {
  grid-row: span 2;
}

.media-grid-4,
.media-grid-5,
.media-grid-6 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.media-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #e5e7eb;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.media-item:hover img,
.media-item:hover video {
  transform: scale(1.05);
}

.media-item .play-indicator {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.more-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

/* Post Actions */
.post-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  font-size: 14px;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.action-btn.liked {
  color: #ef4444;
}

.action-btn.liked svg {
  fill: #ef4444;
}

.like-count,
.comment-count {
  font-weight: 600;
  font-size: 13px;
}

/* Lightbox/Gallery Modal */
.gallery-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-lightbox.active {
  display: flex;
  opacity: 1;
}

.gallery-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-media {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

.gallery-media.video {
  max-width: 90vw;
  max-height: 80vh;
}

.gallery-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.gallery-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.gallery-nav.prev {
  left: -70px;
}

.gallery-nav.next {
  right: -70px;
}

.gallery-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gallery-counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.gallery-thumbnails {
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: 80vw;
  overflow-x: auto;
  padding: 8px;
}

.gallery-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

.gallery-thumb img,
.gallery-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb.active {
  border-color: #2563eb;
}

.gallery-thumb:hover {
  border-color: #3b82f6;
}

/* Responsive Design */
@media (max-width: 768px) {
  .fb-feed {
    gap: 16px;
  }

  .fb-post {
    border-radius: 10px;
  }

  .fb-post-header {
    padding: 14px 16px;
  }

  .fb-post-content {
    padding: 4px 16px 14px;
  }

  .fb-media-grid {
    max-height: 360px;
  }

  .fb-media-single img,
  .fb-media-single video {
    height: clamp(220px, 72vw, 380px);
  }

  .media-grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .media-grid-3 .media-item:first-child {
    grid-row: span 1;
  }

  .gallery-lightbox-content {
    max-width: 95vw;
    max-height: 85vh;
  }

  .gallery-close {
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
  }

  .gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .gallery-nav.prev {
    left: 10px;
  }

  .gallery-nav.next {
    right: 10px;
  }

  .gallery-counter {
    bottom: 10px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  }

  .gallery-thumbnails {
    display: none;
  }
}

@media (max-width: 480px) {
  .fb-post-actions {
    padding: 6px 8px 10px;
    gap: 2px;
  }

  .fb-action-btn {
    gap: 6px;
    padding: 8px 4px;
    font-size: 14px;
  }

  .fb-post-stats {
    padding: 9px 14px;
  }
}
