/* ===== Community Page Base ===== */
.community-page .card,
.card {
  border-radius: 16px;
}

.community-page h2 {
  font-weight: 700;
}

/* ===== Tabs (Kanal / Suhbat) ===== */
.community-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.community-tabs .btn {
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-outline {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #0f172a;
}

.btn-outline:hover {
  background: #f8fafc;
}

/* Kanal / Suhbat üst satırı (ikon + buton) */
.channel-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.channel-switch .channel-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #0f172a;
  min-width: 110px; /* "Kanal" hizası */
}

.channel-switch .channel-label i {
  font-size: 16px;
}

.channel-switch .channel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Join butonu joined durumu */
.btn-join.is-joined {
  background: #16a34a !important;
  border-color: #16a34a !important;
  color: #fff !important;
}

/* Chat butonu disabled */
.js-community-chat.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ===== Chat Container ===== */
.chat-wrap {
  padding: 8px 6px;
}

#chatBox {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px;
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
}

/* Scrollbar (Chrome) */
#chatBox::-webkit-scrollbar {
  width: 10px;
}
#chatBox::-webkit-scrollbar-thumb {
  background: #dbeafe;
  border-radius: 99px;
}
#chatBox::-webkit-scrollbar-track {
  background: transparent;
}

.chat-empty {
  padding: 14px;
  color: #94a3b8;
}

.chat-error {
  padding: 14px;
  color: #ef4444;
}

/* ===== Chat Rows (community.js ile uyumlu) ===== */
.chat-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin: 10px 0;
}

.chat-avatar-wrap {
  width: 42px;
  flex: 0 0 42px;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
}

.chat-bubble {
  max-width: 76%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.chat-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
  color: #334155;
  font-size: 13px;
}

.chat-name {
  font-weight: 700;
  color: #0f172a;
}

.chat-time {
  color: #94a3b8;
  font-size: 12px;
}

.chat-text {
  color: #0f172a;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Own Message (Sağa) ===== */
.chat-row.is-me {
  justify-content: flex-end;
}

.chat-row.is-me .chat-avatar-wrap {
  order: 2;
}

.chat-row.is-me .chat-bubble {
  order: 1;
  background: #2563eb;
  border-color: #2563eb;
}

.chat-row.is-me .chat-text,
.chat-row.is-me .chat-meta,
.chat-row.is-me .chat-name,
.chat-row.is-me .chat-time {
  color: #fff;
}

.chat-row.is-me .chat-time {
  opacity: 0.85;
}

/* ===== Chat Form ===== */
#chatForm {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: flex-end;
}

#chatMessage {
  flex: 1;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
  min-height: 48px;
  max-height: 160px;
  resize: vertical;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

#chatMessage:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

#chatSendBtn {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  white-space: nowrap;
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .chat-bubble {
    max-width: 86%;
  }

  #chatForm {
    flex-direction: column;
    align-items: stretch;
  }

  #chatSendBtn {
    width: 100%;
  }
}
.channel-actions { display:flex; gap:10px; flex-wrap:wrap; }
.channel-actions .btn { border-radius:999px; }

.js-community-chat.is-disabled {
  opacity: .45;
  pointer-events: none;
  cursor: not-allowed;
}

/* =========================================================
   EKLEMELER (Dosyanın en altına ekle)
   Post UI + Leave butonu kırmızı + küçük iyileştirmeler
   ========================================================= */

/* ----- Join/Leave butonu kırmızı (member ise) ----- */
/* community.php butonda: .js-community-join + data-is-member */
.js-community-join[data-is-member="1"],
#btnCommunityJoinToggle.is-joined {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}

.js-community-join[data-is-member="1"]:hover,
#btnCommunityJoinToggle.is-joined:hover {
  filter: brightness(0.96);
}

.js-community-join[data-is-member="1"]:active,
#btnCommunityJoinToggle.is-joined:active {
  transform: translateY(1px);
}

/* Eğer ileride "join" yeşil olsun istersen bu kısmı açarsın:
.js-community-join[data-is-member="0"]{
  background: #2563eb !important;
  border-color: #2563eb !important;
  color:#fff !important;
}
*/

/* ----- Kanal (Post) Create Form ----- */
#communityPostForm .input,
#communityPostTitle,
#communityPostText {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 12px 12px;
  font-size: 14px;
  outline: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

#communityPostTitle {
  min-height: 44px;
}

#communityPostText {
  min-height: 110px;
  max-height: 260px;
  resize: vertical;
}

#communityPostTitle:focus,
#communityPostText:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Create post butonu */
#btnCommunityPostSend {
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  white-space: nowrap;
}

/* Post list container */
#communityPostsBox {
  margin-top: 12px;
}

/* ----- Post kartları (community.js .post-item) ----- */
.post-item {
  padding: 14px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
  margin-bottom: 12px !important;
}

