/* =====================
   FONTS — Facebook Sans (local)
   ===================== */
@font-face {
  font-family: "Facebook Sans";
  font-style: normal;
  font-weight: 300;
  src: url("fonts/FacebookSansLight.woff") format("woff");
}
@font-face {
  font-family: "Facebook Sans";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/FacebookSansRegular.woff") format("woff");
}
@font-face {
  font-family: "Facebook Sans";
  font-style: normal;
  font-weight: 700;
  src: url("fonts/FacebookSansBold.woff") format("woff");
}
@font-face {
  font-family: "Facebook Sans";
  font-style: normal;
  font-weight: 900;
  src: url("fonts/FacebookSansHeavy.woff") format("woff");
}

/* =====================
   RESET & BASE
   ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    "Facebook Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: #fff;
  color: #1c1e21;
  font-size: 15px;
}

/* =====================
   VARIABLES
   ===================== */
:root {
  --fb-blue: #1877f2;
  --fb-blue-hover: #166fe5;
  --fb-hover-bg: #e7f3ff;
  --bg-main: #f0f2f5;
  --bg-card: #ffffff;
  --text-main: #1c1e21;
  --text-secondary: #65676b;
  --border: #ced0d4;
  --nav-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  --radius: 8px;
}

/* =====================
   SCROLLBAR
   ===================== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #ced0d4;
  border-radius: 4px;
}

/* =====================
   NAVBAR
   ===================== */
.fb-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--bg-card);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  padding-right: 12px;
  z-index: 100;
  transition: transform 0.25s ease;
}
.fb-nav.nav-hidden {
  transform: translateY(-100%);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hamburger */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
}

/* Wordmark "facebook" */
.fb-wordmark {
  font-size: 26px;
  font-weight: 700;
  color: var(--fb-blue);
  /* font-family: Georgia, "Times New Roman", serif; */
  font-family: "Facebook Sans";
  letter-spacing: -0.5px;
  line-height: 1;
  font-style: normal;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Boutons □ (créer, rechercher) */
.nav-sq-btn {
  width: 24px;
  height: 24px;
  border: 2px solid var(--text-main);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text-main);
}
.nav-sq-btn:hover {
  background: var(--bg-main);
}

/* Messenger avatar avec badge */
.nav-messenger-btn {
  position: relative;
  cursor: pointer;
  margin-left: 2px;
}
.badge-messenger {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #f02849;
  color: white;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 20px;
  text-align: center;
  line-height: 16px;
  border: 2px solid white;
}

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #f02849;
  color: white;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}

/* =====================
   AVATAR
   ===================== */
.avatar-circle {
  border-radius: 50%;
  object-fit: cover;
  background: #e4e6eb;
  flex-shrink: 0;
}
.avatar-sm {
  width: 38px;
  height: 38px;
}
.avatar-md {
  width: 40px;
  height: 40px;
}
.avatar-lg {
  width: 72px;
  height: 72px;
}

/* =====================
   FEED
   ===================== */
.feed-wrapper {
  padding-top: calc(var(--nav-height) + var(--safe-top));
  display: flex;
  justify-content: center;
  min-height: 100vh;
}
.feed {
  width: 100%;
  max-width: 590px;
  padding: 0 0 60px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* =====================
   CARD
   ===================== */
.card {
  background: white;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  border-bottom: 1px solid #e4e6eb;
}

/* =====================
   STORIES
   ===================== */
.stories-card {
  display: flex;
  gap: 8px;
  padding: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stories-card::-webkit-scrollbar {
  display: none;
}

.story {
  flex-shrink: 0;
  width: 116px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #e4e6eb;
}
.story-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}
.story-avatar {
  position: absolute;
  top: 8px;
  left: 8px;
  border: 3px solid var(--fb-blue);
  border-radius: 50%;
}
.story-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.story-name {
  color: white;
  font-size: 12px;
  font-weight: 700;
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.add-story .story-img-wrap {
  width: 100%;
  height: 70%;
  position: relative;
  background: #e4e6eb;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.add-story {
  overflow: visible;
  background: #d8d8d89c;
}
.add-story .story-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.add-icon {
  position: absolute;
  bottom: calc(30% - 18px);
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: var(--fb-blue);
  border-radius: 50%;
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid white;
  z-index: 2;
}
.add-story > span {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 22px 8px 8px;
}

/* =====================
   CREATE POST (PJ1)
   ===================== */
.create-post-card {
  padding: 12px 16px;
}
.create-post-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.create-post-input {
  flex: 1;
  background: #f0f2f5;
  border-radius: 20px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 15px;
  transition: background 0.15s;
}
.create-post-input:hover {
  background: #e4e6eb;
}
.cp-photo-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.cp-photo-btn:hover {
  background: var(--bg-main);
}

/* =====================
   POST CARD
   ===================== */
.post-card {
  position: relative;
  border-bottom: 8px solid #f0f2f5;
}
.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 0;
}
.post-header-info {
  flex: 1;
}
.post-author-name {
  font-weight: 700;
  font-size: 15px;
}
.post-options {
  display: flex;
  gap: 2px;
  align-items: center;
}
.post-options-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
}
.post-options-btn:hover {
  background: var(--bg-main);
}

