/* Facebook-style create post modal */
.fb-compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.85rem max(0.75rem, env(safe-area-inset-bottom));
}
.fb-compose-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(244, 244, 244, 0.8);
  backdrop-filter: blur(2px);
  cursor: default;
}
.fb-compose-sheet {
  position: relative;
  width: min(100%, 560px);
  max-height: min(94dvh, 780px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fbComposeIn 0.16s ease;
}
@keyframes fbComposeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.fb-compose-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e4e6eb;
}
.fb-compose-head h2 {
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #050505;
  font-family: inherit;
}
.fb-compose-head-spacer { width: 36px; height: 36px; }
.fb-compose-close,
.fb-compose-back {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #e4e6eb;
  color: #050505;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.fb-compose-close:hover,
.fb-compose-back:hover { background: #d8dadf; }

.fb-compose-author {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1rem 0.35rem;
}
.fb-compose-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1877f2, #0c63d4);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.fb-compose-avatar.has-photo {
  background: #e7f0fe;
  padding: 0;
}
.fb-compose-avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fb-compose-author strong {
  display: block;
  font-size: 0.95rem;
  color: #050505;
}
.fb-compose-feeling {
  font-weight: 500;
  color: #050505;
}
.fb-compose-privacy {
  margin-top: 0.25rem;
  border: 0;
  background: #e4e6eb;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #050505;
  cursor: default;
}

.fb-compose-body {
  padding: 0.35rem 1rem 0.75rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.fb-compose-input {
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1.35;
  color: #050505;
  background: transparent;
  min-height: 72px;
}
.fb-compose-input::placeholder { color: #65676b; }

.fb-compose-photos {
  border: 1px solid #d0d3d8;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.5rem;
  background: #fff;
}
.fb-compose-photos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem;
  background: #fff;
  border-bottom: 1px solid #e4e6eb;
}
.fb-compose-photos-head strong { font-size: 0.92rem; }
.fb-compose-photos-close {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: #e4e6eb; cursor: pointer; font-size: 1.1rem;
}
.fb-compose-photos-empty {
  width: 100%;
  min-height: 180px;
  border: 0;
  background: #f7f8fa;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 650;
  color: #050505;
  font-size: 0.95rem;
}
.fb-compose-photos-empty span { font-size: 1.75rem; }
.fb-compose-photos-grid {
  display: grid;
  gap: 2px;
  background: #f0f2f5;
  padding: 2px;
}
.fb-compose-photos-grid.count-1 { grid-template-columns: 1fr; }
.fb-compose-photos-grid.count-2,
.fb-compose-photos-grid.count-3,
.fb-compose-photos-grid.count-4 { grid-template-columns: 1fr 1fr; }

.fb-compose-photo {
  position: relative;
  background: #eef1f5;
  overflow: hidden;
}

/* Single image: show full content (no square crop) */
.fb-compose-photos-grid.count-1 .fb-compose-photo {
  aspect-ratio: auto;
  min-height: 120px;
  max-height: min(48vh, 380px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fb-compose-photos-grid.count-1 .fb-compose-photo img {
  width: 100%;
  height: auto;
  max-height: min(48vh, 380px);
  object-fit: contain;
  object-position: center;
  display: block;
}

/* Multi-image grid: keep tile cells, still contain so banners aren't sliced */
.fb-compose-photos-grid:not(.count-1) .fb-compose-photo {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fb-compose-photos-grid:not(.count-1) .fb-compose-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.fb-compose-photo button {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; cursor: pointer; font-size: 1rem;
  z-index: 1;
}
.fb-compose-photo-add {
  aspect-ratio: 1;
  border: 0;
  background: #f0f2f5;
  font-size: 1.75rem;
  color: #65676b;
  cursor: pointer;
}

.fb-compose-error {
  margin: 0 1rem 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: #fde8e8;
  color: #a33;
  font-size: 0.86rem;
}

.fb-compose-edit-note {
  margin: 0 1rem 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(240, 162, 2, 0.12);
  color: #8a6200;
  font-size: 0.82rem;
  line-height: 1.4;
}

.fb-compose-edit-note strong {
  font-weight: 750;
}

.fb-compose-attach {
  margin: 0 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d0d3d8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 650;
  font-size: 0.9rem;
  color: #050505;
}
.fb-compose-attach-tools {
  display: flex;
  gap: 0.15rem;
}
.fb-compose-attach-tools button {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; font-size: 1.2rem;
}
.fb-compose-attach-tools button:hover:not(:disabled) { background: #f0f2f5; }
.fb-compose-attach-tools button:disabled { opacity: 0.4; cursor: default; }

.fb-compose-footer {
  padding: 0.75rem 1rem 1rem;
}
.fb-compose-post {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  background: #0866ff;
  color: #fff;
  cursor: pointer;
}
.fb-compose-post:hover:not(:disabled) { background: #0759db; }
.fb-compose-post:disabled {
  background: #e4e6eb;
  color: #bcc0c4;
  cursor: not-allowed;
}

.fb-feeling-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.75rem 1rem 1rem;
  overflow: auto;
}
.fb-feeling-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #f0f2f5;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  text-transform: capitalize;
}
.fb-feeling-chip:hover { background: #e4e6eb; }
.fb-feeling-chip.is-active {
  background: #e7f3ff;
  box-shadow: inset 0 0 0 1px #0866ff;
}

@media (max-width: 560px) {
  .fb-compose-sheet {
    width: 100%;
    max-height: 100dvh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }
  .fb-compose-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .fb-compose-input { font-size: 1.2rem; }
}