/* =============================================================================
   COMMUNITY PROFILE PAGE
   =============================================================================
   Styles for views/community/view.php - moved out of an inline registerCss()
   heredoc (it had grown past 300 lines) into its own asset, registered via
   assets/CommunityProfileAsset.php so load order after site.css/theme.css
   stays deterministic (see that file's docblock, mirroring
   assets/MarketingGroveAsset.php's same rationale).
   ============================================================================= */

.community-view-hero {
    position: relative;
    overflow: hidden;
}

.community-moderator-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    background: rgba(0, 0, 0, 0.7);
    color: #ffc107;
}

/* Full-bleed hero: cover image with a bottom scrim so the breadcrumb / pills /
   title / lead / actions layer reads over any photo. */
.community-view-cover {
    height: clamp(440px, 58vh, 560px);
    object-fit: cover;
    width: 100%;
    display: block;
}

.community-view-cover-placeholder {
    height: clamp(440px, 58vh, 560px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.community-view-hero video.community-hero-video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 0;
}
.community-view-hero .community-hero-bg-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}
.community-hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* Bottom-weighted gradient behind the text layer - independent of the optional
   dark community-hero-overlay above, so text stays legible over bright photos
   even when no landing-page background overlay is active. */
.community-hero-scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.45) 50%, rgba(0, 0, 0, 0.12) 100%);
    pointer-events: none;
}

.community-hero-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1.5rem 0 2.5rem;
    color: #fff;
}

.community-hero-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.75rem;
}
.community-hero-breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}
.community-hero-breadcrumb a:hover {
    text-decoration: underline;
}
.community-hero-breadcrumb .community-hero-breadcrumb-sep {
    opacity: 0.6;
}

.community-hero-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.community-hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    border-radius: var(--radius-full, 999px);
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.community-hero-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md, 0.5rem);
    object-fit: contain;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}
.community-hero-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md, 0.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}

