:root {
  --header-bg: url('assets/images/comunidade-header.jpg');
  --header-overlay: rgba(0,0,0,0.50);
  --primary:   #0f3c46;
  --secondary: #1f6f78;
  --bg:        #f2f4f6;
  --danger:    #e74c3c;
  --success:   #27ae60;
}

*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
}

body { background: var(--bg); color: #333; }

/* BARRA DE CONTROLES (filtros + publicar) */
.community-bar {
  background: #fff;
  border-bottom: 1px solid #e8ecee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.community-bar__title {
  font-size: 20px; font-weight: 800;
  color: var(--primary); line-height: 1.1;
}
.community-bar__sub {
  font-size: 12px; color: #9aabb0; margin-top: 2px;
}

.community-bar__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ctrl-select {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid #e0e6e8;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  color: #333;
  background: #fff;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}
.ctrl-select:focus { border-color: var(--secondary); }

.ctrl-btn-publish {
  padding: 9px 18px;
  background: var(--secondary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.12s;
  font-family: 'Poppins', sans-serif;
}
.ctrl-btn-publish:hover { background: var(--primary); transform: translateY(-1px); }

/* LOADING */
.community-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 0;
  color: #9aabb0;
  font-size: 14px;
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid #dde6e8;
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* CONTAINER E GRID */
.community-container {
  max-width: 1080px;
  margin: 28px auto 80px;
  padding: 0 24px;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* Estado vazio */
.empty-community {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #9aabb0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.empty-community span { font-size: 40px; display: block; margin-bottom: 12px; }
.empty-community p    { font-size: 15px; font-weight: 600; color: #555; }
.empty-community small { font-size: 13px; }

/* CARD DA COMUNIDADE */
.c-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border: 1px solid #edf1f2;
  display: flex;
  flex-direction: column;
  animation: cardIn 0.3s ease both;
  transition: transform 0.18s, box-shadow 0.18s;
}
.c-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Capa colorida ── */
/* NOVA CAPA COM GRADIENTE E TAGS FLUTUANTES */
.c-cover {
  height: 65px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  position: relative;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* Estilo para as pequenas pílulas (tags) flutuantes na capa */
.c-cover-tag {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  color: #ffffff;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cor customizada para a tag de idioma */
.c-cover-tag--lang {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cor customizada para o contador de cards */
.c-cover-tag--count {
  background: rgba(15, 60, 70, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: auto;
}

/* ── Corpo do card ── */
.c-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.c-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.c-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.c-author {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 16px;
  transition: background 0.12s;
}
.c-author:hover { background: #f0f7f8; }

.c-author-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6f78, #1a8c6e);
  color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.c-author span:last-child {
  font-size: 11px; color: #888; font-weight: 600;
  max-width: 90px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Republicado */
.c-republished {
  font-size: 11px;
  color: #a0522d;
  background: #fdf8ec;
  border: 1px solid #f0e0b0;
  border-radius: 6px;
  padding: 4px 10px;
}

.c-desc {
  font-size: 13px; color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Ações ── */
.c-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #f0f4f5;
}

.c-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1.5px solid #e0e6e8;
  background: #fff;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.14s;
  font-family: 'Poppins', sans-serif;
}
.c-btn:not([disabled]):hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: #f0fafb;
}
.c-btn[disabled] { opacity: 0.55; cursor: default; }

.c-btn-like.liked {
  background: #fdeaea;
  border-color: var(--danger);
  color: var(--danger);
}
.c-btn-fav.faved {
  background: #fffbea;
  border-color: #f39c12;
  color: #e67e22;
}
.c-btn-import:not([disabled]):hover {
  border-color: var(--success) !important;
  color: var(--success) !important;
  background: #f0faf4 !important;
}
.c-btn-done {
  border-color: var(--success);
  color: var(--success);
  opacity: 1 !important;
}
.c-btn-muted { color: #aaa; cursor: default; }

/* ── Seção de comentários ── */
.c-comments-wrap {
  border-top: 1px solid #f0f4f5;
  padding-top: 12px;
  margin-top: 2px;
}

.c-comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 180px;
  overflow-y: auto;
}
.c-comments-list::-webkit-scrollbar { width: 3px; }
.c-comments-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

.c-comment {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
  flex-wrap: wrap;
}

.c-comment-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  flex-shrink: 0;
}
.c-comment-author:hover b { text-decoration: underline; }

.c-mini-av {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6f78, #1a8c6e);
  color: #fff; font-size: 7px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.c-comment-author b { font-size: 12px; color: var(--primary); }
.c-comment-text  { color: #444; flex: 1; word-break: break-word; }
.c-comment-time  { font-size: 10px; color: #bbb; flex-shrink: 0; }
.c-no-comments   { font-size: 12px; color: #bbb; text-align: center; padding: 4px 0; }

.c-show-more {
  width: 100%;
  background: none;
  border: none;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 4px 0;
  font-family: 'Poppins', sans-serif;
}
.c-show-more:hover { text-decoration: underline; }

.c-comment-input-row {
  display: flex;
  gap: 6px;
}
.c-comment-input {
  flex: 1;
  padding: 7px 12px;
  border: 1.5px solid #e0e6e8;
  border-radius: 16px;
  font-size: 12px;
  outline: none;
  font-family: 'Poppins', sans-serif;
  transition: border-color 0.14s;
}
.c-comment-input:focus { border-color: var(--secondary); }
.c-send-btn {
  width: 32px; height: 32px;
  background: var(--secondary); color: #fff;
  border: none; border-radius: 50%;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.14s;
  font-family: 'Poppins', sans-serif;
}
.c-send-btn:hover { background: var(--primary); }
.c-send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* PAGINAÇÃO */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 32px;
}
.page-btn {
  padding: 8px 18px;
  background: #fff;
  border: 1.5px solid #e0e6e8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.14s;
  font-family: 'Poppins', sans-serif;
}
.page-btn:not([disabled]):hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: #f0fafb;
}
.page-btn[disabled] { opacity: 0.4; cursor: default; }
.page-info { font-size: 13px; color: #9aabb0; }

/* MODAL PUBLICAR */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  justify-content: center; align-items: center;
  z-index: 1000;
}
.modal.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 28px;
  width: 100%; max-width: 460px;
  margin: 0 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  max-height: 90vh; overflow-y: auto;
}
.modal-hd {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.modal-hd h2 { font-size: 18px; font-weight: 700; color: var(--primary); }
.modal-x {
  background: none; border: none;
  font-size: 18px; cursor: pointer; color: #aaa; padding: 4px;
}
.modal-x:hover { color: #333; }
.modal-sub { font-size: 13px; color: #9aabb0; margin-bottom: 16px; }

.publish-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 320px; overflow-y: auto;
}
.pub-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid #edf1f2;
  gap: 12px;
}
.pub-name   { display: block; font-size: 14px; font-weight: 600; color: var(--primary); }
.pub-origin { display: block; font-size: 11px; color: #e67e22; font-style: italic; }
.pub-cards  { display: block; font-size: 12px; color: #9aabb0; }
.pub-btn {
  background: var(--secondary); color: #fff;
  border: none; padding: 8px 16px;
  border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer;
  flex-shrink: 0;
  font-family: 'Poppins', sans-serif;
  transition: background 0.14s;
}
.pub-btn:hover    { background: var(--primary); }
.pub-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.no-data { font-size: 13px; color: #9aabb0; text-align: center; padding: 20px 0; }

/* RESPONSIVO */
@media (max-width: 720px) {
  .deck-grid { grid-template-columns: 1fr; }
  .community-bar { flex-direction: column; align-items: flex-start; }
  .community-bar__controls { width: 100%; }
  .ctrl-select { flex: 1; }
}

/* ── Novas regras para a publicação ── */
.publish-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  width: 55%;
  flex-shrink: 0;
}

.pub-caption-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d1d9dc;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  outline: none;
  background: #fff;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.14s;
}

.pub-caption-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(31,111,120,0.08);
}

/* Contador de chars da legenda */
.pub-caption-footer {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}
.pub-caption-count {
  font-size: 11px;
  color: #b0bec2;
  font-family: 'Poppins', sans-serif;
  transition: color 0.14s;
}
.pub-caption-count.warn { color: #e67e22; }
.pub-caption-count.limit { color: #e74c3c; font-weight: 700; }

.pub-btn:disabled, .pub-btn--disabled {
  background: #cbd4d6;
  color: #889699;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.text-danger {
  color: var(--danger) !important;
  font-weight: 600;
}

.c-btn-danger {
  border-color: #fad4cf !important;
  color: var(--danger) !important;
  background: #fdf0ee !important;
}
.c-btn-danger:hover {
  background: var(--danger) !important;
  color: #fff !important;
  border-color: var(--danger) !important;
}

.delete-preview { padding: 4px 0 8px; }
.delete-preview p { font-size: 14px; color: #555; margin-bottom: 10px; }
.delete-preview blockquote {
  background: #f8f9fa;
  border-left: 3px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px; color: var(--primary); font-weight: 600;
  margin-bottom: 12px;
}
.delete-warning { font-size: 12px; color: var(--danger); }
/* COLLAPSE DE COMENTÁRIOS */

/* Grupo de comentários colapsados */
.c-comments-collapsed {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #edf1f2;
  margin-bottom: 6px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Botão "Ver todos N comentários" */
.c-show-all-btn {
  width: 100%;
  background: none;
  border: none;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 4px 0 6px;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 0.2px;
  transition: color 0.14s;
}
.c-show-all-btn:hover { color: var(--primary); text-decoration: underline; }

/* Garante que c-comments-list mostre como flex para os filhos */
.c-comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 260px;
  overflow-y: auto;
}

/* BARRA DE FILTROS — AJUSTES */

/* Badge de total de resultados na paginação */
.page-total {
  color: #bbc8cc;
  font-size: 11px;
}

/* Destaque leve no select quando tem filtro ativo */
.ctrl-select:not([value=""]) {
  border-color: var(--secondary);
  color: var(--secondary);
}

/* Responsivo: empilha filtros em tela pequena */
@media (max-width: 560px) {
  .community-bar__controls {
    flex-direction: column;
    align-items: stretch;
  }
  .ctrl-select, .ctrl-btn-publish {
    width: 100%;
  }
}