/* Posts Management specific styles */
/* Scope all styles under #createPostModal to avoid collision */

#createPostModal.modal-overlay {
  /* Full-screen overlay for posts modal only */
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10050 !important;
  display: none; /* shown via inline style or .show class */
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  backdrop-filter: blur(4px);
  pointer-events: all !important;
}

#createPostModal.modal-overlay.show {
  display: flex;
}

#createPostModal .modal {
  background: #1e2228;
  border-radius: 8px;
  width: 100%;
  max-width: 1120px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  margin: auto;
  border: 1px solid #333;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#createPostModal .modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #23272f;
}

#createPostModal .modal-body {
  padding: 24px;
  overflow-y: auto;
  color: #fff;
}

.post-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.post-form-column,
.post-preview-column {
  min-width: 0;
}

.post-preview-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
}

.post-side-panel {
  background: #171b21;
  border: 1px solid #313844;
  border-radius: 8px;
  padding: 14px;
}

.post-side-panel__header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d8dee9;
  font-weight: 700;
  margin-bottom: 10px;
}

.post-media-preview-panel {
  min-height: 88px;
}

.selected-post-bot-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #202630;
  border: 1px solid #3a4452;
  border-radius: 8px;
  padding: 12px;
  min-height: 94px;
}

.selected-post-bot-card--empty {
  align-items: center;
  color: #aeb7c5;
}

.selected-post-bot-card > img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}

.selected-post-bot-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #303846;
  color: #d8dee9;
  flex: 0 0 auto;
}

.selected-post-bot-card__body {
  min-width: 0;
  flex: 1;
}

.selected-post-bot-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.selected-post-bot-card strong {
  color: #fff;
}

.selected-post-bot-card span,
.selected-post-bot-card p {
  display: block;
  color: #aeb7c5;
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
}

.selected-post-bot-card p {
  margin-top: 6px;
}