.community-hero-title {
    font-family: var(--font-family-heading, inherit);
    font-weight: 700;
    font-size: clamp(2.6rem, 6vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    text-wrap: balance;
    color: #fff;
}

.community-hero-lead {
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 60ch;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}
.community-hero-lead:empty {
    display: none;
}

/* Foot row: lead left, actions right (bottom-aligned); stacks on phones. */
.community-hero-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.community-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

/* Pill buttons: solid white Join, outline-light rest. */
.community-hero-actions .btn,
.community-hero-join .btn {
    border-radius: var(--radius-full, 999px);
    padding: 0.65rem 1.4rem;
    font-weight: 600;
}
/* theme.css paints .btn-brand-primary from --wb-btn-* (dark theme at a
   higher specificity), so the white pill is set through those variables. */
.community-hero-join {
    --wb-btn-bg: #fff;
    --wb-btn-text: #1f2a24;
    --wb-btn-hover-bg: rgba(255, 255, 255, 0.88);
    --wb-btn-hover-text: #1f2a24;
}
.community-hero-join .btn {
    background: #fff;
    border-color: #fff;
    color: #1f2a24;
}
.community-hero-join .btn:hover,
.community-hero-join .btn:focus-visible {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(255, 255, 255, 0.88);
    color: #1f2a24;
}
.community-hero-btn {
    border-width: 1.5px;
    border-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
}

/* Logo edit overlay for community owners, now hosted inside the hero pill row. */
.community-logo-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.community-logo-edit-btn {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    border: 0;
    padding: 0;
    border-radius: var(--radius-md, 0.5rem);
    color: #fff;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}
.community-logo-wrapper:hover .community-logo-edit-btn {
    opacity: 1;
}
.community-logo-edit-btn:hover {
    color: #fff;
}

/* ===== Sticky tab bar ===== */
.community-view-tabs-wrap {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 10;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
}
.community-view-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.community-view-tabs::-webkit-scrollbar {
    display: none;
}

.community-view-tabs .nav-link {
    color: var(--text-secondary, #6c757d);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.95rem 0.75rem;
    margin-right: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}

.community-view-tabs .nav-link:hover {
    color: var(--text-primary, #212529);
    border-bottom-color: var(--bs-border-color);
}

.community-view-tabs .nav-link.active {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
    background: transparent;
}

.community-view-tabs .nav-link i {
    margin-right: 0.375rem;
}

/* ===== About tab: facts + moderators sidebar panels ===== */
.community-facts-panel .community-fact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #dee2e6);
    font-size: 0.875rem;
}
.community-facts-panel .community-fact-row:last-child {
    border-bottom: none;
}
.community-facts-panel .community-fact-label {
    color: var(--text-muted, #6c757d);
}
.community-facts-panel .community-fact-value {
    font-weight: 600;
    text-align: right;
}

.community-moderator-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.community-moderator-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.community-member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.community-member-placeholder {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--bs-primary), color-mix(in srgb, var(--bs-primary) 55%, #c9a36b));
}

.community-post-item {
    border-bottom: 1px solid var(--border-color, #dee2e6);
    padding: 1rem 0;
}

.community-post-item:last-child {
    border-bottom: none;
}

.community-post-avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.post-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2em 0.55em;
    border-radius: 0.25rem;
    white-space: nowrap;
}
.post-type-badge-discussion {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}
.post-type-badge-question {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}
.post-type-tabs .nav-link {
    border: 1px solid var(--border-color, #dee2e6);
    color: var(--text-secondary, #6c757d);
    padding: 0.4rem 1.25rem;
    font-weight: 500;
    border-radius: 0.375rem;
    cursor: pointer;
}
.post-type-tabs .nav-link.active {
    border-color: var(--color-primary-600, #2563eb);
    color: var(--color-primary-600, #2563eb);
    background: rgba(37, 99, 235, 0.05);
}
.post-type-badge-announcement {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}
.answered-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2em 0.55em;
    border-radius: 0.25rem;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    white-space: nowrap;
}

.community-stat-card {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-md, 0.375rem);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    text-align: center;
}

[data-theme="dark"] .community-stat-card {
    background: var(--bg-secondary, #1e293b);
}

.community-fullpage-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
}
.community-fullpage-bg video {
    width: 100%; height: 100%;
    object-fit: cover;
}
.community-fullpage-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.3);
}

/* ===== Cover image reposition controls (admin-only, drag-on-hero) =====
   Pinned to the TOP-right of the hero (not the bottom) - the hero's bottom
   is now the text content layer (breadcrumb/pills/title/lead/actions), so
   an owner's Edit Cover / Reposition cluster living there would overlap it. */
.community-cover-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.community-view-hero:hover .community-cover-actions {
    opacity: 1;
}
.community-view-hero.is-repositioning .community-cover-actions {
    display: none;
}

.community-cover-toolbar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    display: none;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    padding: 0.5rem;
    border-radius: var(--radius-md, 0.375rem);
}
.community-view-hero.is-repositioning .community-cover-toolbar {
    display: flex;
}

.community-view-hero.is-repositioning {
    cursor: grab;
    outline: 3px dashed rgba(255, 255, 255, 0.7);
    outline-offset: -6px;
    user-select: none;
}
.community-view-hero.is-repositioning.is-dragging {
    cursor: grabbing;
}

.community-cover-reposition-hint {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md, 0.375rem);
    font-size: var(--font-size-sm, 0.875rem);
    display: none;
    pointer-events: none;
}
.community-view-hero.is-repositioning .community-cover-reposition-hint {
    display: block;
}

/* Empty cover: button cluster stays visible since there's no image to hover. */
.community-cover-actions--empty {
    opacity: 1;
}

@media (max-width: 767.98px) {
    .community-view-cover,
    .community-view-cover-placeholder {
        height: 540px;
    }
    .community-hero-title {
        font-size: 2.6rem;
    }
    .community-hero-foot {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Body: cards, composer, feed (mockup restyle) ===== */
.community-view-body {
    padding: 2rem 0 3rem;
}

.community-side-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.community-side-card-body {
    padding: 1.35rem 1.35rem 1.25rem;
}
.community-side-card h3.h5,
.community-side-card h3.h6 {
    font-family: var(--font-family-heading, inherit);
}

.community-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    margin: 0 0 0.35rem;
}
.community-side-card-title {
    font-family: var(--font-family-heading, inherit);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}
.community-side-card-text {
    color: var(--bs-secondary-color);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.community-facts-panel .community-fact-row {
    font-size: 0.8125rem;
}
.community-facts-panel .community-fact-value a {
    color: inherit;
    text-decoration: none;
}
.community-facts-panel .community-fact-value a:hover {
    text-decoration: underline;
}
.community-side-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.8rem;
}
.community-side-card-links a {
    color: var(--bs-secondary-color);
}

.community-moderator-row strong {
    font-family: var(--font-family-heading, inherit);
}

.community-announcement-row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0;
}
.community-announcement-row:not(:last-child) {
    border-bottom: 1px solid var(--bs-border-color);
}
.community-announcement-row a {
    font-weight: 600;
    color: var(--bs-body-color);
    text-decoration: none;
    line-height: 1.35;
}
.community-announcement-row a:hover {
    color: var(--bs-primary);
}
.community-announcement-row small {
    color: var(--bs-secondary-color);
}

/* Composer */
.community-composer-title,
.community-pane-title {
    font-family: var(--font-family-heading, inherit);
    font-weight: 700;
    font-size: clamp(1.45rem, 2.4vw, 1.9rem);
    line-height: 1.15;
    margin-bottom: 0.9rem;
}
.community-composer-prompt {
    display: block;
    width: 100%;
    min-height: 5rem;
    text-align: left;
    vertical-align: top;
    padding: 0.8rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.community-composer-prompt:hover,
.community-composer-prompt:focus-visible {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-primary) 18%, transparent);
    outline: none;
}
.community-composer:has(#new-discussion-form:not([style*="none"])) .community-composer-prompt {
    display: none;
}
.community-composer-form .form-control {
    border-radius: 0.75rem;
    background: var(--bs-tertiary-bg);
}
.community-composer-form .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
}
.community-composer-join {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}
.community-pill-btn {
    border-radius: var(--radius-full, 999px);
    padding-left: 1.4rem;
    padding-right: 1.4rem;
    font-weight: 600;
}