.post-text {
  padding: 10px 16px 8px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-text-large {
  font-size: 22px;
}

/* Images grid */
.post-images {
  display: grid;
  gap: 2px;
}
.post-images.count-1 {
  grid-template-columns: 1fr;
}
.post-images.count-2 {
  grid-template-columns: 1fr 1fr;
}
.post-images.count-3 {
  grid-template-columns: 1fr 1fr;
}
.post-images.count-3 .post-img:first-child {
  grid-column: 1 / -1;
}
.post-images.count-4 {
  grid-template-columns: 1fr 1fr;
}

.post-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.post-images.count-1 .post-img {
  aspect-ratio: unset;
  max-height: 500px;
}

/* Stats bar (compteurs) */
.post-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}
.post-stats-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.post-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: var(--text-secondary);
}
.post-stat svg {
  flex-shrink: 0;
}
.post-stats-right {
  display: flex;
  align-items: center;
}

.post-divider {
  border: none;
  border-top: 1px solid #e4e6eb;
  margin: 0 16px;
}

/* Action buttons */
.post-actions {
  display: flex;
  justify-content: space-around;
  padding: 4px 8px;
}
.post-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.post-action:hover {
  background: var(--bg-main);
}

/* Editor quick actions (shown on hover) */
.post-edit-strip {
  display: none;
  position: absolute;
  top: 8px;
  right: 52px;
  gap: 4px;
}
.post-card:hover .post-edit-strip {
  display: flex;
}

/* =====================
   EDITOR PANEL
   ===================== */
.editor-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s ease;
}
.editor-panel.hidden {
  transform: translateX(100%);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  padding-top: calc(14px + var(--safe-top));
  border-bottom: 1px solid #e4e6eb;
  flex-shrink: 0;
}
.editor-header h2 {
  font-size: 17px;
}

.editor-tabs {
  display: flex;
  border-bottom: 1px solid #e4e6eb;
  flex-shrink: 0;
}
.etab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.etab.active {
  color: var(--fb-blue);
  border-bottom-color: var(--fb-blue);
}
.etab:hover:not(.active) {
  background: var(--bg-main);
}

.etab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.etab-content.hidden {
  display: none;
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* =====================
   FORMS
   ===================== */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--text-main);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--fb-blue);
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row-2 .form-group {
  margin-bottom: 0;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.form-row-3 .form-group {
  margin-bottom: 0;
}

.avatar-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.images-preview-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-height: 0;
}
.img-preview-wrap {
  position: relative;
}
.images-preview-row img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.img-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #f02849;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid white;
  font-weight: 700;
}

/* =====================
   BUTTONS
   ===================== */
