/* Community System – Basisstyling */

/* Garantiert, dass das HTML-Attribut "hidden" IMMER greift, unabhängig
   davon, wie spezifisch eine andere Regel in diesem Stylesheet (z. B.
   ".cs-button { display: inline-block }") dasselbe Element sonst anzeigen
   würde. Ohne !important gewinnt bei gleicher Selektor-Spezifität die
   später geladene Autoren-Regel gegen die eingebaute Browser-Regel
   "[hidden] { display: none }" – Elemente blieben dann trotz per JS
   gesetztem hidden-Attribut sichtbar (u. a. der "Nachricht senden"-Button).
 */
[hidden] { display: none !important; }

.cs-notice {
	padding: 10px 14px;
	background: #f3f4f6;
	border-radius: 6px;
	margin-bottom: 12px;
}
.cs-notice-error { background: #fdecea; color: #b32d2e; }

.cs-button {
	display: inline-block;
	padding: 8px 16px;
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	font-size: 14px;
}
.cs-button:hover { background: #135e96; color: #fff; }
.cs-button-google { background: #4285f4; }
.cs-button-google:hover { background: #3367d6; }

/* Chat */
.cs-chat { max-width: 480px; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.cs-chat-messages { max-height: 320px; overflow-y: auto; padding: 12px; background: #fafafa; }
.cs-chat-message { display: flex; gap: 8px; margin-bottom: 10px; }
.cs-chat-avatar { border-radius: 50%; }
.cs-chat-author { font-weight: 600; margin-right: 6px; }
.cs-chat-time { display: block; font-size: 11px; color: #888; }
.cs-chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eee; }
.cs-chat-input { flex: 1; resize: none; height: 36px; padding: 6px; }

/* Threads */
.cs-thread-list { list-style: none; margin: 0; padding: 0; }
.cs-thread-item { padding: 10px 0; border-bottom: 1px solid #eee; }
.cs-thread-meta { display: block; font-size: 12px; color: #888; }
.cs-new-thread { margin-bottom: 16px; }

/* Members */
.cs-members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.cs-member-card {
	text-align: center; padding: 12px; border: 1px solid #eee; border-radius: 8px;
	background: #fff; cursor: pointer; font: inherit; display: block; width: 100%;
}
.cs-member-card:hover { border-color: #2271b1; }
.cs-member-name { font-weight: 600; margin-top: 6px; }
.cs-member-interests { font-size: 12px; color: #888; }
.cs-member-search { width: 100%; max-width: 400px; padding: 8px; margin-bottom: 16px; box-sizing: border-box; }
.cs-member-search-empty { color: #888; }

.cs-pagination { margin-top: 16px; display: flex; gap: 6px; }
.cs-pagination a { padding: 4px 10px; border: 1px solid #ddd; border-radius: 4px; text-decoration: none; }
.cs-pagination a.is-active { background: #2271b1; color: #fff; }

/* Profile */
.cs-profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cs-profile-header img { border-radius: 50%; }
.cs-avatar-preview { border-radius: 6px; object-fit: cover; display: block; margin-bottom: 6px; }
.cs-avatar-delete { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #b32d2e; }

/* Registration consent checkboxes */
.cs-consent { font-size: 13px; }
.cs-consent label { display: flex; align-items: flex-start; gap: 6px; }
.cs-consent input[type="checkbox"] { margin-top: 3px; }

/* Account deletion */
.cs-account-delete-section { border: 1px solid #eee; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.cs-account-delete-section legend { padding: 0 4px; }

/* Community-Thema embed (shortcode [community_thread]) */
.cs-thema-embed { border: 1px solid #eee; border-radius: 8px; padding: 16px; }
.cs-thema-title { margin-top: 0; }
.cs-thema-description { margin-bottom: 16px; }

/* Access control */
.cs-restricted-notice { padding: 20px; background: #fff8e1; border: 1px solid #ffe58f; border-radius: 8px; text-align: center; }

/* Inline delete buttons in lists */
.cs-thread-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cs-inline-delete { margin: 0; }
.cs-inline-delete-btn {
	background: none; border: 1px solid #b32d2e; color: #b32d2e;
	padding: 3px 10px; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.cs-inline-delete-btn:hover { background: #b32d2e; color: #fff; }

/* Manage controls (edit/delete Community-Thema or Thread) */
.cs-manage-controls { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 20px; }
.cs-edit-toggle summary { cursor: pointer; color: #2271b1; font-size: 13px; padding: 6px 0; }
.cs-edit-toggle form { margin-top: 10px; max-width: 480px; }
.cs-delete-post-form { margin: 0; }
.cs-button-danger { background: #b32d2e; }
.cs-button-danger:hover { background: #8f2423; }

/* Replies (hierarchical accordion) */
.cs-replies-wrapper { margin-top: 24px; border-top: 1px solid #eee; padding-top: 16px; }
.cs-replies { list-style: none; margin: 0; padding: 0; }
.cs-replies .cs-replies { margin-left: 26px; margin-top: 10px; padding-left: 14px; border-left: 2px solid #eee; }
.cs-reply { margin-bottom: 14px; }
.cs-reply-body { display: flex; gap: 8px; }
.cs-reply-avatar { border-radius: 50%; flex-shrink: 0; }
.cs-reply-content { flex: 1; min-width: 0; }
.cs-reply-author { font-weight: 600; margin-right: 6px; }
.cs-reply-time { font-size: 11px; color: #888; }
.cs-reply-text { margin: 4px 0; white-space: pre-wrap; word-wrap: break-word; }
.cs-reply-actions { display: flex; gap: 12px; margin-bottom: 4px; }
.cs-reply-actions button {
	background: none; border: none; padding: 0; margin: 0;
	color: #2271b1; cursor: pointer; font-size: 12px; text-decoration: underline;
}
.cs-reply-delete { color: #b32d2e !important; }
.cs-reply-children { margin-top: 8px; }
.cs-reply-children > summary { cursor: pointer; color: #2271b1; font-size: 13px; list-style: none; }
.cs-reply-children > summary::-webkit-details-marker { display: none; }
.cs-reply-children > summary::before { content: "▸ "; }
.cs-reply-children[open] > summary::before { content: "▾ "; }
.cs-reply-form-slot:empty { display: none; }
.cs-reply-form { margin-top: 8px; max-width: 480px; }
.cs-reply-form textarea { width: 100%; min-height: 60px; padding: 6px; margin-bottom: 6px; box-sizing: border-box; }

/* Member popup modal */
.cs-member-modal-overlay {
	position: fixed; inset: 0; background: rgba(0,0,0,0.5);
	display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 16px;
}
.cs-member-modal {
	background: #fff; border-radius: 10px; padding: 24px; max-width: 380px; width: 100%;
	position: relative; text-align: center; max-height: 90vh; overflow-y: auto;
}
.cs-member-modal-close {
	position: absolute; top: 8px; right: 12px; background: none; border: none;
	font-size: 24px; line-height: 1; cursor: pointer; color: #888;
}
.cs-member-modal-avatar { border-radius: 50%; object-fit: cover; margin-bottom: 10px; }
.cs-member-modal-name { margin: 0 0 12px; }
.cs-member-modal-section { text-align: left; margin-bottom: 12px; }
.cs-member-modal-section strong { display: block; font-size: 12px; text-transform: uppercase; color: #888; margin-bottom: 2px; }
.cs-member-modal-dm { margin-top: 8px; }

/* Direct messages */
.cs-messages-wrapper { display: flex; gap: 20px; align-items: flex-start; }
.cs-messages-list-pane { flex: 0 0 240px; }
.cs-messages-active-pane { flex: 1; min-width: 0; }
.cs-conversation-list { list-style: none; margin: 0; padding: 0; }
.cs-conversation-item a {
	display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 6px;
	text-decoration: none; color: inherit;
}
.cs-conversation-item.is-active a, .cs-conversation-item a:hover { background: #f3f4f6; }
.cs-conversation-avatar { border-radius: 50%; flex-shrink: 0; }
.cs-conversation-info { min-width: 0; }
.cs-conversation-name { display: block; font-weight: 600; }
.cs-conversation-snippet { display: block; font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-conversation-empty { color: #888; padding: 8px 0; }

.cs-messages-active-pane h3 { display: flex; align-items: center; gap: 8px; }
.cs-messages-active-pane h3 img { border-radius: 50%; }
.cs-messages-thread { max-height: 400px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fafafa; }
.cs-message-bubble { max-width: 75%; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid #eee; }
.cs-message-own { margin-left: auto; background: #e8f0fe; border-color: #cfe0fc; }
.cs-message-author { font-weight: 600; font-size: 12px; margin-right: 6px; }
.cs-message-time { font-size: 11px; color: #888; }
.cs-message-text { margin: 4px 0 0; white-space: pre-wrap; word-wrap: break-word; }
.cs-message-form textarea { width: 100%; min-height: 60px; padding: 8px; margin-bottom: 8px; box-sizing: border-box; }
