/* Facebook-style polish — feed, profile, cards */

/* ── Feed center column (Facebook ~680px) ── */
.layout-grid main {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.feed-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 0;
}

.feed-stack > .card {
  margin: 0 !important;
}

#welcome-slot:empty {
  display: none;
}

/* ── Stories row ── */
.stories-card {
  padding: 0;
  overflow: hidden;
}

.stories-row {
  padding: 16px 12px;
  gap: 8px;
}

.story-item {
  width: clamp(56px, 14vw, 64px);
}

.story-item .story-ring-wrap {
  width: clamp(56px, 14vw, 64px);
  height: clamp(56px, 14vw, 64px);
}

/* ── Composer ── */
.composer-card .composer {
  padding: 12px 16px 0;
}

.composer-card .composer input {
  min-height: 40px;
  font-size: 1rem;
}

.composer-card .composer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Post cards ── */
.post-card {
  margin-bottom: 0 !important;
}

.post-header {
  padding: 12px 16px 0;
  align-items: flex-start;
}

.post-header .post-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-header .meta .name {
  font-size: 0.9375rem;
  line-height: 1.25;
}

.post-header .meta .time {
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.post-body {
  padding: 8px 16px 12px;
  font-size: 0.9375rem;
  line-height: 1.3333;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-image-wrap {
  background: #000;
  line-height: 0;
}

.post-image {
  width: 100%;
  display: block;
  max-height: min(560px, 65vh);
  object-fit: cover;
  cursor: pointer;
}

/* Feed post videos (incl. saved live replays) — preserve full frame, no crop */
.post-video-wrap {
  background: #000;
  line-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.post-video {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

@media (max-width: 767px) {
  .post-card .post-video-wrap {
    width: 100%;
    max-width: 100%;
  }

  .post-card .post-video {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    object-position: center center;
  }
}

.post-stats {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.post-stats .stats-right {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.post-stats .stats-link.open-comments-btn {
  cursor: pointer;
}

.post-stats .stats-link.open-comments-btn:hover {
  text-decoration: underline;
}

.post-actions {
  margin: 0;
  padding: 4px 8px 6px;
}

.post-actions button {
  font-size: 0.9375rem;
  font-weight: 600;
  gap: 6px;
}

.post-actions button i {
  font-size: 1.05rem;
}

/* PYMK */
.pymk-card {
  flex: 0 0 200px;
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.pymk-card .pymk-photo {
  height: 200px;
  position: relative;
  overflow: hidden;
}

.pymk-card .pymk-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pymk-card .body {
  padding: 12px;
}

.pymk-card .body .name {
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

/* ── Profile (Facebook web) ── */
.profile-page-wrap {
  background: var(--bg-page);
}

.profile-page .profile-cover {
  height: clamp(200px, 32vw, 360px);
  background: #bcc0c4 center/cover no-repeat;
  position: relative;
  max-width: 100%;
}

.profile-cover-edit {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer !important;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  z-index: 9999 !important;
  position: relative;
}

.profile-page .profile-avatar-wrap {
  left: clamp(16px, 5vw, 32px);
  bottom: -64px;
}

.profile-page .profile-avatar {
  width: clamp(128px, 16vw, 168px);
  height: clamp(128px, 16vw, 168px);
  border-width: 4px;
}

.profile-avatar-edit {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #e4e6eb;
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  z-index: 9999 !important;
  position: relative;
}

.profile-photo-remove {
  position: absolute;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  z-index: 2;
}

.profile-photo-remove.hidden {
  display: none;
}

.profile-cover .profile-photo-remove {
  left: 16px;
  bottom: 16px;
}

.profile-avatar-wrap .profile-photo-remove {
  left: 0;
  bottom: -28px;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  font-size: 0.78rem;
}

.profile-avatar-wrap .profile-photo-remove:hover {
  color: #e41e3f;
  text-decoration: underline;
}

.profile-page .profile-head {
  padding: 72px clamp(16px, 5vw, 32px) 16px;
  border-bottom: none;
}

.profile-head-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.profile-page .profile-head h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
}

.profile-friends-count {
  margin: 4px 0 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.profile-username {
  margin: 2px 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.profile-count-sep {
  margin: 0 6px;
  color: var(--text-muted);
}

.settings-username-wrap {
  display: flex;
  align-items: stretch;
}

.settings-username-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text-muted);
  font-weight: 700;
}

.settings-username-wrap .form-control {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.profile-friends-count a:hover {
  text-decoration: underline;
}

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.profile-page .profile-tabs {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 32px);
  overflow-x: auto;
  scrollbar-width: none;
}

.profile-page .profile-tabs::-webkit-scrollbar {
  display: none;
}

.profile-page .profile-tabs a {
  padding: 16px 16px 13px;
  font-size: 0.9375rem;
}

.profile-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px clamp(16px, 5vw, 32px) 32px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.profile-layout.single-col {
  grid-template-columns: 1fr;
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-widget {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.profile-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  font-weight: 700;
  font-size: 1.0625rem;
}

.profile-widget-head a {
  color: var(--jtb-yellow-hover);
  font-size: 0.875rem;
  font-weight: 600;
}

.profile-widget-body {
  padding: 0 16px 16px;
}

.profile-intro-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.profile-intro-item i {
  width: 20px;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: center;
}

.profile-friends-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.profile-friend-tile {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-page);
  text-decoration: none;
  color: inherit;
}

.profile-friend-tile img,
.profile-friend-tile .tile-avatar {
  width: 100%;
  height: calc(100% - 22px);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  background: var(--jtb-yellow-soft);
  color: #b8860b;
}

.profile-friend-tile span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-weight: 700;
}

.profile-posts-view-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px;
  margin-bottom: 16px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.profile-posts-view-bar .filters {
  display: flex;
  gap: 8px;
}

.profile-posts-view-bar .filters button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: var(--bg-page);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-muted);
}

.profile-posts-view-bar .filters button.active {
  background: var(--jtb-yellow-soft);
  color: var(--jtb-black);
}

.profile-tab-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-create-btn {
  width: auto !important;
  padding: 6px 14px !important;
  font-size: 0.85rem !important;
  white-space: nowrap;
}

.profile-reels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: 12px;
}

.profile-reel-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.profile-reel-thumb {
  position: relative;
  aspect-ratio: 9/16;
  border-radius: 12px;
  overflow: hidden;
  background: #1c1e21;
}

.profile-reel-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-reel-views {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-reel-caption {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-reels-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.profile-reels-empty i {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.profile-main .feed-stack {
  gap: 16px;
}

.profile-main .tab-panel {
  padding: 0;
}

.profile-main .tab-panel.card {
  padding: 16px 20px;
}

@media (max-width: 992px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-sidebar {
    order: 2;
  }

  .profile-main {
    order: 1;
  }
}

@media (max-width: 600px) {
  .profile-page .profile-head {
    padding-top: 64px;
  }

  .profile-page .profile-avatar-wrap {
    left: 50%;
    transform: translateX(-50%);
    bottom: -56px;
  }

  .profile-head-inner {
    text-align: center;
  }

  .profile-actions {
    justify-content: center;
  }
}
