body {
  margin: 0;
  background: #070817;
  color: white;
  font-family: Arial, sans-serif;
}

.community-page {
  max-width: 850px;
  margin: 0 auto;
  padding: 30px 20px;
}

.back-btn {
  color: #93c5fd;
  text-decoration: none;
  font-weight: bold;
}

.community-header {
  margin: 25px 0;
  padding: 28px;
  border-radius: 22px;
  background: linear-gradient(135deg, #111827, #1e1b4b);
  border: 1px solid rgba(255,255,255,0.12);
}

.community-header h1 {
  margin: 0;
  font-size: 36px;
}

.community-header p {
  color: #cbd5e1;
}

.create-post {
  padding: 22px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 25px;
}

.create-post textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: none;
  outline: none;
  border-radius: 16px;
  padding: 15px;
  background: #0f172a;
  color: white;
  font-size: 16px;
  box-sizing: border-box;
}

.create-post input {
  margin-top: 15px;
  color: white;
}

.create-post button {
  margin-top: 15px;
  padding: 13px 22px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.post-card {
  padding: 22px;
  margin-bottom: 20px;
  border-radius: 22px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.avatar{

    width:56px;
    height:56px;

    border-radius:50%;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:22px;
    font-weight:700;

    color:white;

    background:
    linear-gradient(
        135deg,
        #7C3AED,
        #3B82F6,
        #06B6D4
    );

    box-shadow:
        0 10px 25px rgba(59,130,246,.35);

    border:2px solid rgba(255,255,255,.15);

    flex-shrink:0;

    user-select:none;

}

.post-author {
  font-weight: bold;
}

.post-date {
  color: #94a3b8;
  font-size: 13px;
}

.post-text {
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.post-image {
  width: 100%;
  margin-top: 15px;
  border-radius: 18px;
  max-height: 420px;
  object-fit: cover;
}

.post-actions {
  display: flex;
  gap: 15px;
  margin-top: 18px;
}

.post-actions button {
  border: none;
  background: #111827;
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.post-actions button:hover {
  background: #1f2937;
}

.comment-box {
  margin-top: 15px;
}

.comment-box input {
  width: 75%;
  padding: 11px;
  border-radius: 12px;
  border: none;
  background: #0f172a;
  color: white;
}

.comment-box button {
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  background: #3b82f6;
  color: white;
  cursor: pointer;
}

.comment {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  color: #e5e7eb;
}

.community-page {
  max-width: 900px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.community-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #070817;
  padding: 15px 0;
}

.community-top h1 {
  margin: 10px 0 4px;
  font-size: 30px;
}

.community-top p {
  margin: 0;
  color: #cbd5e1;
}

.posts-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 110px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.composer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(900px, calc(100% - 30px));
  display: flex;
  gap: 10px;
  align-items: end;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 24px;
  padding: 12px;
  backdrop-filter: blur(14px);
}

.composer textarea {
  flex: 1;
  min-height: 45px;
  max-height: 120px;
  resize: none;
  border: none;
  outline: none;
  border-radius: 18px;
  padding: 14px;
  background: #111827;
  color: white;
  font-size: 15px;
}

.file-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.file-btn input {
  display: none;
}

.composer button {
  height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.comments-area {
  display: none;
  margin-top: 15px;
}

.comments-area.open {
  display: block;
}

.comment {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 12px;
}

.comment-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.comment-box input {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  border: none;
  background: #0f172a;
  color: white;
}

.comment-box button {
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: #3b82f6;
  color: white;
  font-weight: bold;
}

.composer-preview {
  position: absolute;
  bottom: 75px;
  left: 15px;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-preview img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
}

.composer-preview button,
.reply-preview button {
  border: none;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.reply-preview {
  position: absolute;
  bottom: 75px;
  left: 15px;
  right: 15px;
  background: #111827;
  border-left: 4px solid #8b5cf6;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reply-preview img,
.quoted-post img {
  width: 90px;
  height: 65px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 6px;
}

.reply-preview p {
  margin: 5px 0 0;
  color: #cbd5e1;
}

.quoted-post {
  background: rgba(255,255,255,0.06);
  border-left: 4px solid #8b5cf6;
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.quoted-post p {
  margin: 6px 0 0;
  color: #cbd5e1;
}

.post-card {
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 18px;
}

.post-text {
  font-size: 15px;
  line-height: 1.45;
  margin: 10px 0;
}

.post-image {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 14px;
  background: #050816;
  margin-top: 10px;
}

.post-header {
  margin-bottom: 8px;
}

.avatar {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.post-actions {
  margin-top: 10px;
}

.quoted-post img {
  width: 70px;
  height: 50px;
}

.comments-list {
  margin-top: 12px;
}

.comment-item {
  background: rgba(255,255,255,0.07);
  padding: 10px 12px;
  border-radius: 14px;
  margin-top: 8px;
}

.comment-item strong {
  font-size: 13px;
}

.comment-item p {
  margin: 5px 0 0;
  color: #e5e7eb;
}

.comment-input-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.comment-input-box input {
  flex: 1;
  border: none;
  outline: none;
  border-radius: 14px;
  background: #0f172a;
  color: white;
  padding: 12px;
}

.comment-input-box button {
  border: none;
  border-radius: 14px;
  background: #3b82f6;
  color: white;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}
.comment-counter{

    display:inline-flex;
    align-items:center;
    gap:6px;

    padding:8px 14px;

    border-radius:20px;

    background:#23263b;

    color:#d7d9ff;

    font-size:13px;

    font-weight:600;
}

.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: transparent;
  padding: 6px 0;
}

.comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.comment-content {
  background: rgba(255,255,255,0.08);
  padding: 9px 12px;
  border-radius: 14px;
  flex: 1;
}

.comment-content strong {
  font-size: 13px;
}

.comment-content p {
  margin: 4px 0;
}

.comment-content span {
  color: #94a3b8;
  font-size: 11px;
}

/* ================= COMMENTS ================= */

.comments-list{
    margin-top:14px;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.comment-item{
    display:flex;
    align-items:flex-start;
    gap:10px;
}

.comment-avatar{

    width:34px;
    height:34px;

    border-radius:50%;

    background:linear-gradient(135deg,#8b5cf6,#3b82f6);

    display:flex;
    justify-content:center;
    align-items:center;

    font-weight:700;
    color:white;

    flex-shrink:0;
}

.comment-content{

    flex:1;

    background: rgba(255,255,255,.06);
backdrop-filter: blur(18px);
border:1px solid rgba(255,255,255,.08);
box-shadow:0 8px 30px rgba(0,0,0,.25);

    border-radius:16px;

    padding:10px 14px;

}

.comment-content strong{

    display:block;

    color:#ffffff;

    font-size:14px;

    margin-bottom:4px;

}

.comment-content p{

    margin:0;

    color:#e5e7eb;

    line-height:1.5;

    word-break:break-word;

}

.comment-content span{

    display:block;

    margin-top:8px;

    color:#9ca3af;

    font-size:11px;

}

.comment-input-box{

    display:flex;

    gap:10px;

    margin-top:14px;

}

.comment-input{

    flex:1;

    background:#181d35;

    border:none;

    border-radius:30px;

    padding:12px 18px;

    color:white;

    outline:none;

}

.comment-input::placeholder{

    color:#8b8ea5;

}

.comment-input-box button{

    border:none;

    border-radius:25px;

    padding:12px 22px;

    cursor:pointer;

    color:white;

    font-weight:600;

    background:linear-gradient(135deg,#6366f1,#3b82f6);

    transition:.25s;

}

.comment-input-box button:hover{

    transform:translateY(-2px);

}

.comment-actions {
  margin-top: 6px;
}

.comment-actions button {
  border: none;
  background: transparent;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.comment-actions button:hover {
  text-decoration: underline;
}

.comment-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: #23263b;
  color: #d7d9ff;
  font-size: 13px;
  font-weight: 600;
}

.notifications-box {
  margin: 14px 0;
  position: relative;
}

.notifications-btn {
  border: none;
  border-radius: 18px;
  padding: 12px 18px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.notifications-btn span {
  background: #ef4444;
  padding: 3px 8px;
  border-radius: 20px;
  margin-left: 8px;
  font-size: 12px;
}

.notifications-panel {
  margin-top: 10px;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 12px;
}

.notification-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  color: #e5e7eb;
}

.notification-item.unread {
  background: rgba(59,130,246,0.16);
}

.notification-item p {
  margin: 0;
}

.hidden {
  display: none;
}

.community-search {
  margin: 14px 0 18px;
}

.community-search input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.12);
  outline: none;
  border-radius: 22px;
  padding: 15px 18px;
  background: rgba(255,255,255,.07);
  color: white;
  font-size: 15px;
}

.community-search input::placeholder {
  color: #94a3b8;
}

.post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.post-author-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.post-delete-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  cursor: pointer;
  opacity: 0.7;
  transition: 0.2s ease;
}

.post-delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.comment-delete-btn {
  border: none;
  border-radius: 10px;
  padding: 7px 10px;
  background: transparent;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.65;
  transition: 0.2s ease;
}

.comment-delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.12);
}

.avatar,
.comment-avatar {
  overflow: hidden;
}

.avatar-image,
.comment-avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar span,
.comment-avatar span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.post-author-info {
  min-width: 0;
}

.post-author-info strong {
  display: block;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.3;
}

.post-author-info p {
  margin: 4px 0 0;
  color: #dbeafe;
  font-size: 14px;
}

.post-author-info small {
  display: block;
  margin-top: 5px;
  color: #94a3b8;
  font-size: 12px;
}

.comment-author-meta {
  display: block;
  margin-top: 3px;
  color: #94a3b8;
  font-size: 11px;
}

.comment-content > p {
  margin-top: 8px;
}

body.modal-open {
  overflow: hidden;
}

.clickable-profile {
  cursor: pointer;
}

.post-author-area.clickable-profile {
  border-radius: 16px;
  padding: 5px 8px 5px 4px;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.post-author-area.clickable-profile:hover {
  background: rgba(139, 92, 246, 0.08);
  transform: translateY(-1px);
}

.comment-author-name.clickable-profile:hover {
  color: #a78bfa;
  text-decoration: underline;
}

.public-profile-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 3, 12, 0.82);
  backdrop-filter: blur(14px);
}

.public-profile-card {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 30px;
  padding: 34px;
  background:
    radial-gradient(
      circle at top right,
      rgba(124, 58, 237, 0.2),
      transparent 35%
    ),
    linear-gradient(
      145deg,
      #18182b,
      #0e1222
    );
  box-shadow:
    0 35px 100px rgba(0, 0, 0, 0.6);
}

.public-profile-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 14px;
  color: #fca5a5;
  font-size: 22px;
  background: rgba(239, 68, 68, 0.1);
  transition: 0.2s ease;
}

.public-profile-close:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: rotate(4deg);
}

.public-profile-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-right: 48px;
}

.public-profile-avatar {
  width: 104px;
  height: 104px;
  flex: 0 0 104px;
  overflow: hidden;
  border: 3px solid rgba(139, 92, 246, 0.6);
  border-radius: 32px;
  background:
    linear-gradient(
      135deg,
      #7c3aed,
      #3b82f6
    );
  box-shadow:
    0 16px 40px rgba(99, 102, 241, 0.28);
}

.public-profile-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.public-profile-avatar > span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 40px;
  font-weight: 900;
}