.btn-primary {
  background: var(--fb-blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: var(--fb-blue-hover);
}

.btn-primary-sm {
  background: var(--fb-blue);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary-sm:hover {
  background: var(--fb-blue-hover);
}

.btn-secondary {
  background: #e4e6eb;
  color: var(--text-main);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover {
  background: #d8dadf;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.btn-icon:hover {
  background: var(--bg-main);
}

.btn-sm {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-main);
  transition: background 0.15s;
}
.btn-sm:hover {
  background: var(--bg-main);
}
.btn-sm-danger {
  border-color: #f02849;
  color: #f02849;
}
.btn-sm-danger:hover {
  background: #fff5f6;
}

.mb-2 {
  margin-bottom: 12px;
}

/* =====================
   PROFILE ITEM
   ===================== */
.profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e4e6eb;
  margin-bottom: 8px;
  transition: background 0.15s;
}
.profile-item:hover {
  background: var(--bg-main);
}
.profile-item-info {
  flex: 1;
}
.profile-item-name {
  font-weight: 700;
  font-size: 14px;
}
.profile-item-actions {
  display: flex;
  gap: 4px;
}

.pm-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* Post item in editor */
.post-editor-item {
  padding: 10px;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: grab;
  transition:
    background 0.15s,
    border-color 0.15s;
  user-select: none;
}
.post-editor-item:hover {
  background: var(--bg-main);
}
.post-editor-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.post-editor-item.drag-over {
  border-color: var(--fb-blue);
  background: var(--fb-hover-bg);
}

.post-editor-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.post-editor-item-name {
  font-weight: 700;
  font-size: 13px;
}
.post-editor-item-text {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =====================
   MODAL
   ===================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}
.modal-wide {
  max-width: 580px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e4e6eb;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.modal-header h3 {
  font-size: 20px;
}

.modal-body {
  padding: 16px 20px 4px;
}
.modal-body .form-group {
  margin-bottom: 16px;
}
.modal-body .form-row-2,
.modal-body .form-row-3 {
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #e4e6eb;
  position: sticky;
  bottom: 0;
  background: white;
}

/* =====================
   EDITOR TOGGLE BUTTON
   ===================== */
.editor-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--fb-blue);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(24, 119, 242, 0.45);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    transform 0.15s;
}
.editor-toggle-btn:hover {
  background: var(--fb-blue-hover);
  transform: scale(1.08);
}

/* =====================
   TOAST
   ===================== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c1e21;
  color: white;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: fadeUp 0.25s ease;
  pointer-events: none;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* =====================
   NAV CIRCLE BUTTONS
   ===================== */
.nav-circle-btn {
  width: 40px;
  height: 40px;
  background: #e4e6eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
  color: var(--text-main);
}
.nav-circle-btn:hover {
  background: #d8dadf;
}
.nav-user-end {
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  margin-left: 2px;
}
.nav-caret {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1;
}

/* =====================
   CREATE POST INLINE ICONS
   ===================== */
.create-post-inline-icons {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-shrink: 0;
}
.cp-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.cp-icon:hover {
  background: #f0f2f5;
}

/* =====================
   REACTION PILE
   ===================== */
.reaction-pile {
  display: flex;
  align-items: center;
}
.reaction-bubble {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 2px solid white;
  margin-left: -6px;
  line-height: 1;
}
.reaction-bubble:first-child {
  margin-left: 0;
}
.reaction-bg-blue {
  background: #1877f2;
}
.reaction-bg-red {
  background: #f33e58;
}
.reaction-bg-yellow {
  background: #f7b928;
}
.reaction-bg-orange {
  background: #e9710f;
}

/* =====================
   REACTION ICON PICKER
   ===================== */
.reaction-icon-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.reaction-pick-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.15s,
    background 0.15s;
  line-height: 1;
  padding: 0;
}
.reaction-pick-btn.selected {
  border-color: #1877f2;
  background: #e7f0fd;
}
.reaction-pick-btn:hover:not(.selected) {
  background: var(--bg-main);
}

/* =====================
   POST META TIMESTAMP
   ===================== */
.post-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 11.5px;
  margin-top: 1px;
  line-height: 1.3;
}
.post-meta-timestamp {
  letter-spacing: 0;
}
.post-meta-sep {
  opacity: 0.6;
  font-size: 10px;
  line-height: 1;
}

/* =====================
   PROFILE PAGE OVERLAY
   ===================== */
.profile-page-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 450;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.profile-page-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.profile-page-overlay.hidden {
  display: none;
}

/* Scrollable area */
.pp-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 40px;
}

/* Cover photo + avatar + identity row */
.pp-cover-wrap {
  position: relative;
  width: 100%;
}
.pp-cover-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #c9d6e3 0%, #a8becc 100%);
}

/* Curved white bottom over the cover */
.pp-cover-bottom-curve {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: #ffffff;
  border-radius: 18px 18px 0 0;
}