.post-panel-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.post-panel-badge--bot { background: #26365f; color: #bcd3ff; border-color: #3a5fa8; }
.post-panel-badge--user { background: #1f3d35; color: #a6f4d0; border-color: #2b8069; }
.post-panel-badge--private { background: #4b2f33; color: #ffc9d2; border-color: #9b4d5c; }
.post-panel-badge--public { background: #263f33; color: #bdf5d0; border-color: #459263; }
.post-panel-badge--admin { background: #463a22; color: #ffe0a3; border-color: #9c7a31; }
.post-panel-badge--muted { background: #2c323c; color: #c4ccd8; border-color: #4a5361; }

.post-author-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-author-cell span {
  color: #fff;
  font-weight: 600;
}

.post-author-cell small {
  color: #aeb7c5;
  font-size: 11px;
}

/* Bot selection row */
#createPostModal #postBotUserId {
  max-width: 160px;
}

/* Media preview tweaks */
#createPostModal #selectedMediaPreview .media-preview-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Bot picker overlay (scoped) */
#botPickerOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 10100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#botPickerOverlay.show { display: flex; }

/* Status pool overlay */
#statusPoolOverlay{ position:fixed; inset:0; background:rgba(0,0,0,0.75); z-index:10100; display:none; align-items:center; justify-content:center; padding:20px; }
#statusPoolOverlay.show{ display:flex; }
#statusPoolModal{ background:#1e2228; border:1px solid #333; border-radius:12px; width:90vw; max-width:900px; max-height:80vh; display:flex; flex-direction:column; overflow:hidden; min-height:0; }
#statusPoolHeader{ padding:12px 16px; border-bottom:1px solid #333; display:flex; gap:10px; align-items:center; justify-content:space-between; flex:0 0 auto; }
#statusPoolBody{ padding:12px 16px; overflow-y:auto; flex:1; min-height:0; }
#statusPoolBody textarea{ width:100%; min-height:220px; background:#2a2a2a; border:1px solid #444; border-radius:8px; color:#fff; padding:10px; }
#statusPoolFooter{ padding:12px 16px; border-top:1px solid #333; display:flex; gap:10px; justify-content:flex-end; flex:0 0 auto; }
.status-help{ color:#b0b3b8; font-size:12px; margin-bottom:8px; }

/* Status pool tabs and list */
#statusPoolHeader .statusPoolTabs{ display:flex; gap:8px; margin-left:auto; margin-right:12px; }
#statusPoolHeader .statusPoolTabs .tab-btn{ background:#2a2e35; border:1px solid #3a3f47; color:#cfd3da; padding:6px 10px; border-radius:6px; cursor:pointer; }
#statusPoolHeader .statusPoolTabs .tab-btn.active{ background:#3a3f47; color:#fff; border-color:#565c66; }

#statusPoolListPanel{ display:flex; flex-direction:column; min-height:0; }
#statusPoolListPanel .status-filters{ display:flex; gap:10px; align-items:center; margin-bottom:10px; }
#statusPoolListPanel .status-filters input[type="text"]{ flex:1; padding:8px; background:#2a2a2a; border:1px solid #444; border-radius:6px; color:#fff; }
#statusPoolList{ background:#1b1f24; border:1px solid #2b2f36; border-radius:8px; padding:8px; flex:1; min-height:0; overflow:auto; }
#statusPoolList .status-table{ width:100%; border-collapse: collapse; }
#statusPoolList .status-table th, #statusPoolList .status-table td{ border-bottom:1px solid #2b2f36; padding:10px; text-align:left; font-size:14px; color:#e5e7eb; }
#statusPoolList .status-table thead th{ color:#9ca3af; font-weight:600; }
#statusPoolList .tag{ display:inline-block; background:#2a2e35; color:#cfd3da; padding:2px 6px; border-radius:6px; margin:0 4px 4px 0; font-size:12px; }
#botPickerModal {
  background: #1e2228;
  border: 1px solid #333;
  border-radius: 8px;
  width: 90vw;
  max-width: 1040px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#botPickerHeader { padding: 12px 16px; border-bottom: 1px solid #333; display:flex; gap:12px; align-items:center; }
#botPickerHeader > div { display:flex; flex-direction:column; gap:2px; min-width:180px; color:#fff; }
#botPickerHeader > div span { color:#9ca3af; font-size:12px; font-weight:400; }
#botPickerHeader input { flex:1; padding: 10px 12px; background:#2a2a2a; border:1px solid #444; border-radius:6px; color:#fff; }
#botPickerBody { padding: 12px 16px; overflow-y:auto; }
.bot-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap:12px; }
.bot-card-pick { background:#23272f; border:1px solid #343b47; border-radius:8px; padding:12px; display:grid; grid-template-columns:64px minmax(0,1fr); gap:12px; position:relative; }
.bot-card-pick__avatar { width:64px; height:64px; border-radius:8px; object-fit:cover; }
.bot-card-pick__content { min-width:0; }
.bot-card-pick__header { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:4px; }
.bot-card-pick__header strong { color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bot-card-pick__meta { color:#aeb7c5; font-size:12px; display:block; margin-bottom:6px; }
.bot-card-pick p { color:#c8d0dc; font-size:12px; line-height:1.35; margin:0 0 8px 0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.bot-card-pick__thumbs { display:flex; gap:5px; margin-top:8px; }
.bot-card-pick__thumbs img { width:34px; height:34px; border-radius:6px; object-fit:cover; border:1px solid #404958; }
.bot-card-pick__select { grid-column:1 / -1; justify-content:center; }

.post-comments-overlay {
  z-index: 10000;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.72);
}

.post-comments-modal {
  background:#1e2228;
  border:1px solid #333;
  border-radius:8px;
  max-width:1040px;
  width:92vw;
  max-height:88vh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  color:#fff;
}

.post-comments-modal__header,
.post-comments-toolbar {
  padding:14px 18px;
  border-bottom:1px solid #313844;
}

.post-comments-modal__header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#23272f;
}

.post-comments-modal__header h3 {
  margin:0;
  display:flex;
  align-items:center;
  gap:8px;
}

.post-comments-modal__header span,
.post-comments-summary p {
  color:#aeb7c5;
  font-size:13px;
}

.post-comments-summary {
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:14px 18px;
  border-bottom:1px solid #313844;
  background:#171b21;
}

.post-comments-summary__main {
  min-width:0;
}

.post-comments-summary__main strong {
  display:block;
  color:#fff;
  margin-bottom:4px;
}

.post-comments-summary__main p {
  margin:0;
  line-height:1.45;
}

.post-comments-summary__meta {
  display:flex;
  align-items:center;
  gap:8px;
  color:#c8d0dc;
  white-space:nowrap;
}

.post-comments-compose {
  padding:14px 18px;
  border-bottom:1px solid #313844;
  display:grid;
  grid-template-columns:minmax(220px,320px) minmax(0,1fr) auto;
  gap:12px;
  align-items:end;
}

.post-comments-compose__top {
  grid-column:1 / -1;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.comment-selected-bot-card .selected-post-bot-card {
  min-height:74px;
}

.comment-selected-bot-card .selected-post-bot-card > img {
  width:54px;
  height:54px;
}

.post-comments-compose textarea {
  width:100%;
  min-height:82px;
  resize:vertical;
  background:#171b21;
  border:1px solid #3a4452;
  border-radius:8px;
  color:#fff;
  padding:10px;
  box-sizing:border-box;
}

.post-comment-filters {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.post-comment-filter-btn {
  background:#242b35;
  border:1px solid #3a4452;
  color:#d8dee9;
  border-radius:7px;
  padding:7px 10px;
  cursor:pointer;
}

.post-comment-filter-btn.active {
  background:#315f52;
  border-color:#4f9a84;
  color:#fff;
}

.post-comment-filter-btn span {
  color:#aeb7c5;
  margin-left:4px;
}

.post-comments-list {
  padding:14px 18px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.post-comment-item {
  display:flex;
  gap:12px;
  align-items:flex-start;
  background:#23272f;
  border:1px solid #343b47;
  border-radius:8px;
  padding:12px;
}

.post-comment-item--private {
  border-color:#7a4050;
}

.post-comment-item__avatar {
  width:44px;
  height:44px;
  border-radius:50%;
  object-fit:cover;
  flex:0 0 auto;
}

.post-comment-item__body {
  flex:1;
  min-width:0;
}

.post-comment-item__header {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:6px;
}

.post-comment-item__badges {
  display:flex;
  gap:5px;
  flex-wrap:wrap;
}

.post-comment-item time {
  color:#8f99aa;
  font-size:12px;
  margin-left:auto;
}

.post-comment-item p {
  margin:0;
  color:#d8dee9;
  line-height:1.45;
}

.post-comments-empty {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  color:#8f99aa;
  padding:34px;
}

@media (max-width: 900px) {
  .post-modal-layout,
  .post-comments-compose {
    grid-template-columns: 1fr;
  }

  .post-preview-column {
    position: static;
  }
}