.public-profile-loading {
  font-size: 18px !important;
}

.public-profile-identity {
  min-width: 0;
}

.public-profile-identity h2 {
  margin: 0 0 7px;
  color: white;
  font-size: 32px;
}

.public-profile-identity p {
  margin: 0 0 6px;
  color: #c4b5fd;
  font-weight: 800;
}

.public-profile-identity small {
  color: #94a3b8;
}

.public-profile-bio-box {
  margin-top: 26px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  padding: 18px;
  background: rgba(9, 14, 31, 0.55);
}

.public-profile-bio-box strong {
  color: #bfdbfe;
}

.public-profile-bio-box p {
  margin: 10px 0 0;
  color: #d1d5db;
  line-height: 1.7;
  white-space: pre-wrap;
}

.public-profile-info-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.public-profile-info-item {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 18px;
  padding: 16px;
  background: rgba(9, 14, 31, 0.52);
}

.public-profile-info-item strong {
  color: #bfdbfe;
  font-size: 13px;
}

.public-profile-info-item span {
  color: white;
}

.public-profile-stats {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.public-profile-stats article {
  display: grid;
  place-items: center;
  min-height: 100px;
  border: 1px solid rgba(148, 163, 184, 0.17);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  background: rgba(9, 14, 31, 0.58);
}

.public-profile-stats strong {
  color: white;
  font-size: 28px;
}

.public-profile-stats span {
  color: #bfdbfe;
  font-size: 13px;
}

@media (max-width: 620px) {
  .public-profile-card {
    padding: 26px 20px;
  }

  .public-profile-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .public-profile-info-grid,
  .public-profile-stats {
    grid-template-columns: 1fr;
  }

  .public-profile-avatar {
    width: 90px;
    height: 90px;
    flex-basis: 90px;
  }
}

.public-profile-modal.hidden {
  display: none !important;
}

.public-profile-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: grid;
  place-items: center;

  width: 100%;
  height: 100dvh;
  padding: 20px;

  overflow: hidden;

  background: rgba(2, 3, 12, 0.82);
  backdrop-filter: blur(14px);
}

