/* ==================== HOME FEED & STORIES STYLES ==================== */

/* Feed Layout splits: Main Feed + Right Panel */
.feed-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  width: 100%;
}

.feed-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0; /* Prevents flex overflow */
}

/* Stories row */
.stories-container {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-md);
  padding: 16px;
  width: 100%;
  overflow-x: hidden;
}

.stories-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbars standard */
}

.stories-scroll::-webkit-scrollbar {
  display: none; /* Hide scrollbars Chrome/Safari */
}

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  width: 66px;
  flex-shrink: 0;
  text-align: center;
}

.story-avatar-wrap {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: var(--border-radius-pill);
  padding: 2px;
  background: var(--story-border-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-item.read .story-avatar-wrap {
  background: var(--story-border-gray);
}

.story-avatar-wrap img {
  width: 54px;
  height: 54px;
  border-radius: var(--border-radius-pill);
  border: 2px solid var(--bg-primary);
  object-fit: cover;
}

/* badge for "Add story" (+) */
.story-item.current-user .story-avatar-wrap {
  background: transparent;
}

.story-item.current-user img {
  border: 1px solid var(--border-primary);
  width: 56px;
  height: 56px;
}

.story-add-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background-color: var(--accent-blue);
  color: #ffffff;
  border-radius: var(--border-radius-pill);
  width: 20px;
  height: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.story-username {
  font-size: 0.72rem;
  color: var(--text-secondary);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== POST CARDS FEED ==================== */
.posts-list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-md);
  width: 100%;
  display: flex;
  flex-direction: column;
}

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

.post-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-user-info img {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-pill);
  border: 1px solid var(--border-secondary);
}

.post-user-details {
  display: flex;
  flex-direction: column;
}

.post-user-details .username {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.post-user-details .location {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.post-options-btn {
  color: var(--text-primary);
  font-size: 1.2rem;
  padding: 4px;
}

/* Post Content / Image Container with double tap popup */
.post-media-container {
  position: relative;
  width: 100%;
  background-color: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  aspect-ratio: 1 / 1; /* Force square ratio like standard IG feed */
}

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

/* Double tap heart pop-up */
.double-tap-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  color: #ffffff;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.double-tap-heart.animate {
  animation: heart-pop 0.8s ease-in-out forwards;
}

@keyframes heart-pop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  15% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.9;
  }
  30% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

/* Post Actions Panel */
.post-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
}

.post-actions-left {
  display: flex;
  gap: 16px;
}

.post-actions-bar button {
  color: var(--text-primary);
}

.post-actions-bar button i {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-fast);
}

.post-actions-bar button:hover i {
  transform: scale(1.1);
}

/* Liked state styling */
.action-like-btn.liked {
  color: var(--accent-red) !important;
}

.action-like-btn.liked i {
  fill: var(--accent-red);
}

/* Post info text layout */
.post-info-block {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.likes-count {
  font-size: 0.88rem;
  font-weight: 700;
}

.post-caption {
  font-size: 0.88rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.post-caption .username {
  font-weight: 700;
  margin-right: 6px;
  color: var(--text-primary);
}

.view-comments-link {
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: 4px;
}

/* Recent Comments stack */
.post-comments-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.preview-comment-item {
  font-size: 0.85rem;
}

.preview-comment-item .comment-username {
  font-weight: 700;
  margin-right: 6px;
}

.post-time-stamp {
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Feed Comments Adding Row */
.post-add-comment-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-secondary);
  gap: 12px;
}

.post-add-comment-row input {
  flex-grow: 1;
  border: none;
  background-color: transparent;
  padding: 6px 0;
  font-size: 0.88rem;
}

.post-add-comment-row input:focus {
  border: none;
  background-color: transparent;
}

.comment-submit-btn {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.88rem;
}

.comment-submit-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ==================== DESKTOP SIDEBAR SUGGESTIONS ==================== */
.feed-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.sidebar-user-card img {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-pill);
  border: 1px solid var(--border-secondary);
}

.sidebar-user-card .user-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.sidebar-user-card .user-info .username {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-user-card .user-info .fullname {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.sidebar-user-card .switch-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.suggestions-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 12px;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.suggestion-item img {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-pill);
}

.suggestion-item .user-meta {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.suggestion-item .user-meta .username {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.suggestion-item .user-meta .reason {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.suggestion-item .follow-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.sidebar-credits {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  margin-top: 24px;
}

/* ==================== SKELETONS FOR POSTS ==================== */
.post-skeleton {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.ps-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ps-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-pill);
}

.ps-title {
  width: 120px;
  height: 14px;
  border-radius: 4px;
}

.ps-image {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: var(--border-radius-md);
}

/* Mobile responsive adjustments */
@media (max-width: 991px) {
  .feed-layout {
    grid-template-columns: 1fr; /* Sidebar collapses on tablet/mobile */
  }
  .feed-sidebar {
    display: none;
  }
}
