/* Incremental TikTok/RedGifs-inspired skin for classic KVS member pages.
   Scoped: only when body has .dfx-member-profile (JS adds on member_profile_* pages).
   Does not require PHP wrappers. */
body.dfx-member-profile {
  --dfx-mp-bg: #121317;
  --dfx-mp-surface: #1a1b22;
  --dfx-mp-surface2: #24252c;
  --dfx-mp-border: rgba(255, 255, 255, 0.08);
  --dfx-mp-text: #f2f2f4;
  --dfx-mp-muted: #9a9ba6;
  --dfx-mp-accent: #f2185b;
}

body.dfx-member-profile .main-content {
  background:
    radial-gradient(900px 420px at 10% -8%, rgba(242, 24, 91, 0.12), transparent 55%),
    radial-gradient(700px 360px at 90% 0%, rgba(255, 255, 255, 0.035), transparent 50%),
    var(--dfx-mp-bg);
}

body.dfx-member-profile .content {
  max-width: 1100px;
  margin: 0 auto;
}

/* Composed TikTok-style header (JS builds .dfx-mp-header) */
body.dfx-member-profile .dfx-mp-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px 22px;
  margin: 0 0 18px;
  padding: 20px 16px 16px;
  border: 1px solid var(--dfx-mp-border);
  border-radius: 16px;
  background: rgba(26, 27, 34, 0.92);
  animation: dfx-mp-fade-up 0.4s ease both;
}

body.dfx-member-profile .dfx-mp-header .dfx-mp-avatar {
  flex: 0 0 120px;
  width: 120px;
  height: 120px;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(242, 24, 91, 0.55);
  box-shadow: 0 0 0 6px rgba(242, 24, 91, 0.08);
  background: var(--dfx-mp-surface2);
}

body.dfx-member-profile .dfx-mp-header .dfx-mp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.dfx-member-profile .dfx-mp-header .dfx-mp-avatar .no-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0;
}
body.dfx-member-profile .dfx-mp-header .dfx-mp-avatar .no-thumb::after {
  content: "@";
  font-size: 42px;
  font-weight: 800;
  color: var(--dfx-mp-muted);
}

body.dfx-member-profile .dfx-mp-header .dfx-mp-meta {
  flex: 1 1 260px;
  min-width: 0;
}

body.dfx-member-profile .dfx-mp-header .dfx-mp-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 10px;
}

body.dfx-member-profile .dfx-mp-header h1 {
  margin: 0;
  flex: 1 1 auto;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--dfx-mp-text);
  line-height: 1.15;
}

body.dfx-member-profile .dfx-mp-header .dfx-mp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.dfx-member-profile .dfx-mp-header .button,
body.dfx-member-profile .dfx-mp-header .dfx-mp-follow {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

body.dfx-member-profile .dfx-mp-header .button:hover,
body.dfx-member-profile .dfx-mp-header .dfx-mp-follow:hover {
  transform: translateY(-1px);
}

body.dfx-member-profile .dfx-mp-follow,
body.dfx-member-profile .dfx-mp-header a.button.community_user[data-dfx-follow],
body.dfx-member-profile .dfx-mp-header button.dfx-mp-follow {
  background: var(--dfx-mp-accent) !important;
  color: #fff !important;
  border-color: transparent !important;
}
body.dfx-member-profile .dfx-mp-follow.is-following,
body.dfx-member-profile .dfx-mp-follow.is-following span {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: var(--dfx-mp-text) !important;
}

body.dfx-member-profile .dfx-mp-header a.button.community_user[data-action="message"],
body.dfx-member-profile .dfx-mp-header a.button.community_user[data-fancybox="ajax"]:not(.dfx-mp-follow) {
  background: var(--dfx-mp-surface2) !important;
  border: 1px solid var(--dfx-mp-border) !important;
  color: var(--dfx-mp-text) !important;
}

/* Pill nav under header (restyled classic member-menu links) */
body.dfx-member-profile .dfx-mp-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  animation: dfx-mp-fade-up 0.45s ease both;
}
body.dfx-member-profile .dfx-mp-nav li {
  margin: 0;
  padding: 0;
}
body.dfx-member-profile .dfx-mp-nav a,
body.dfx-member-profile .dfx-mp-nav span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--dfx-mp-surface2);
  color: var(--dfx-mp-muted) !important;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none !important;
}
body.dfx-member-profile .dfx-mp-nav span,
body.dfx-member-profile .dfx-mp-nav a:hover {
  background: rgba(242, 24, 91, 0.16);
  color: #ff6b96 !important;
}
body.dfx-member-profile .dfx-mp-nav em {
  font-style: normal;
  opacity: 0.85;
}

