/* =============================================
   COMMUNITY MODULE - Visual Styles
   ============================================= */

/* --- Category Badge --- */
.community-category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background-color: #e8f0fe;
    color: #1a73e8;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* --- Topics Table Enhancements --- */
.community-replies-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #5f6368;
    font-size: 13px;
}
.community-replies-count i {
    color: #9aa0a6;
    font-size: 14px;
}
.community-replies-count .num {
    font-weight: 600;
    color: #3c4043;
}

.community-date-display {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #5f6368;
    font-size: 13px;
}
.community-date-display i {
    color: #9aa0a6;
    font-size: 13px;
}

/* --- Avatar Initials Circle (community) --- */
.community-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
}
.community-avatar-sm {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 11px;
}

/* --- Opened By column with avatar --- */
.community-user-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.community-user-cell .community-avatar {
    flex-shrink: 0;
}
.community-user-cell .community-user-name {
    font-size: 13px;
    color: #3c4043;
    white-space: nowrap;
}

/* --- Main Topic Panel (different color) --- */
#portlet-topic {
    border-left: 4px solid #4285f4;
    margin-bottom: 25px;
}
#portlet-topic > .panel-heading {
    background-color: #f0f4ff;
    border-bottom: 1px solid #d2e3fc;
}
#portlet-topic > .panel-body {
    padding: 20px 25px;
}

/* --- Topic Detail Page --- */
.community-topic-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}
.community-topic-header .community-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 2px;
}
.community-topic-meta {
    flex: 1;
}
.community-topic-meta .community-meta-name {
    font-weight: 600;
    color: #202124;
    font-size: 14px;
}
.community-topic-meta .community-meta-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 5px;
    font-size: 12.5px;
    color: #80868b;
}

/* --- Disabled panel control links (super admin only) --- */
.panel-controls .community-ctrl-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: auto;
}
.panel-controls .community-ctrl-disabled i {
    color: #9aa0a6 !important;
}

/* --- Active panel control popover links --- */
.panel-controls .community-popover-ctrl {
    opacity: 1 !important;
}

/* --- Reply Cards --- */
.community-reply-card {
    display: flex;
    gap: 15px;
    padding: 18px 0;
    border-bottom: 1px solid #e8eaed;
}
.community-reply-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.community-reply-card.community-reply-hidden {
    display: none;
}
.community-reply-card .community-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}
.community-reply-body {
    flex: 1;
    min-width: 0;
}
.community-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}
.community-reply-header .reply-author {
    font-weight: 600;
    color: #202124;
    font-size: 14px;
}
.community-reply-header .reply-date {
    font-size: 12.5px;
    color: #80868b;
}
.community-reply-header .reply-date i {
    margin-right: 3px;
}
.community-reply-header .reply-edited {
    font-size: 11.5px;
    color: #9aa0a6;
    font-style: italic;
}
.community-reply-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.community-reply-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f1f3f4;
    color: #5f6368;
    font-size: 13px;
    transition: all 0.2s ease;
    text-decoration: none;
}
.community-reply-actions a:hover {
    background: #e8eaed;
    color: #3c4043;
    text-decoration: none;
    transform: scale(1.1);
}
.community-reply-actions a.community-ctrl-disabled {
    background: #f8f9fa;
    color: #bdc1c6;
    opacity: 0.6;
    cursor: not-allowed;
}
.community-reply-actions a.community-ctrl-disabled:hover {
    background: #f8f9fa;
    color: #bdc1c6;
    transform: none;
}
.community-reply-content {
    color: #3c4043;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* --- Reply Filters --- */
.community-reply-filters {
    padding: 0 0 15px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #e8eaed;
}
.community-reply-filters .form-control {
    font-size: 13px;
}

/* --- Reply Pagination --- */
.community-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 15px 0 5px 0;
    flex-wrap: wrap;
}
.community-pagination .community-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background: #fff;
    color: #3c4043;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.community-pagination .community-page-btn:hover {
    background: #f1f3f4;
    text-decoration: none;
}
.community-pagination .community-page-btn.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}
.community-pagination .community-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.community-pagination .community-page-info {
    font-size: 13px;
    color: #80868b;
    margin: 0 8px;
}

/* --- Attachments Styled --- */
.community-attachments {
    margin-top: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8eaed;
}
.community-attachments .community-attachments-title {
    font-size: 12px;
    font-weight: 600;
    color: #5f6368;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.community-attachments .community-attachments-toggle {
    cursor: pointer;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    user-select: none;
}
.community-attachments .community-attachments-toggle .community-attachments-chevron {
    margin-left: auto;
}
.community-attachments .community-attachments-toggle .fa-paperclip {
    margin-right: 4px;
}
.community-attachments .community-attachments-toggle:hover {
    color: #3c4043;
}
.community-attachments .community-attachments-chevron {
    font-size: 11px;
    transition: transform 0.25s ease;
    margin-left: auto;
}
.community-attachments .community-attachments-chevron.collapsed {
    transform: rotate(180deg);
}
.community-attachments .community-attachments-list {
    margin-top: 6px;
}
.community-attachments ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.community-attachments li {
    padding: 4px 0;
    line-height: 1.5;
}
.community-attachments li a {
    display: inline;
    color: #1a73e8;
    font-size: 13px;
    text-decoration: none;
}
.community-attachments li a .fa {
    margin-right: 4px;
}
.community-attachments li a:hover {
    text-decoration: underline;
}
.community-attachments li .att-size {
    color: #9aa0a6;
    font-size: 11.5px;
    margin-left: 4px;
    white-space: nowrap;
}

/* --- Empty State --- */
.community-empty-replies {
    text-align: center;
    padding: 40px 20px;
    color: #9aa0a6;
}
.community-empty-replies i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    color: #dadce0;
}
.community-empty-replies span {
    font-size: 14px;
}