.public-profile-card {
  width: min(680px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

body.modal-open {
  overflow: hidden !important;
}

/* ==================================================
   CORRECTION STRUCTURE COMMUNITY
================================================== */

.hidden {
  display: none !important;
}

.community-page {
  width: min(940px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 140px;
}

.community-top {
  display: block;
  margin-bottom: 26px;
}

.community-navigation {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.community-top h1 {
  margin: 0 0 5px;
}

.community-top p {
  margin: 0;
}

.community-search {
  width: 100%;
  margin-bottom: 18px;
}

.community-search input {
  width: 100%;
}

.notifications-box {
  display: block;
  width: 100%;
  margin-bottom: 16px;
}

.notifications-panel {
  width: 100%;
  margin-top: 12px;
}

.posts-list {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 28px !important;

  width: 100%;
  max-height: 610px;
  padding: 0 14px 140px 0;

  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* كل منشور يبقى عمودي */
.post-card {
  display: block !important;
  flex: none !important;

  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;

  padding: 20px !important;
  overflow: visible !important;
}

/* Header المنشور */
.post-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 14px !important;

  width: 100%;
  margin-bottom: 18px;
}

.post-author-area {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 13px !important;

  min-width: 0;
  width: auto;
}

.avatar {
  width: 48px !important;
  height: 48px !important;
  flex: 0 0 48px !important;
}

.post-author-info {
  display: block !important;
  min-width: 0;
}

.post-author-info strong,
.post-author-info p,
.post-author-info small {
  display: block !important;
}

/* محتوى المنشور */
.quoted-post {
  display: block !important;
  width: 100% !important;
  margin: 14px 0 !important;
}

.post-text {
  display: block !important;
  width: 100% !important;
  margin: 16px 0 !important;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.post-image {
  display: block !important;
  width: 100% !important;
  max-height: 520px;
  margin: 15px 0;
  object-fit: contain;
}

/* Actions */
.post-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;

  width: 100%;
  margin: 15px 0;
}

/* التعليقات */
.comments-list {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 14px !important;

  width: 100% !important;
  margin-top: 16px;
}

.comment-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;

  width: 100% !important;
  min-width: 0 !important;
}

.comment-avatar {
  width: 38px !important;
  height: 38px !important;
  flex: 0 0 38px !important;
}

.comment-content {
  display: block !important;
  flex: 1 1 auto !important;

  width: auto !important;
  min-width: 0 !important;
  padding: 13px 15px !important;
}

.comment-content p {
  display: block !important;
  width: 100%;
  overflow-wrap: anywhere;
}

.comment-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Input commentaire */
.comment-input-box {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;

  width: 100% !important;
  margin-top: 18px;
}

.comment-input-box input {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
}

.comment-input-box button {
  flex: 0 0 auto !important;
}

/* Composer fixe */
.composer {
  position: fixed;
  z-index: 9000;
  left: 50%;
  bottom: 18px;

  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;

  width: min(940px, calc(100% - 32px));
  transform: translateX(-50%);
}

.composer textarea {
  flex: 1;
  min-width: 0;
}

/* Modal */
.public-profile-modal.hidden {
  display: none !important;
}

.public-profile-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 20000 !important;

  display: grid;
  place-items: center;

  width: 100vw;
  height: 100dvh;
  padding: 20px;

  overflow: hidden;
}

.public-profile-card {
  width: min(680px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

body.modal-open {
  overflow: hidden !important;
}

/* Mobile */
@media (max-width: 680px) {
  .community-page {
    width: min(100% - 20px, 940px);
  }

  .posts-list {
    padding-right: 4px;
  }

  .post-card {
    padding: 15px !important;
  }

  .comment-input-box {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .comment-input-box button {
    width: 100%;
  }

  .composer {
    width: calc(100% - 20px);
  }
}

.community-search {
  margin-top: 24px;
}

.notifications-box {
  position: relative;
  z-index: 5;
  margin-top: 14px;
  margin-bottom: 18px;
}

.posts-list {
  margin-top: 0;
}

.notifications-btn {
  position: relative;
  z-index: 6;
}

/* =========================================================
   MODÉRATION COMMUNAUTAIRE
========================================================= */
.community-moderation-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 18px;
}

.community-moderation-toolbar button,
.community-report-btn,
.community-block-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 9px 12px;
  color: #dfe5f3;
  background: rgba(255, 255, 255, 0.055);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.community-moderation-toolbar button:hover,
.community-report-btn:hover,
.community-block-btn:hover {
  border-color: rgba(255, 213, 0, 0.4);
  color: #ffd500;
}

.community-report-btn {
  color: #ffbd66;
}

.community-block-btn {
  color: #ff8e9c;
}

.community-moderation-modal.hidden {
  display: none !important;
}

.community-moderation-modal {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.community-moderation-card {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid rgba(255, 213, 0, 0.22);
  border-radius: 24px;
  background: linear-gradient(145deg, #171c2c, #080b14);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.72);
}

.community-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: white;
  background: rgba(255, 255, 255, 0.07);
  font-size: 22px;
  cursor: pointer;
}

.community-modal-icon {
  display: block;
  margin-bottom: 8px;
  font-size: 36px;
}

.community-moderation-card h2 {
  margin: 0 46px 12px 0;
  color: #ffd500;
}

.community-moderation-card p,
.community-moderation-card li {
  color: #c7cddd;
  line-height: 1.65;
}

.community-moderation-card label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: #eef2fa;
  font-weight: 800;
}

.community-moderation-card select,
.community-moderation-card textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  padding: 13px 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
  font: inherit;
}

.community-moderation-card textarea {
  min-height: 120px;
  resize: vertical;
}

.community-rules-check {
  grid-template-columns: auto 1fr !important;
  align-items: start;
  font-weight: 600 !important;
}

.community-rules-check input {
  width: 20px;
  height: 20px;
  accent-color: #ffd500;
}

.community-primary-action,
.community-danger-action {
  width: 100%;
  margin-top: 20px;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.community-primary-action {
  color: #12100a;
  background: linear-gradient(135deg, #ffd500, #ffb800);
}

.community-danger-action {
  color: white;
  background: linear-gradient(135deg, #ef4444, #be123c);
}

.community-primary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.blocked-users-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.blocked-user-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.blocked-user-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 50%;
  color: #14110a;
  background: #ffd500;
  font-weight: 900;
}

.blocked-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blocked-user-row button {
  border: 1px solid rgba(255, 213, 0, 0.35);
  border-radius: 10px;
  padding: 8px 11px;
  color: #ffd500;
  background: rgba(255, 213, 0, 0.08);
  cursor: pointer;
}

.community-empty-state {
  padding: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  text-align: center;
}

@media (max-width: 680px) {
  .community-moderation-card {
    padding: 22px 16px;
  }

  .post-actions,
  .comment-actions {
    flex-wrap: wrap;
  }

  .community-report-btn,
  .community-block-btn {
    flex: 1 1 auto;
  }
}

.public-profile-moderation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.public-profile-moderation-actions button {
  flex: 1 1 220px;
}

/* PCR COMMUNITY MOBILE FIX START */

@media screen and (max-width: 768px) {
  html,
  body.pcr-community-page {
    width: 100% !important;
    max-width: 100% !important;

    overflow-x: hidden !important;

    background: #030611 !important;
  }

  body.pcr-community-page {
    margin: 0 !important;
    padding: 0 !important;
  }

  body.pcr-community-page
  .community-container {
    width: 100% !important;
    max-width: none !important;

    height: auto !important;
    min-height: 100dvh !important;

    margin: 0 !important;

    padding:
      18px
      14px
      calc(
        38px +
        env(safe-area-inset-bottom)
      )
      !important;

    display: block !important;
  }

  body.pcr-community-page
  .community-container h1 {
    max-width:
      calc(100% - 62px) !important;

    margin:
      20px
      0
      8px
      !important;

    font-size:
      clamp(
        32px,
        9vw,
        42px
      )
      !important;

    line-height: 1.05 !important;
    letter-spacing: -1px !important;
  }

  body.pcr-community-page
  .community-container
  > p {
    margin:
      0
      0
      28px
      !important;

    font-size: 18px !important;
    line-height: 1.45 !important;

    color: #c5cadb !important;
  }

  body.pcr-community-page
  #communitySearch {
    width: 100% !important;

    min-height: 56px !important;

    margin:
      0
      0
      18px
      !important;

    padding:
      0
      17px
      !important;

    border-radius: 20px !important;

    font-size: 16px !important;
  }

  body.pcr-community-page
  #notificationsBtn {
    min-height: 48px !important;

    margin:
      14px
      0
      18px
      !important;

    padding:
      10px
      16px
      !important;

    font-size: 15px !important;
  }

  /*
    Suppression du petit scroll intérieur.
    Toute la page défile normalement.
  */

  body.pcr-community-page
  #postsList {
    width: 100% !important;

    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    flex: none !important;

    margin:
      16px
      0
      14px
      !important;

    padding: 0 !important;

    overflow: visible !important;

    scroll-behavior: auto !important;
  }

  body.pcr-community-page
  #postsList
  .post-card {
    width: 100% !important;
    max-width: none !important;

    margin:
      0
      0
      14px
      !important;

    padding: 16px !important;

    border-radius: 22px !important;

    overflow: hidden !important;
  }

  body.pcr-community-page
  .post-header {
    align-items: center !important;
    gap: 11px !important;
  }

  body.pcr-community-page
  .post-actions {
    display: flex !important;
    flex-wrap: wrap !important;

    align-items: center !important;

    gap: 8px !important;

    margin-top: 14px !important;
  }

  body.pcr-community-page
  .post-actions button,
  body.pcr-community-page
  .post-actions span {
    min-height: 40px !important;

    padding:
      8px
      11px
      !important;

    font-size: 14px !important;
  }

  body.pcr-community-page
  .comment-input-box {
    display: grid !important;

    grid-template-columns:
      minmax(0, 1fr)
      !important;

    gap: 10px !important;

    margin-top: 16px !important;
  }

  body.pcr-community-page
  .comment-input-box
  .comment-input {
    width: 100% !important;
    min-width: 0 !important;

    min-height: 50px !important;

    padding:
      12px
      15px
      !important;

    border-radius: 17px !important;

    font-size: 16px !important;
  }

  body.pcr-community-page
  .comment-input-box
  button {
    width: 100% !important;

    min-height: 50px !important;

    border-radius: 17px !important;

    font-size: 16px !important;
  }

  /*
    Composer propre et compact.
  */

  body.pcr-community-page
  .composer {
    position: sticky !important;

    left: auto !important;
    right: auto !important;
    bottom:
      calc(
        8px +
        env(safe-area-inset-bottom)
      )
      !important;

    transform: none !important;

    width: 100% !important;
    max-width: none !important;

    min-height: 78px !important;

    margin:
      16px
      0
      8px
      !important;

    padding: 11px !important;

    display: grid !important;

    grid-template-columns:
      minmax(0, 1fr)
      52px
      98px
      !important;

    align-items: center !important;
    gap: 8px !important;

    border-radius: 22px !important;

    background:
      rgba(10, 16, 32, 0.97)
      !important;

    box-shadow:
      0 14px 40px
      rgba(0, 0, 0, 0.42)
      !important;

    z-index: 9000 !important;
  }

  body.pcr-community-page
  .composer-preview,
  body.pcr-community-page
  .reply-preview {
    grid-column:
      1 / -1
      !important;

    width: 100% !important;

    margin-bottom: 4px !important;
  }

  body.pcr-community-page
  #postText {
    width: 100% !important;
    min-width: 0 !important;

    min-height: 56px !important;
    max-height: 130px !important;

    padding:
      12px
      14px
      !important;

    border-radius: 18px !important;

    font-size: 16px !important;
    line-height: 1.35 !important;

    resize: none !important;
  }

  body.pcr-community-page
  .composer label,
  body.pcr-community-page
  .composer
  .image-button,
  body.pcr-community-page
  .composer
  .camera-button {
    width: 52px !important;
    height: 52px !important;

    min-width: 52px !important;

    display: grid !important;
    place-items: center !important;

    margin: 0 !important;
    padding: 0 !important;

    border-radius: 18px !important;

    font-size: 21px !important;
  }

  body.pcr-community-page
  #publishBtn {
    width: 98px !important;
    min-width: 0 !important;

    height: 52px !important;

    margin: 0 !important;
    padding:
      0
      10px
      !important;

    border-radius: 18px !important;

    font-size: 14px !important;
    font-weight: 850 !important;
  }

  /*
    Dans la Communauté, le bouton menu passe en haut.
    Il ne couvre plus le composer.
  */

  body.pcr-community-page
  #pcr-mobile-menu-button {
    top:
      calc(
        14px +
        env(safe-area-inset-top)
      )
      !important;

    right: 14px !important;

    bottom: auto !important;

    width: 50px !important;
    height: 50px !important;

    border-radius: 17px !important;

    font-size: 22px !important;
  }
}