/* Overlay buttons on cover photo */
.pp-cover-overlay-btns {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  padding-top: calc(10px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
  pointer-events: none;
}
.pp-overlay-right {
  display: flex;
  gap: 8px;
}
.pp-overlay-btn {
  pointer-events: all;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.pp-overlay-btn:hover {
  background: rgba(0, 0, 0, 0.45);
}

.pp-avatar-circle {
  position: absolute;
  bottom: -38px;
  left: 16px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid white;
  background: #e4e6eb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  z-index: 4;
}

/* Identity: name + friends count — positioned beside avatar */
.pp-identity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  margin-top: -18px;
  padding: 10px 16px 8px 120px;
  position: relative;
  z-index: 5;
}
.pp-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}
.pp-friends-count {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Short info bar (showShort items) */
.pp-short-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 6px 16px 10px;
}
.pp-short-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 100%;
}
.pp-short-item-icon {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

/* Action buttons */
.pp-actions {
  display: flex;
  gap: 8px;
  padding: 4px 16px 14px;
}
.pp-btn-primary {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: var(--fb-blue);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pp-btn-secondary {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ccd0d5;
  background: white;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Sections */
.pp-sections {
  padding: 0 0 4px;
}
.pp-section-block {
  background: white;
  border-top: 1px solid #e4e6eb;
  padding: 14px 16px 6px;
}
.pp-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}
.pp-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f2f5;
}
.pp-item:last-child {
  border-bottom: none;
}
.pp-item-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  line-height: 1;
}
.pp-item-icon img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}
.pp-item-body {
  flex: 1;
  min-width: 0;
}
.pp-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}
.pp-item-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 1px;
}
.pp-item-detail {
  font-size: 12px;
  color: #90949c;
  margin-top: 2px;
}

/* Friends block */
.pp-friends-block {
  background: white;
  border-top: 1px solid #e4e6eb;
  padding: 14px 16px 14px;
}
.pp-friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.pp-friends-header .pp-section-title {
  margin-bottom: 0;
}
.pp-friends-voir-tout {
  font-size: 14px;
  color: var(--fb-blue);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.pp-friends-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.pp-friend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.pp-friend-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #e4e6eb;
  display: block;
}
.pp-friend-name {
  font-size: 11px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.2;
  max-width: 60px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Publications title */
.pp-publications-title {
  background: white;
  border-top: 1px solid #e4e6eb;
  padding: 14px 16px 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}
.pp-posts {
  flex: 1;
  padding-bottom: 20px;
}

/* Profile modal extras */
.cover-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pm-cover-preview {
  width: 120px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  background: #e4e6eb;
  border: 1px solid #ccd0d5;
  display: block;
}
.pm-add-btn {
  margin-top: 8px;
  width: 100%;
}

/* Section editor in modal */
.pm-section-block {
  border: 1px solid #ccd0d5;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #f8f9fa;
}
.pm-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pm-section-header input {
  flex: 1;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
}
.pm-item-block {
  border: 1px solid #e4e6eb;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: white;
}
.pm-item-row {
  display: flex;
  gap: 6px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.pm-item-row input,
.pm-item-row textarea {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 4px 7px;
  border: 1px solid #ccd0d5;
  border-radius: 5px;
}
.pm-item-check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.pm-remove-btn {
  background: none;
  border: none;
  color: #c00;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.pm-remove-btn:hover {
  background: #fee;
}
.pm-add-item-btn {
  font-size: 12px;
  padding: 4px 8px;
  margin-top: 4px;
}

/* Friend editor in modal */
.pm-friend-block,
.pm-friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e4e6eb;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: white;
}
.pm-friend-block img,
.pm-friend-row img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #e4e6eb;
  flex-shrink: 0;
}
.pm-friend-block input,
.pm-friend-row input[type="text"] {
  flex: 1;
  font-size: 12px;
  padding: 4px 7px;
  border: 1px solid #ccd0d5;
  border-radius: 5px;
}

/* Item fields in section editor */
.pm-item-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.pm-item-input {
  flex: 1;
  min-width: 80px;
  font-size: 12px;
  padding: 4px 7px;
  border: 1px solid #ccd0d5;
  border-radius: 5px;
}
.pm-item-icon-input {
  max-width: 90px;
  flex: 0 0 90px;
}
.pm-item-short-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
.pm-section-items {
  margin-bottom: 6px;
}
.pm-section-title-input {
  flex: 1;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid #ccd0d5;
  border-radius: 6px;
}
.search-result-row--clickable {
  cursor: pointer;
}
.search-result-row--clickable:hover {
  background: var(--fb-hover-bg);
}
.search-result-arrow {
  font-size: 22px;
  color: var(--text-secondary);
  line-height: 1;
  margin-left: auto;
}