/* Hide classic left rail once JS composes header */
body.dfx-member-profile.dfx-mp-composed .member-menu {
  display: none !important;
}

/* Fallback (pre-compose / if JS fails): still skin classic rail */
body.dfx-member-profile:not(.dfx-mp-composed) .member-menu {
  float: none !important;
  width: auto !important;
  margin: 0 0 18px !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.dfx-member-profile:not(.dfx-mp-composed) .member-menu > .headline {
  display: none;
}
body.dfx-member-profile:not(.dfx-mp-composed) .member-menu .block-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px 22px;
  padding: 18px 16px 8px;
  border: 1px solid var(--dfx-mp-border);
  border-radius: 16px;
  background: rgba(26, 27, 34, 0.9);
}
body.dfx-member-profile:not(.dfx-mp-composed) .member-menu .avatar {
  flex: 0 0 120px;
  width: 120px !important;
  height: 120px !important;
  margin: 0 !important;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(242, 24, 91, 0.55);
}
body.dfx-member-profile:not(.dfx-mp-composed) .member-menu .block-additional {
  display: none;
}

body.dfx-member-profile .main-container-user {
  float: none !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 12px 40px !important;
}

/* When not composed, classic headline still gets skin */
body.dfx-member-profile:not(.dfx-mp-composed) .main-container-user > .headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 14px;
  padding: 4px 0 0;
  border: 0 !important;
  background: transparent !important;
}
body.dfx-member-profile:not(.dfx-mp-composed) .main-container-user > .headline h1 {
  margin: 0;
  flex: 1 1 auto;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--dfx-mp-text);
}

/* Hide legacy friend-request chrome — Follow is one-click */
body.dfx-member-profile .friendship-status,
body.dfx-member-profile .friendship-header-chip,
body.dfx-member-profile .popup-add-to-friends,
body.dfx-member-profile a.button.community_user[data-action="add_to_friends"],
body.dfx-member-profile a.button.community_user.done[href="#friends"],
body.dfx-member-profile .button-info,
body.dfx-member-profile a.button[data-subscribe-to="user"],
body.dfx-member-profile a.button[data-unsubscribe-to="user"],
body.dfx-member-profile a.button[data-fancybox="ajax"]:not(.community_user) {
  display: none !important;
}

/* Stats strip */
body.dfx-member-profile .dfx-mp-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  animation: dfx-mp-fade-up 0.5s ease both;
}
body.dfx-member-profile .dfx-mp-stats li {
  color: var(--dfx-mp-muted);
  font-size: 14px;
}
body.dfx-member-profile .dfx-mp-stats strong {
  color: var(--dfx-mp-text);
  font-weight: 800;
  margin-right: 4px;
  font-size: 16px;
}

/* Classic fields restyled */
body.dfx-member-profile .block-profile {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--dfx-mp-border);
  border-radius: 14px;
  background: rgba(26, 27, 34, 0.85);
  animation: dfx-mp-fade-up 0.55s ease both;
}
body.dfx-member-profile .block-profile .profile-list,
body.dfx-member-profile .block-profile .margin-fix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
}
body.dfx-member-profile .block-profile .column {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
}
body.dfx-member-profile .block-profile .item {
  color: var(--dfx-mp-muted);
  font-size: 13px;
  margin: 0 0 8px;
}
body.dfx-member-profile .block-profile .item em,
body.dfx-member-profile .block-profile .item a {
  display: block;
  margin-top: 2px;
  color: var(--dfx-mp-text);
  font-style: normal;
}
body.dfx-member-profile .block-profile .about-me {
  grid-column: 1 / -1;
  margin-top: 4px;
}