@media screen and (max-width: 380px) {
  body.pcr-community-page
  .composer {
    grid-template-columns:
      minmax(0, 1fr)
      48px
      82px
      !important;

    gap: 6px !important;
  }

  body.pcr-community-page
  .composer label,
  body.pcr-community-page
  .composer
  .image-button,
  body.pcr-community-page
  .composer
  .camera-button {
    width: 48px !important;
    height: 48px !important;

    min-width: 48px !important;
  }

  body.pcr-community-page
  #publishBtn {
    width: 82px !important;
    height: 48px !important;

    padding:
      0
      7px
      !important;

    font-size: 13px !important;
  }
}

/* PCR COMMUNITY MOBILE FIX END */

/* PCR CAPACITOR COMMUNITY FIX START */
html.pcr-native-app body.pcr-community-page #postsList {
  scroll-behavior: auto !important;
}

html.pcr-native-app body.pcr-community-page #postText {
  font-size: 16px !important;
}

html.pcr-native-app body.pcr-community-page.pcr-native-keyboard-open {
  overflow-x: hidden !important;
}

html.pcr-native-app body.pcr-community-page.pcr-native-keyboard-open #postsList {
  padding-bottom: 190px !important;
}

html.pcr-native-app body.pcr-community-page.pcr-native-keyboard-open .composer {
  position: fixed !important;
  left: 10px !important;
  right: 10px !important;
  bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  transform: none !important;
  z-index: 100000 !important;
  background: rgba(8, 13, 29, 0.98) !important;
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.75) !important;
}
/* PCR CAPACITOR COMMUNITY FIX END */
