/* =============================================================================
   CommunityHub — composer.css
   Toolbar (image + emoji) for submit forms and comment textareas
   ============================================================================= */

.ch-composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: var(--reddit-vote-bg, #f6f7f8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.ch-composer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.ch-composer-btn:hover {
  background: var(--reddit-hover, var(--color-border-light));
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.ch-composer-btn:active {
  transform: translateY(1px);
}

.ch-composer-emoji-btn {
  width: 38px;
  padding: 0;
}

.ch-composer-btn .ch-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.ch-composer-status {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: auto;
  min-height: 18px;
}

.ch-composer-bar.is-uploading {
  border-color: var(--color-primary);
}

.ch-composer-bar.is-uploading .ch-composer-status {
  color: var(--color-primary);
  font-weight: 600;
}

/* Drag-over highlight on the textarea */
textarea.is-dragover,
.wp-editor-wrap.is-dragover {
  outline: 2px dashed var(--color-primary);
  outline-offset: -2px;
}

/* =============================================================================
   Emoji picker popover
   ============================================================================= */
.ch-emoji-picker {
  width: 320px;
  max-height: 320px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ch-emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.ch-emoji-tab {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ch-emoji-tab:hover { background: var(--color-border-light); }

.ch-emoji-tab.is-active {
  background: var(--color-primary);
  color: #fff;
}

.ch-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.ch-emoji-cell {
  width: 100%;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.1s ease;
  padding: 0;
}

.ch-emoji-cell:hover {
  background: var(--color-border-light);
  transform: scale(1.15);
}

.ch-emoji-cell:active {
  background: var(--color-primary);
  color: #fff;
}

/* =============================================================================
   Comment login wall (shown to guests instead of the full comment form)
   ============================================================================= */
.ch-comment-login-wall {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-xl);
  background: var(--color-card);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-lg);
}

.ch-comment-login-wall-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border-light);
  border-radius: 50%;
}

.ch-comment-login-wall-body { flex: 1; min-width: 0; }

.ch-comment-login-wall-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.ch-comment-login-wall-text {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.ch-comment-login-wall-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .ch-comment-login-wall { flex-direction: column; text-align: center; align-items: center; }
}

/* =============================================================================
   Inline images inside comment text
   ============================================================================= */
.ch-comment-img {
  margin: 8px 0;
  max-width: 100%;
}

.ch-comment-img img {
  max-width: min(100%, 480px);
  max-height: 360px;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
  background: var(--color-border-light);
  border: 1px solid var(--color-border);
}

.ch-comment-img a:hover img {
  border-color: var(--color-primary);
}

/* Mobile tweaks */
@media (max-width: 480px) {
  .ch-emoji-picker { width: calc(100vw - 32px); max-width: 320px; }
  .ch-emoji-grid { grid-template-columns: repeat(7, 1fr); }
}