.post-item .post-title {
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.post-item .post-text {
  color: #0f172a;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Post meta (tarih) */
.post-item .post-meta,
.post-item div[style*="font-size:12px"] {
  margin-top: 10px;
  color: #94a3b8;
  font-size: 12px;
}

/* Post kartındaki küçük edit/delete butonları (admin) */
.post-item .btn {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}

/* ----- Mobil iyileştirme: Kanal form butonu full ----- */
@media (max-width: 640px) {
  #btnCommunityPostSend {
    width: 100%;
  }

  /* Kanal/Suhbat butonlarını da tam hizala */
  .channel-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* =========================
   EXTRA UI FIXES (append)
   ========================= */

/* linkler altı çizili görünmesin */
.channel-actions .btn,
.channel-actions a.btn {
  text-decoration: none !important;
}

/* Kanal/Suhbat sekmeleri: outline olan daha “buton” gibi dursun */
.channel-actions .btn {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
}
.channel-actions .btn-outline {
  background: #ffffff;
  color: #0f172a;
}
.channel-actions .btn-outline:hover {
  background: #f8fafc;
}

/* Aktif olmayan sekme “sönük” değil, dengeli gözüksün */
.channel-actions .btn-outline i {
  opacity: .85;
}

/* Join/Leave: üyeyken (çıkış) KIRMIZI olsun */
.js-community-join.is-joined,
#btnCommunityJoinToggle.is-joined {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}
.js-community-join.is-joined:hover,
#btnCommunityJoinToggle.is-joined:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

/* Post kartları daha modern */
.post-item {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
.post-item .post-title {
  font-size: 15px;
}
.post-item .post-text {
  font-size: 14px;
}

/* Edit/Delete butonları: küçük, modern, chat balonunu bozmasın */
.chat-actions,
.post-item .chat-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.btn-mini {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.btn-mini:hover {
  background: #f8fafc;
}
.btn-mini:active {
  transform: translateY(1px);
}

/* Delete mini buton: kırmızı vurgu */
.btn-mini.is-danger {
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}
.btn-mini.is-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* Chat balon üst meta satırında butonlar taşmasın */
.chat-meta {
  align-items: center;
}
.chat-meta > div:first-child {
  min-width: 0;
}

/* Kendi mesajında mini butonlar beyaz görünsün */
.chat-row.is-me .btn-mini {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}
.chat-row.is-me .btn-mini:hover {
  background: rgba(255,255,255,0.18);
}
.chat-row.is-me .btn-mini.is-danger {
  border-color: rgba(255,255,255,0.30);
  color: #fff;
}

/* ===== Custom Modal (JS ile açılacak) ===== */
.yh-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.yh-modal {
  width: min(520px, 100%);
  background: #0b1220;
  color: #e5e7eb;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 30px 70px rgba(0,0,0,0.35);
  overflow: hidden;
}

.yh-modal-header {
  padding: 14px 16px 10px 16px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.yh-modal-body {
  padding: 0 16px 14px 16px;
}

.yh-modal-input,
.yh-modal-textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.35);
  color: #e5e7eb;
  padding: 12px 12px;
  outline: none;
  box-sizing: border-box;
}

.yh-modal-textarea {
  min-height: 120px;
  resize: vertical;
}

.yh-modal-input:focus,
.yh-modal-textarea:focus {
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.18);
}

.yh-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px 16px 16px;
}

.yh-modal-btn {
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.10);
  color: #e5e7eb;
  cursor: pointer;
}
.yh-modal-btn:hover {
  background: rgba(148, 163, 184, 0.16);
}

.yh-modal-btn.primary {
  background: linear-gradient(135deg, rgba(168,85,247,0.95), rgba(59,130,246,0.92));
  border-color: transparent;
  color: #fff;
}
.yh-modal-btn.primary:hover {
  filter: brightness(1.03);
}

.yh-modal-btn.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}
.yh-modal-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18);
}
/* ===== FIX: Kanal / Suhbat tab görünümü (pill) ===== */
.channel-switch{
  padding: 10px 12px;           /* eski 14px yerine daha sıkı */
}

.channel-actions{
  width: 100%;
  justify-content: center;      /* ortala */
  gap: 12px;
}

.channel-actions .btn{
  border-radius: 999px;
  min-height: 44px;
  padding: 12px 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  line-height: 1;
}

/* Inactive (btn-outline) daha düzgün “chip” dursun */
.channel-actions .btn.btn-outline{
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #0f172a;
  box-shadow: 0 6px 18px rgba(15,23,42,.04);
}

/* Active (btn-primary) zaten güzel — biraz daha premium */
.channel-actions .btn.btn-primary{
  box-shadow: 0 12px 28px rgba(37,99,235,.18);
}

/* Mobilde iki buton eşit genişlikte olsun */
@media (max-width: 640px){
  .channel-actions{
    gap: 10px;
  }
  .channel-actions .btn{
    flex: 1;
    min-width: 0;
  }
}
/* ===== FIX: Mobilde chat gönder butonu yarım kalmasın ===== */
@media (max-width: 640px) {
  #chatForm{
    width: 100%;
  }

  #chatMessage{
    width: 100%;
    box-sizing: border-box;
  }

  #chatSendBtn{
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
  }
}