/* /members/community.css - @version 1.1.0 */
.glass-box.hero-content.community-page { width: min(1100px, 94vw); max-width: 1100px; box-sizing: border-box; text-align: left; color: #f1f5f9; }
.community-page [hidden] { display: none !important; }
.community-nav, .community-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.community-nav { margin-bottom: 1rem; }
.community-nav a, .community-page a { color: #b8d8ff; }
.community-page h1 { margin: .4rem 0; font-size: clamp(1.65rem, 4vw, 2rem); }
.community-page h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
.community-page h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.community-lead, .community-help { color: #c1ccda; line-height: 1.6; }
.community-panel, .community-card { border: 1px solid #526073; border-radius: 14px; background: rgba(11, 20, 33, .88); padding: 1.3rem; margin: 1rem 0; }
.community-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); }
.community-grid .community-card { margin: 0; }
.community-page button, .community-page .community-button { border: 1px solid #7191b5; border-radius: 8px; background: #194e89; color: #fff; padding: .7rem 1rem; font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
.community-page button.secondary { background: #27364b; }
.community-page button.danger { background: #702b33; }
.community-page button:disabled { opacity: .6; cursor: default; }
.community-page :is(button, input, textarea, a):focus-visible { outline: 3px solid #8fc6ff; outline-offset: 3px; }
.community-page label { display: block; margin: .85rem 0 .3rem; }
.community-page input:not([type=checkbox]), .community-page textarea, .community-page select { box-sizing: border-box; display: block; width: 100%; padding: .8rem; border-radius: 8px; border: 1px solid #8091a6; background: #142137; color: #fff; font: inherit; }
.community-recipient-list { max-height: 20rem; overflow-y: auto; padding: .5rem; border: 1px solid #526073; border-radius: 8px; margin: .75rem 0; }
.community-page textarea { resize: vertical; min-height: 6rem; }
.community-page .community-check { display: flex; gap: .7rem; align-items: center; cursor: pointer; padding: .6rem 0; }
.community-check input { width: 1.2rem; height: 1.2rem; flex-shrink: 0; accent-color: #6caeff; }
.community-page fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.community-page legend { font-weight: 700; font-size: 1.2rem; }
.community-status { min-height: 1.6rem; margin: 1rem 0; line-height: 1.5; }
.community-status[data-error=true] { color: #ffb8b8; }
.community-card dl { margin: 0; }
.community-card dt { color: #b5c4d6; font-size: .85rem; margin-top: .8rem; }
.community-card dd { margin: .2rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.community-notes { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.6; }
.community-badge { padding: .25rem .6rem; display: inline-block; background: #344863; border-radius: 20px; font-size: .85rem; margin: .5rem 0; }
.community-card .community-actions { margin-top: 1rem; }
.community-page summary { cursor: pointer; font-weight: 600; padding: .6rem 0; }
.community-inline-fields { display: grid; grid-template-columns: 1fr 120px; gap: 1rem; }
.food-menu-overview { margin: 1.5rem 0; }
.food-menu-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.food-menu-metrics > div { padding: 1rem; background: #203b4b; border: 1px solid #526073; border-radius: 12px; }
.food-menu-metrics strong, .food-menu-metrics span { display: block; }
.food-menu-metrics strong { font: 400 1.8rem/1.2 Georgia, serif; }
.food-menu-metrics span { margin-top: .3rem; font-size: .8rem; }
.food-menu-filters { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.food-menu-filters button[aria-pressed=true] { background: #e6cc92; border-color: #e6cc92; color: #142d3c; }
.food-item-status { display: inline-flex; align-items: center; padding: .3rem .65rem; margin: .25rem .35rem .5rem 0; border-radius: 20px; font-size: .83rem; font-weight: 700; background: #344863; color: white; }
.food-item-status--open { background: #dcebdc; color: #305c3b; }
.food-item-status--helping { background: #f0dfb2; color: #62491d; }
.food-item-status--closed, .food-item-status--filled { background: #e8ece9; color: #4c615c; }
.food-item-volunteers { margin: 1rem 0; padding: .8rem 0; border-block: 1px solid #526073; }
.food-item-volunteers p { margin: 0; }
.food-volunteer-label { font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; margin-bottom: .35rem; }
@media (max-width: 600px) { .food-menu-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .food-menu-metrics > div { padding: .9rem; } .food-menu-filters button { flex: 1 1 auto; } }
@media (max-width: 520px) { .community-panel, .community-card { padding: 1rem; } .community-inline-fields { grid-template-columns: 1fr; gap: 0; } .community-actions button { width: 100%; } }

/* ---------- Messages and broadcasts (members/messages.html, broadcasts.html) ----------
   Phone first: one column, the list and the open chat take turns (.show-chat);
   side by side from 761 px. Typing boxes are 16 px so iPhones don't zoom in.
   Rules start at main.chat-page.community-page so they beat site-theme.css's
   .melfield-site .community-page button look (it loads later). */
.broadcast-fieldset { margin: 1rem 0 0; }
/* Radios are left out of the text-box rules (line 20, site-theme.css) that make inputs full width. */
main.community-page .community-check input[type=radio] { display: inline-block; width: 1.2rem; height: 1.2rem; min-height: 0; padding: 0; margin: 0; flex-shrink: 0; accent-color: var(--mu-sage, #42685a); }
.broadcast-meta { font-size: .85rem; color: var(--mu-muted, #596b6b); margin: -.35rem 0 .75rem; }
.broadcast-card h2 { margin-bottom: .5rem; }

main.chat-page.glass-box.hero-content { padding-bottom: 1rem; }
.chat-app { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 1rem; margin-top: .5rem; }
.chat-list-pane, .chat-pane { border: 1px solid var(--mu-line, #dce2da); border-radius: 16px; background: #fff; min-width: 0; overflow: hidden; }
.chat-list-pane { display: flex; flex-direction: column; max-height: min(72vh, 760px); }
main.chat-page.community-page .chat-list-pane input[type=search] { margin: .75rem; width: calc(100% - 1.5rem); font-size: 16px; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
main.chat-page.community-page .chat-list .chat-list-item { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .6rem; text-align: left; padding: .8rem 1rem; border: 0; border-top: 1px solid var(--mu-line, #dce2da); border-radius: 0; background: #fff; color: var(--mu-ink, #203b4b); min-height: 3.5rem; }
main.chat-page.community-page .chat-list .chat-list-item:hover, main.chat-page.community-page .chat-list .chat-list-item[aria-current=true] { background: #f2f6ee; }
.chat-list-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-time { font-size: .8rem; color: var(--mu-muted, #596b6b); }
.chat-list-preview { font-size: .9rem; color: var(--mu-muted, #596b6b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-extra { display: flex; gap: .35rem; align-items: center; justify-self: end; }
.chat-unread { min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--mu-navy, #203b4b); color: #fff; font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.4rem; }
.chat-list-empty { padding: 1rem; color: var(--mu-muted, #596b6b); }

.chat-pane { display: flex; flex-direction: column; min-height: min(72vh, 760px); max-height: min(72vh, 760px); background: #fbfaf6; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--mu-muted, #596b6b); padding: 2rem; text-align: center; }
.chat-open { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-header { position: relative; display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-bottom: 1px solid var(--mu-line, #dce2da); background: #edf2eb; }
.chat-title { flex: 1; min-width: 0; }
main.chat-page.community-page .chat-title h2 { margin: 0; font: 400 1.25rem/1.25 Georgia, "Times New Roman", serif; color: var(--mu-navy, #203b4b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title p { margin: .1rem 0 0; font-size: .82rem; color: var(--mu-muted, #596b6b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main.chat-page.community-page .chat-icon-button { min-width: 44px; min-height: 44px; padding: 0 .6rem; border-radius: 999px; background: transparent; border: 1px solid transparent; color: var(--mu-navy, #203b4b); font-size: 1.25rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
main.chat-page.community-page .chat-icon-button:hover { background: rgba(32, 59, 75, .08); }
main.chat-page.community-page #backToList { display: none; }
.chat-menu { position: absolute; right: .75rem; top: calc(100% - .25rem); z-index: 20; display: flex; flex-direction: column; min-width: 13rem; background: #fff; border: 1px solid var(--mu-line, #dce2da); border-radius: 12px; box-shadow: 0 12px 30px rgba(20, 45, 60, .18); overflow: hidden; }
main.chat-page.community-page .chat-menu button { background: #fff; color: var(--mu-ink, #203b4b); border: 0; border-radius: 0; text-align: left; padding: .8rem 1rem; min-height: 44px; }
main.chat-page.community-page .chat-menu button:hover { background: #f2f6ee; }
.chat-banner { margin: 0; padding: .6rem 1rem; background: #f8f0d9; color: #72501b; font-size: .9rem; }

.message-list { list-style: none; margin: 0; padding: 1rem; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; overscroll-behavior: contain; }
.chat-day { align-self: center; margin: .75rem 0 .25rem; font-size: .78rem; color: var(--mu-muted, #596b6b); }
.chat-system { align-self: center; max-width: 90%; text-align: center; font-size: .85rem; color: var(--mu-muted, #596b6b); padding: .25rem .5rem; }
.chat-message { display: grid; grid-template-columns: auto auto; align-items: end; gap: .1rem .25rem; max-width: 88%; }
.chat-message.mine { align-self: flex-end; justify-items: end; }
.chat-message.theirs { align-self: flex-start; }
.chat-bubble { display: flex; flex-direction: column; gap: .25rem; padding: .55rem .8rem; border-radius: 18px; background: #fff; border: 1px solid var(--mu-line, #dce2da); color: var(--mu-ink, #203b4b); min-width: 0; }
.chat-message.mine .chat-bubble { background: var(--mu-navy, #203b4b); border-color: var(--mu-navy, #203b4b); color: #fff; }
.chat-sender { font-size: .78rem; font-weight: 700; color: var(--mu-sage, #42685a); }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.chat-time { font-size: .7rem; opacity: .7; align-self: flex-end; }
.chat-deleted { font-style: italic; opacity: .75; }
.chat-photo img { display: block; max-width: min(260px, 100%); max-height: 320px; border-radius: 12px; cursor: zoom-in; }
.chat-photo.loading { min-width: 140px; min-height: 100px; border-radius: 12px; background: rgba(32, 59, 75, .08); }
main.chat-page.community-page .chat-more { grid-column: 2; grid-row: 1; align-self: center; min-width: 36px; min-height: 36px; padding: 0; border-radius: 999px; background: transparent; border: 0; color: var(--mu-muted, #596b6b); font-size: 1.1rem; cursor: pointer; }
main.chat-page.community-page .chat-message.mine .chat-more { grid-column: 1; }
.chat-message.mine .chat-bubble { grid-column: 2; }
.chat-reactions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem; }
main.chat-page.community-page .chat-reaction { min-height: 32px; padding: .1rem .55rem; border-radius: 999px; background: #fff; border: 1px solid var(--mu-line, #dce2da); color: var(--mu-ink, #203b4b); font-size: .9rem; cursor: pointer; }
main.chat-page.community-page .chat-reaction.mine { background: #edf2eb; border-color: var(--mu-sage, #42685a); }
.chat-seen { align-self: flex-end; font-size: .75rem; color: var(--mu-muted, #596b6b); }
.chat-typing { min-height: 1.2rem; margin: 0; padding: 0 1rem; font-size: .82rem; color: var(--mu-muted, #596b6b); font-style: italic; }

.chat-composer { border-top: 1px solid var(--mu-line, #dce2da); background: #fff; padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom, 0px)); }
.chat-compose-row { display: flex; align-items: flex-end; gap: .5rem; }
main.chat-page.community-page .chat-composer textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; font-size: 16px; line-height: 1.4; padding: .6rem .8rem; border-radius: 22px; margin: 0; }
main.chat-page.community-page .chat-composer #sendButton { min-height: 44px; border-radius: 22px; padding: 0 1.1rem; }
.chat-photo-button { position: relative; overflow: hidden; }
.chat-photo-button input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.chat-photo-preview { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.chat-photo-preview img { max-height: 90px; max-width: 120px; border-radius: 10px; }
.chat-composer .community-status { margin: .35rem 0 0; min-height: 0; font-size: .85rem; }

.chat-dialog { width: min(520px, calc(100vw - 2rem)); max-height: min(85vh, 720px); padding: 0; flex-direction: column; }
.chat-dialog[open] { display: flex; }
.chat-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 1rem; }
.chat-dialog > header h2 { margin: 0; font-size: 1.2rem; }
.chat-dialog-body { padding: 1rem; overflow-y: auto; }
.chat-dialog > footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .75rem 1rem; }
.chat-dialog input[type=search], .chat-dialog input[type=text], .chat-dialog textarea { font-size: 16px; }
.chat-dialog-heading { margin: 1.25rem 0 .5rem; font-size: 1rem; }
.chat-inline { display: flex; gap: .5rem; align-items: center; }
.chat-inline input { flex: 1; }
.chat-people { list-style: none; margin: 0; padding: 0; }
.chat-person { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--mu-line, #dce2da); }
.chat-quote { white-space: pre-wrap; overflow-wrap: anywhere; padding: .6rem .8rem; border-left: 3px solid var(--mu-sage, #42685a); background: #f6f5ef; border-radius: 6px; max-height: 8rem; overflow-y: auto; }
.chat-reaction-picker { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
main.chat-page.community-page .chat-reaction-picker .chat-reaction { font-size: 1.35rem; min-width: 48px; min-height: 48px; }

@media (max-width: 760px) {
    .chat-app { grid-template-columns: minmax(0, 1fr); }
    .chat-app.show-chat .chat-list-pane, .chat-app:not(.show-chat) .chat-pane { display: none; }
    main.chat-page.community-page #backToList { display: inline-flex; }
    .chat-list-pane, .chat-pane { max-height: none; }
    .chat-pane { min-height: calc(100dvh - 220px); max-height: calc(100dvh - 140px); }
    /* An open chat fills the screen like the app; messages.js sizes it to the
       part above the on-screen keyboard (--chat-top / --chat-height). */
    .chat-app.show-chat .chat-pane { position: fixed; left: 0; right: 0; top: var(--chat-top, 0px); height: var(--chat-height, 100dvh); min-height: 0; max-height: none; z-index: 5000; border: 0; border-radius: 0; }
    .chat-app.show-chat .chat-header { padding-top: calc(.7rem + env(safe-area-inset-top, 0px)); padding-left: calc(.9rem + env(safe-area-inset-left, 0px)); padding-right: calc(.9rem + env(safe-area-inset-right, 0px)); }
    body.chat-fullscreen { overflow: hidden; }
    .chat-message { max-width: 94%; }
}