/* Feed cards */
.community-post-card {
    margin-bottom: 0.9rem;
}
.community-post-card.is-pinned {
    border-color: color-mix(in srgb, var(--bs-warning) 45%, var(--bs-border-color));
}
.community-post-card-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.community-post-card-head .community-member-placeholder {
    width: 42px;
    height: 42px;
    font-size: 0.85rem;
}
.community-post-card-author {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.community-post-card-author strong {
    font-family: var(--font-family-heading, inherit);
}
.community-post-card-author small {
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
}
.community-post-card-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.community-post-card-title {
    font-family: var(--font-family-heading, inherit);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}
.community-post-card-title a {
    color: var(--bs-body-color);
    text-decoration: none;
}
.community-post-card-title a:hover {
    color: var(--bs-primary);
}
.community-post-card-text {
    line-height: 1.65;
    margin-bottom: 0.75rem;
}
.community-post-card-foot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.8rem;
}
.community-post-card-foot a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.community-post-card-foot a:hover {
    color: var(--bs-primary);
}

.community-feed-empty {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.35rem;
    color: var(--bs-secondary-color);
}
.community-feed-empty i {
    font-size: 1.4rem;
    color: var(--bs-primary);
}

/* Events / Calendar pane heads */
.community-pane-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}
.community-pane-link {
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    margin-bottom: 0.9rem;
}