/* =====================
   SEARCH OVERLAY
   ===================== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 400;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.search-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.search-overlay.hidden {
  display: none;
}
.search-overlay.hidden.visible {
  display: flex;
}
.search-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + var(--safe-top));
  border-bottom: 1px solid #e4e6eb;
  background: white;
  flex-shrink: 0;
}
.search-back-btn {
  background: #e4e6eb;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-main);
}
.search-back-btn:hover {
  background: #d8dadf;
}
.search-input {
  flex: 1;
  background: #f0f2f5;
  border: none;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  color: var(--text-main);
}
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.search-section-title {
  font-size: 17px;
  font-weight: 700;
  padding: 12px 16px 8px;
  color: var(--text-main);
}
.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
}
.search-result-row:hover {
  background: #f0f2f5;
}
.search-result-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.search-result-initials {
  background: var(--fb-blue);
  color: white;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.search-result-info {
  flex: 1;
}
.search-result-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}
.search-result-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.search-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
  .editor-panel {
    width: 100vw;
  }
  .nav-center {
    display: none;
  }
  .fb-search span {
    display: none;
  }
  .nav-icon-btn#nav-user-block span {
    display: none;
  }
  .nav-user-end .nav-caret {
    display: none;
  }
}

/* =====================
   OFFLINE BANNER
   ===================== */
#offline-banner {
  position: fixed;
  top: calc(var(--nav-height) + var(--safe-top));
  left: 0;
  right: 0;
  background: #e53935;
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
}
#offline-banner.hidden {
  display: none;
}

.editor-toggle-offline {
  opacity: 0.4;
  cursor: not-allowed;
}

/* =====================
   OFFLINE SWITCH
   ===================== */
.offline-switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.offline-switch-label {
  font-size: 14px;
  font-weight: 600;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #42b72a;
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: #e53935;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.offline-progress-bar {
  height: 6px;
  background: #e4e6eb;
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
.offline-progress-fill {
  height: 100%;
  width: 0%;
  background: #1877f2;
  border-radius: 3px;
  transition: width 0.3s;
}

/* =====================
   VIDEO IN POST
   ===================== */
.post-video {
  width: 100%;
  background: #000;
}
.post-video video {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: contain;
  background: #000;
}
.post-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

/* =====================
   OFFLINE MODE
   ===================== */
.offline-mode .post-edit-strip {
  display: none !important;
}
.offline-mode .editor-tabs,
.offline-mode .editor-header h2 {
  display: none !important;
}
.offline-mode #tab-user .form-group,
.offline-mode #tab-user .btn-primary,
.offline-mode #tab-user .divider {
  display: none !important;
}
/* Show only the offline switch section */
.offline-mode #tab-user .form-group:last-child {
  display: block !important;
}
.offline-mode #tab-user {
  display: block !important;
}
.offline-mode .post-card {
  cursor: pointer;
}
.offline-mode #offline-banner {
  display: none !important;
}
.offline-mode .create-post-card {
  display: none !important;
}

/* =====================
   POST VIEWER (fullscreen)
   ===================== */
.post-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity .22s;
}
.post-viewer.visible {
  opacity: 1;
}
.post-viewer.hidden {
  display: none;
}
.pv-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 12px));
  left: 12px;
  z-index: 10;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pv-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}
.pv-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.pv-video {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}
.pv-bottom {
  background: linear-gradient(transparent, rgba(0,0,0,.85) 30%);
  padding: 20px 16px max(16px, env(safe-area-inset-bottom, 16px));
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.pv-author {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.pv-author-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.pv-author-meta {
  color: rgba(255,255,255,.65);
  font-size: 13px;
}
.pv-text {
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pv-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.pv-stats .post-stat {
  color: #fff;
}
.pv-stats svg {
  stroke: #fff;
}
.pv-stats-left {
  display: flex;
  gap: 14px;
}
.pv-stats-right {
  display: flex;
}