/* --- Reaction Bar --- */
.community-reaction-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}
.community-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    background: #fff;
    color: #5f6368;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.community-reaction-btn:hover {
    background: #f1f3f4;
    border-color: #bdc1c6;
}
.community-reaction-btn.active {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}
.community-reaction-btn .reaction-count {
    font-weight: 600;
}
.community-reaction-names {
    font-size: 11px;
    color: #9aa0a6;
    font-style: italic;
}
.community-reaction-show-all {
    color: #1a73e8;
    font-style: normal;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.community-reaction-show-all:hover {
    text-decoration: underline;
    color: #1558b0;
}

/* --- Quote Button in Reaction Bar --- */
.community-quote-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    background: #fff;
    color: #5f6368;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.community-quote-btn:hover {
    background: #f1f3f4;
    border-color: #bdc1c6;
}
.community-quote-btn i {
    font-size: 11px;
}

/* --- Reply Form Actions (Rispondi button) --- */
.community-reply-form-actions {
    margin-top: 12px;
}

/* --- Reactions Popup (show all names) --- */
.community-reactions-popup {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    z-index: 1060;
    min-width: 200px;
    max-width: 300px;
    max-height: 250px;
    overflow: hidden;
}
.community-reactions-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #3c4043;
}
.community-reactions-popup-header i.fa-thumbs-up {
    color: #1a73e8;
    margin-right: 4px;
}
.community-reactions-popup-close {
    color: #5f6368;
    font-size: 14px;
    text-decoration: none;
}
.community-reactions-popup-close:hover {
    color: #ea4335;
}
.community-reactions-popup-body {
    padding: 8px 12px;
    max-height: 200px;
    overflow-y: auto;
}

/* --- Quoted Reply --- */
.community-quoted-reply {
    background: #f8f9fa;
    border-left: 3px solid #1a73e8;
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    cursor: pointer;
}
.community-quoted-reply:hover {
    background: #eef1f5;
}
.community-quoted-header {
    color: #5f6368;
    margin-bottom: 4px;
    font-size: 12px;
}
.community-quoted-header i {
    color: #1a73e8;
    margin-right: 4px;
}
.community-quoted-text {
    color: #3c4043;
    line-height: 1.4;
}

/* --- Quote Preview in Form --- */
.community-quoted-reply-preview {
    background: #f8f9fa;
    border-left: 3px solid #1a73e8;
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-size: 13px;
    position: relative;
}
.community-quoted-remove {
    position: absolute;
    top: 6px;
    right: 8px;
    color: #5f6368;
    font-size: 14px;
    text-decoration: none;
}
.community-quoted-remove:hover {
    color: #ea4335;
}

/* --- Sort Toggle --- */
.community-sort-toggle {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 100%;
    padding-top: 10px;
}
.community-sort-btn {
    border: 1px solid #dadce0;
    background: #fff;
    color: #5f6368;
    font-size: 12px;
    border-radius: 16px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.community-sort-btn:hover {
    background: #f1f3f4;
}
.community-sort-btn.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
}

/* --- Unread Badge --- */
.community-unread-badge {
    display: inline-block;
    background: #ea4335;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Search Scope Radio --- */
.community-search-scope {
    margin: 0 0 5px 0;
    padding: 0 2px;
    font-size: 12px;
    color: #5f6368;
}
.community-search-scope .radio-inline {
    padding-left: 20px;
    margin-right: 16px;
    font-weight: 400;
    color: #5f6368;
}
.community-search-scope .radio-inline input[type="radio"] {
    margin-top: 3px;
    margin-right: 3px;
}

.community-filters-separator {
    margin: 12px 0 8px 0;
    border-top: 1px solid #e8eaed;
}

/* --- Mention Dropdown --- */
.community-mention-dropdown {
    position: fixed;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100000;
    min-width: 180px;
    max-height: 220px;
    overflow-y: auto;
}
.community-mention-item {
    padding: 7px 12px;
    font-size: 13px;
    color: #3c4043;
    cursor: pointer;
    transition: background 0.1s ease;
}
.community-mention-item:hover,
.community-mention-item.active {
    background: #e8f0fe;
    color: #1a73e8;
}

/* --- Mention Highlight in Content --- */
.community-mention {
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

/* --- Attachment Count Badge --- */
.community-att-count {
    font-size: 12px;
    color: #5f6368;
    font-weight: 400;
}

/* --- Mention Highlight in Content --- */

/* --- Responsive: Tablet & Mobile --- */
@media (max-width: 767px) {
    /* Reply filters: add spacing between stacked fields */
    .community-reply-filters .row > [class*="col-"] + [class*="col-"] {
        margin-top: 10px;
    }

    /* Sort toggle: align left on mobile */
    .community-sort-toggle {
        padding-top: 10px;
        justify-content: flex-start;
    }

    /* Reply card: reduce gap, smaller avatar */
    .community-reply-card {
        gap: 10px;
        padding: 14px 0;
    }
    .community-reply-card .community-avatar {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 12px;
    }

    /* Reply header: stack vertically on small screens */
    .community-reply-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .community-reply-actions {
        margin-top: 2px;
    }

    /* Topic header: reduce avatar size */
    .community-topic-header .community-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 13px;
    }
    .community-topic-header {
        gap: 10px;
    }

    /* Topic panel body: reduce padding */
    #portlet-topic > .panel-body {
        padding: 15px;
    }

    /* Pagination: smaller buttons */
    .community-pagination .community-page-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* Search scope radio: wrap nicely */
    .community-search-scope .radio-inline {
        margin-right: 10px;
        font-size: 11.5px;
    }
}