/* Vertical uploads grid — match live DOM: .box > .list-videos > .margin-fix > .item */
body.dfx-member-profile #list_videos_uploaded_videos > .headline,
body.dfx-member-profile .list-albums > .headline {
  border: 0 !important;
  background: transparent !important;
  margin: 8px 0 12px;
  padding: 0;
  border-bottom: 1px solid var(--dfx-mp-border) !important;
}
body.dfx-member-profile #list_videos_uploaded_videos > .headline h2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dfx-mp-text);
}

body.dfx-member-profile #list_videos_uploaded_videos .box .list-videos .margin-fix,
body.dfx-member-profile #list_videos_uploaded_videos_items {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 !important;
  float: none !important;
  width: auto !important;
}

body.dfx-member-profile #list_videos_uploaded_videos .item,
body.dfx-member-profile #list_videos_uploaded_videos_items > .item {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  aspect-ratio: 3 / 4;
  border-radius: 4px;
  overflow: hidden;
  background: #0c0d10;
  position: relative;
  animation: dfx-mp-thumb-in 0.35s ease both;
}

body.dfx-member-profile #list_videos_uploaded_videos .item > a {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

body.dfx-member-profile #list_videos_uploaded_videos .item .img {
  position: absolute;
  inset: 0;
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

body.dfx-member-profile #list_videos_uploaded_videos .item .img img.thumb,
body.dfx-member-profile #list_videos_uploaded_videos .item .img img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

body.dfx-member-profile #list_videos_uploaded_videos .item .title,
body.dfx-member-profile #list_videos_uploaded_videos .item .rating,
body.dfx-member-profile #list_videos_uploaded_videos .item .added,
body.dfx-member-profile #list_videos_uploaded_videos .item .ico-fav-0,
body.dfx-member-profile #list_videos_uploaded_videos .item .ico-fav-1,
body.dfx-member-profile #list_videos_uploaded_videos .item .item-control {
  display: none !important;
}

body.dfx-member-profile #list_videos_uploaded_videos .item .wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 !important;
  padding: 28px 8px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  display: flex !important;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 2;
}

body.dfx-member-profile #list_videos_uploaded_videos .item .duration,
body.dfx-member-profile #list_videos_uploaded_videos .item .views {
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

body.dfx-member-profile #list_videos_uploaded_videos .item .views::before {
  content: "▶ ";
  font-size: 9px;
}

@keyframes dfx-mp-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dfx-mp-thumb-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  body.dfx-member-profile #list_videos_uploaded_videos .box .list-videos .margin-fix,
  body.dfx-member-profile #list_videos_uploaded_videos_items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.dfx-member-profile .block-profile .profile-list,
  body.dfx-member-profile .block-profile .margin-fix {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  body.dfx-member-profile .dfx-mp-header .dfx-mp-avatar {
    flex-basis: 88px;
    width: 88px;
    height: 88px;
  }
  body.dfx-member-profile .dfx-mp-header h1 {
    font-size: 22px;
    width: 100%;
  }
  body.dfx-member-profile .dfx-mp-header .dfx-mp-actions .button,
  body.dfx-member-profile .dfx-mp-header .dfx-mp-follow {
    flex: 1 1 auto;
  }
  body.dfx-member-profile #list_videos_uploaded_videos .box .list-videos .margin-fix,
  body.dfx-member-profile #list_videos_uploaded_videos_items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }
  body.dfx-member-profile .block-profile .profile-list,
  body.dfx-member-profile .block-profile .margin-fix {
    grid-template-columns: 1fr;
  }
}

body.dfx-member-profile.dfx-mp-hide-videos .dfx-mp-stats [data-stat="videos"] {
  display: none;
}
