/* Profile & cover photo camera menu, action sheet, and live camera modal */

.photo-cam-wrap {
  position: relative;
  display: inline-block;
  z-index: 9999;
  pointer-events: auto !important;
}

.photo-cam-wrap--cover {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.photo-cam-wrap--avatar {
  position: absolute;
  right: 8px;
  bottom: 8px;
}

.profile-cover-edit,
.profile-avatar-edit,
#btn-edit-avatar,
#btn-edit-cover,
.avatar-edit-icon,
.cover-edit-icon {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 9999 !important;
  position: relative;
}

.profile-cover .jtb-sk-profile-cover,
.profile-cover [data-jtb-shell-skeleton] {
  pointer-events: none !important;
}

.profile-page .profile-cover {
  overflow: visible;
}

.profile-page .profile-avatar-wrap {
  z-index: 9998;
  pointer-events: auto;
}

.photo-cam-wrap.is-menu-open {
  z-index: 50;
}

/* Anchored dropdown (desktop / tablet) */
.photo-action-menu.photo-action-menu--anchored {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  left: auto;
  z-index: 50;
  min-width: 220px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #dddfe2);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  padding: 6px;
  animation: photo-menu-in 0.15s ease-out;
}

.photo-action-menu.photo-action-menu--anchored.photo-action-menu--above {
  top: auto;
  bottom: calc(100% + 6px);
}

.photo-action-menu.photo-action-menu--anchored button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #050505);
  text-align: left;
}

.photo-action-menu.photo-action-menu--anchored button:hover {
  background: var(--bg-page, #f0f2f5);
}

.photo-action-menu.photo-action-menu--anchored button.danger {
  color: #e41e3f;
}

/* Mobile action sheet */
.photo-action-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.45);
  animation: photo-backdrop-in 0.2s ease-out;
}

.photo-action-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10060;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  animation: photo-sheet-up 0.25s ease-out;
}

.photo-action-sheet-inner {
  background: var(--bg-card, #fff);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

.photo-action-sheet button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 16px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #050505);
  border-bottom: 1px solid var(--border, #dddfe2);
}

.photo-action-sheet button:last-child {
  border-bottom: none;
}

.photo-action-sheet button.danger {
  color: #e41e3f;
}

.photo-action-sheet-cancel {
  margin-top: 8px;
  background: var(--bg-card, #fff);
  border-radius: 14px;
  border: none;
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text, #050505);
}

@keyframes photo-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes photo-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes photo-sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Live camera modal */
.profile-camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999 !important;
  background: rgba(0, 0, 0, 0.92) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  isolation: isolate;
  pointer-events: auto;
}

.profile-camera-overlay.hidden {
  display: none;
}

.profile-camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: #fff;
  flex-shrink: 0;
}

.profile-camera-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.profile-camera-header button {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
}

.profile-camera-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.profile-camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-camera-preview--mirror {
  transform: scaleX(-1);
}

.profile-camera-canvas {
  display: none;
}

.profile-camera-status {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  margin: 0;
  text-align: center;
  padding: 0 16px;
}

.profile-camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}

.profile-camera-capture {
  min-width: 160px;
  height: 48px;
  padding: 0 24px;
  border-radius: 24px;
  border: none;
  background: var(--jtb-yellow, #ffcc00);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #050505;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.profile-camera-capture:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.profile-camera-open .profile-page-wrap,
body.profile-camera-open .profile-cover,
body.profile-camera-open .profile-avatar-wrap,
body.profile-camera-open .photo-cam-wrap,
body.profile-camera-open #topbar {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.profile-camera-open .profile-camera-overlay {
  visibility: visible !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .photo-cam-wrap--cover {
    right: 12px;
    bottom: 12px;
  }
}

/* Clickable profile count buttons */
.profile-count-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.profile-count-btn:hover {
  text-decoration: underline;
}

.profile-stats-line .profile-count-btn {
  color: var(--text-muted, #65676b);
}

/* Followers / Following modal */
body.follow-list-open {
  overflow: hidden;
}

.follow-list-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10080;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: follow-list-fade-in 0.2s ease-out;
}

.follow-list-modal {
  width: min(100%, 480px);
  max-height: min(85vh, 640px);
  background: var(--bg-card, #fff);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: follow-list-scale-in 0.22s ease-out;
}

.follow-list-modal--sheet {
  width: 100%;
  max-height: 88vh;
  align-self: flex-end;
  border-radius: 16px 16px 0 0;
  animation: follow-list-sheet-up 0.28s ease-out;
}

.follow-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border, #dddfe2);
  flex-shrink: 0;
}

.follow-list-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.follow-list-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-page, #f0f2f5);
  color: var(--text-muted, #65676b);
  font-size: 0.8125rem;
  font-weight: 700;
}

.follow-list-close {
  border: none;
  background: var(--bg-page, #f0f2f5);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text, #050505);
  flex-shrink: 0;
}

.follow-list-close:hover {
  background: var(--border, #dddfe2);
}

.follow-list-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.follow-list-search-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card, #fff);
  border-bottom: 1px solid var(--border, #dddfe2);
}

.follow-list-search-wrap i {
  color: var(--text-muted, #65676b);
  font-size: 0.9rem;
}

.follow-list-search {
  flex: 1;
  border: none;
  background: var(--bg-page, #f0f2f5);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9375rem;
  color: var(--text, #050505);
  outline: none;
}

.follow-list-search:focus {
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.25);
}

.follow-list-scroll {
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
  max-height: calc(min(85vh, 640px) - 120px);
}

.follow-list-modal--sheet .follow-list-scroll {
  max-height: calc(88vh - 120px);
}

.follow-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.follow-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
}

.follow-list-item:hover {
  background: var(--bg-page, #f0f2f5);
}

.follow-list-user-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.follow-list-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.follow-list-avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1877f2, #42b72a);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.follow-list-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.follow-list-name {
  font-weight: 700;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.follow-list-handle {
  font-size: 0.8125rem;
  color: var(--text-muted, #65676b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.follow-list-verified {
  color: var(--jtb-blue, #1877f2);
  font-size: 0.75rem;
  margin-left: 2px;
}

.follow-list-action {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 96px;
}

.follow-list-action--follow {
  background: var(--jtb-blue, #1877f2);
  color: #fff;
}

.follow-list-action--following {
  background: var(--bg-page, #f0f2f5);
  color: var(--text, #050505);
}

.follow-list-action--following:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.follow-list-action--muted {
  background: var(--bg-page, #f0f2f5);
  color: var(--text-muted, #65676b);
  cursor: default;
}

.follow-list-action:disabled {
  opacity: 0.65;
  cursor: wait;
}

.follow-list-privacy,
.follow-list-empty,
.follow-list-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted, #65676b);
  min-height: 220px;
}

.follow-list-privacy i {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.7;
}

.follow-list-privacy p,
.follow-list-empty p,
.follow-list-error p {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.follow-list-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted, #65676b);
}

.follow-list-loading--inline {
  padding: 16px;
}

@keyframes follow-list-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes follow-list-scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes follow-list-sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 767px) {
  .follow-list-backdrop {
    align-items: flex-end;
    padding: 0;
  }
}
