/* ===== PHOENIX FITNESS base ===== */
:root{
  --brand:#4b2a7a;        /* primary Phoenix Fitness purple */
  --brand-soft:#5a358d;   /* deeper purple for navbar */
  --brand-ink:#ffffff;    /* text on brand */
  --surface:#ffffff;
  --surface-alt:#f9f5fb;
  --text:#333;
  --text-muted:#636b74;
  --border:rgba(0,0,0,.08);
}

/* Layout: sticky footer (header | content | footer) */
html{ height:100%; }
body{
  min-height:100svh;                /* full viewport height incl. mobile safe area */
  display:grid;
  grid-template-rows:auto 1fr auto; /* header | content | footer */
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background:var(--surface-alt);
  color:var(--text);
  margin:0;
}

main.page-content{
  display:block;
  width:100%;
  background:var(--surface-alt);
  padding-bottom:2rem;
  min-height:0;
}

/* ===== Navbar ===== */
.navbar{
  background-color:var(--brand-soft);
  padding-top:0.85rem;
  padding-bottom:0.85rem;
}
.navbar-brand, .nav-link{
  color:#fff !important;
  font-weight:600;
}
.navbar-nav{ gap:0.9rem; }
.nav-link:hover{ text-decoration:underline; }
.message-unread-badge{ font-size:.75rem; padding:.1rem .45rem; font-weight:700; }
.community-badge{ font-size:.75rem; padding:.1rem .45rem; font-weight:700; min-width:1.5rem; display:inline-flex; justify-content:center; align-items:center; gap:.25rem; }
.community-badge__value{ display:inline-block; min-width:1em; text-align:center; }
.community-notification-toggle{
  display:flex;
  align-items:center;
  gap:.5rem;
  color:#fff !important;
  text-decoration:none;
  padding:.5rem .75rem;
}
.community-notification-toggle:hover,
.community-notification-toggle:focus{
  text-decoration:underline;
}
.community-notification-toggle:focus{
  box-shadow:none;
}
.community-notification-toggle.dropdown-toggle::after{
  display:none;
}
.community-notification-dropdown{ width:min(320px, calc(100vw - 2rem)); padding:0; border-radius:16px; box-shadow:0 18px 45px rgba(73,47,146,.18); border:1px solid rgba(73,47,146,.12); }
.community-notification-dropdown__header{ padding:.75rem 1rem; border-bottom:1px solid rgba(73,47,146,.12); }
.community-notification-dropdown__header .btn{ padding:0; font-weight:600; color:var(--brand); }
.community-notification-dropdown__list{ max-height:320px; overflow:auto; }
.community-notification-item{ font-size:.9rem; line-height:1.4; }
.community-notification-item.is-unread{ background:rgba(73,47,146,.08); }
.community-notification-item + .community-notification-item{ border-top:1px solid rgba(73,47,146,.12); }
.community-notification-dropdown__list .list-group-item{ border-width:0; }

/* ===== Community feed ===== */
.community-feed{ display:flex; flex-direction:column; gap:1.5rem; }
.community-compose .community-avatar{ width:52px; height:52px; border-radius:50%; object-fit:cover; border:2px solid rgba(73,47,146,.15); }
.community-compose__actions .btn{ min-width:130px; }
.community-compose__actions .btn-icon{ min-width:0; width:2.5rem; height:2.5rem; }
.community-compose__preview{ background:rgba(73,47,146,.05); border:1px dashed rgba(73,47,146,.2); border-radius:12px; padding:.75rem; display:flex; flex-wrap:wrap; gap:.5rem; }
.community-compose__file{ background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:.35rem .65rem; font-size:.85rem; display:flex; align-items:center; gap:.35rem; }
.community-feed__status{ border-radius:12px; }
.community-post{ border:1px solid var(--border); border-radius:16px; background:var(--surface); box-shadow:0 12px 28px rgba(73,47,146,.08); overflow:hidden; }
.community-post__header{ display:flex; gap:1rem; padding:1.25rem 1.25rem 0 1.25rem; }
.community-post__avatar{ width:52px; height:52px; border-radius:50%; object-fit:cover; border:2px solid rgba(73,47,146,.15); }
.community-post__meta{ font-size:.85rem; color:var(--text-muted); display:flex; flex-wrap:wrap; gap:.5rem; }
.community-post__body{ padding:1rem 1.25rem; font-size:1rem; line-height:1.55; }
.community-post__body p{ margin:0; }
.community-link-preview{ display:flex; flex-direction:column; gap:.75rem; margin-top:1rem; border:1px solid rgba(73,47,146,.12); border-radius:12px; overflow:hidden; background:var(--surface); color:inherit; text-decoration:none; transition:box-shadow .2s ease, transform .2s ease; }
.community-link-preview:hover{ text-decoration:none; box-shadow:0 10px 24px rgba(73,47,146,.18); transform:translateY(-1px); }
.community-link-preview__media img{ width:100%; height:auto; display:block; object-fit:cover; max-height:240px; }
.community-link-preview__content{ padding:1rem; display:flex; flex-direction:column; gap:.35rem; }
.community-link-preview__site{ font-size:.8rem; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); }
.community-link-preview__title{ font-weight:600; font-size:1rem; color:inherit; }
.community-link-preview__description{ color:var(--text-muted); font-size:.95rem; line-height:1.5; }

:where(
  .community-post__body,
  .community-comment__body,
  .announcement-body,
  .event-description,
  .messenger-message__bubble
) {
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Ensure embedded rich text media scales within its container */
:where(
  .community-post__body,
  .community-comment__body,
  .announcement-body,
  .event-description,
  .messenger-message__bubble
) :where(img, video, iframe, embed, object){
  display:block;
  max-width:100%;
}

:where(
  .community-post__body,
  .community-comment__body,
  .announcement-body,
  .event-description,
  .messenger-message__bubble
) :where(img, video){
  height:auto;
}

:where(
  .community-post__body,
  .community-comment__body,
  .announcement-body,
  .event-description,
  .messenger-message__bubble
) iframe{
  width:100%;
  border:0;
}

:where(
  .community-post__body,
  .community-comment__body,
  .announcement-body,
  .event-description,
  .messenger-message__bubble
) figure{
  margin:0;
  max-width:100%;
}
.community-post__attachments{ display:grid; gap:.75rem; padding:0 1.25rem 1rem; grid-template-columns:minmax(0,1fr); grid-auto-flow:dense; justify-items:stretch; width:100%; max-width:100%; overflow:hidden; }
.community-post__attachments--multiple{ grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); grid-auto-rows:minmax(160px,1fr); }
.community-post__attachments--count-2{ grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:minmax(180px,1fr); }
.community-post__attachments--count-3,
.community-post__attachments--count-4{ grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:minmax(160px,1fr); }
.community-post__attachments--count-3 .community-post__attachment:first-child,
.community-post__attachments--count-4 .community-post__attachment:first-child{ grid-row:span 2; }
.community-post__attachments--count-4 .community-post__attachment:nth-child(4):last-child{ grid-column:1 / span 2; }
.community-post__attachment{ position:relative; min-width:0; max-width:100%; }
.community-post__attachment-media{ width:100%; max-width:100%; height:auto; display:block; border-radius:12px; }
.community-post__attachment-btn{ display:flex; align-items:center; justify-content:center; width:100%; max-width:100%; min-width:0; height:100%; border:0; padding:0; background:none; border-radius:12px; overflow:hidden; cursor:pointer; }
.community-post__attachment-btn:focus-visible{ outline:3px solid rgba(73,47,146,.45); outline-offset:3px; }
.community-post__attachment img,
.community-post__attachment video{ width:100%; border-radius:12px; }
.community-post__attachment img{ display:block; height:auto; max-height:65vh; object-fit:contain; }
.community-post__attachment video{ max-height:65vh; object-fit:cover; }
.community-post__attachments--multiple .community-post__attachment{ height:100%; }
.community-post__attachments--multiple .community-post__attachment-btn{ height:100%; }
.community-post__attachments--multiple .community-post__attachment img,
.community-post__attachments--multiple .community-post__attachment video,
.community-post__attachments--multiple .community-post__attachment-media{ height:100%; max-height:none; object-fit:cover; }
.community-post__actions{ display:flex; align-items:center; justify-content:space-between; padding:0 1.25rem 1rem; border-top:1px solid var(--border); }
.community-post__action-buttons{ display:flex; gap:.75rem; }
.community-action-btn{ display:inline-flex; align-items:center; gap:.35rem; font-weight:600; color:var(--text-muted); background:transparent; border:0; padding:.35rem .65rem; border-radius:999px; transition:background .2s ease,color .2s ease; }
.community-action-btn:hover,
.community-action-btn:focus{ background:rgba(73,47,146,.08); color:var(--brand); }
.community-action-btn--active{ color:var(--brand); }
.community-comments{ border-top:1px solid var(--border); padding:1rem 1.25rem 1.25rem; display:flex; flex-direction:column; gap:1rem; }
.community-comments.is-collapsed{ display:none; }
.community-comment{ display:grid; grid-template-columns:40px 1fr; column-gap:.75rem; row-gap:.75rem; align-items:flex-start; }
.community-comment__avatar{ width:40px; height:40px; border-radius:50%; object-fit:cover; border:2px solid rgba(73,47,146,.1); grid-column:1; grid-row:1; }
.community-comment__bubble{ background:rgba(73,47,146,.05); border-radius:16px; padding:.75rem 1rem; grid-column:2; grid-row:1; width:100%; }
.community-comment__meta{ display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; font-size:.85rem; color:var(--text-muted); margin-bottom:.35rem; }
.community-comment__author{ font-weight:600; color:var(--text); }
.community-comment__reply-to{ font-size:.8rem; color:var(--brand); margin-bottom:.35rem; display:flex; align-items:center; gap:.35rem; }
.community-comment__actions{ display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.5rem; font-size:.85rem; }
.community-comment__actions button{ border:0; background:none; color:var(--brand); font-weight:600; padding:0; }
.community-comment__actions button:hover{ text-decoration:underline; }
.community-comment__actions button.community-comment__like-btn:hover{ text-decoration:none; }
.community-comment.is-highlighted .community-comment__bubble{ background:rgba(73,47,146,.12); box-shadow:0 0 0 3px rgba(73,47,146,.2); transition:background .25s ease,box-shadow .25s ease; }
@media (prefers-reduced-motion: no-preference){
  .community-comment.is-highlighted .community-comment__bubble{ animation:community-comment-highlight 1.8s ease-in-out 2; }
}
@keyframes community-comment-highlight{
  0%,100%{ box-shadow:0 0 0 0 rgba(73,47,146,.18); }
  50%{ box-shadow:0 0 0 6px rgba(73,47,146,.08); }
}
.community-comment__like-btn{ display:inline-flex; align-items:center; gap:.25rem; color:var(--brand); font-weight:600; padding:0; border:0; background:none; }
.community-comment__like-btn .community-comment__like-icon{ font-size:1rem; line-height:1; color:#7a5ccf; }
.community-comment__like-btn .community-comment__like-count{ color:var(--brand); min-width:1ch; text-align:left; }
.community-comment__like-btn:not(.is-active) .community-comment__like-icon{ opacity:.7; }
.community-comment__like-btn:not(.is-active) .community-comment__like-count{ color:var(--text-muted); }
.community-comment__children{ grid-column:2; margin-left:0; padding-left:1.5rem; border-left:2px solid rgba(73,47,146,.15); display:flex; flex-direction:column; gap:.75rem; }
.community-comment__children .community-comment{ margin-top:.75rem; }
.community-comment__children .community-comment:first-child{ margin-top:0; }
.community-comment-form{ display:flex; flex-direction:column; gap:.75rem; margin-top:.5rem; }
.community-comment-form textarea{ resize:vertical; min-height:70px; }
.community-comment-form__footer{ display:flex; justify-content:space-between; align-items:center; gap:.75rem; }
.community-comment-form__actions{ display:flex; align-items:center; gap:.5rem; }
.community-comment-form__actions .btn-icon{ justify-content:center; align-items:center; }
.community-reply-indicator{ font-size:.85rem; color:var(--brand); display:none; }
.community-reply-indicator.active{ display:flex; align-items:center; gap:.35rem; }
.community-notifications .list-group-item{ font-size:.9rem; line-height:1.4; }
.community-notification__time{ font-size:.8rem; color:var(--text-muted); display:block; }
.community-mention{ color:#492f92; font-weight:600; }
.community-mention-menu{ position:absolute; z-index:1080; background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:0 18px 45px rgba(73,47,146,.16); padding:.35rem; max-width:360px; }
.community-mention-menu__list{ max-height:260px; overflow:auto; display:flex; flex-direction:column; }
.community-mention-menu__item{ display:flex; align-items:center; gap:.5rem; padding:.5rem .75rem; border:0; background:none; width:100%; text-align:left; border-radius:10px; font-weight:600; color:var(--text); cursor:pointer; transition:background .15s ease,color .15s ease; }
.community-mention-menu__item img{ width:28px; height:28px; border-radius:50%; object-fit:cover; flex-shrink:0; }
.community-mention-menu__item:hover{ background:rgba(73,47,146,.08); color:var(--brand); }
.community-mention-menu__item.is-active{ background:rgba(73,47,146,.12); color:var(--brand); }
.community-mention-menu__empty{ padding:.65rem .75rem; color:var(--text-muted); font-size:.9rem; }
.community-emoji-picker{ position:absolute; z-index:1080; background:var(--surface); border:1px solid var(--border); border-radius:16px; box-shadow:0 18px 45px rgba(73,47,146,.14); padding:.75rem; display:flex; flex-direction:column; gap:.5rem; }
.community-emoji-picker__header{ position:sticky; top:0; background:var(--surface); z-index:1; }
.community-emoji-picker__grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(40px,1fr)); gap:.35rem; max-height:220px; overflow:auto; }
.community-emoji-picker__emoji{ font-size:1.5rem; line-height:1; border:1px solid transparent; border-radius:10px; background:transparent; padding:.35rem; cursor:pointer; transition:background .15s ease,border-color .15s ease,transform .15s ease; }
.community-emoji-picker__emoji:hover,
.community-emoji-picker__emoji:focus{ background:rgba(73,47,146,.1); border-color:rgba(73,47,146,.2); transform:translateY(-1px); outline:0; }
.community-emoji-picker__empty{ text-align:center; color:var(--text-muted); font-size:.9rem; padding:.5rem 0; }

.community-attachment-modal .modal-content{ background:rgba(0,0,0,.85); border:0; border-radius:20px; position:relative; }
.community-attachment-modal .btn-close{ filter:invert(1); }
.community-attachment-carousel{ background:#000; border-radius:20px; overflow:hidden; }
.community-attachment-carousel .carousel-inner{ align-items:stretch; }
.community-attachment-carousel .carousel-item{ justify-content:center; align-items:center; padding:1.5rem; min-height:50vh; }
.community-attachment-carousel .carousel-item.active,
.community-attachment-carousel .carousel-item-next,
.community-attachment-carousel .carousel-item-prev{ display:flex; }
.community-attachment-carousel__media{ max-height:80vh; max-width:100%; width:auto; border-radius:16px; box-shadow:0 16px 35px rgba(0,0,0,.35); }
.community-attachment-carousel .carousel-control-next,
.community-attachment-carousel .carousel-control-prev{ width:12%; }
.community-attachment-carousel .carousel-indicators{ margin-bottom:1rem; }

@media (max-width: 767.98px){
  .community-post__attachments{ padding:0 1rem 1rem; }
  .community-post__attachments--multiple,
  .community-post__attachments--count-2,
  .community-post__attachments--count-3,
  .community-post__attachments--count-4{ grid-template-columns:1fr; grid-auto-rows:auto; }
  .community-post__attachments--count-3 .community-post__attachment:first-child,
  .community-post__attachments--count-4 .community-post__attachment:first-child,
  .community-post__attachments--count-4 .community-post__attachment:nth-child(4):last-child{ grid-row:auto; grid-column:auto; }
  .community-post__attachments--multiple .community-post__attachment,
  .community-post__attachments--multiple .community-post__attachment-btn{ height:auto; }
  .community-post__attachments--multiple .community-post__attachment img,
  .community-post__attachments--multiple .community-post__attachment video,
  .community-post__attachments--multiple .community-post__attachment-media{ height:auto; max-height:55vh; object-fit:contain; }
  .community-post__attachments img,
  .community-post__attachments video,
  .community-post__attachment-media{ max-height:55vh; }
  .community-comment{ grid-template-columns:32px 1fr; column-gap:.5rem; }
  .community-comment__avatar{ width:32px; height:32px; }
  .community-comment__children{ padding-left:1rem; }
}

/* ===== Buttons ===== */
.btn{
  border-radius:12px !important;
  font-weight:600;
  transition:transform .15s ease, box-shadow .2s ease, filter .2s ease;
}

.btn-icon{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  width:2.25rem;
  height:2.25rem;
  border-radius:999px;
  padding:0;
  font-size:1.25rem;
  line-height:1;
  min-width:0;
}

.btn-primary{
  background:linear-gradient(135deg, #7A5CCF, #492F92) !important;
  border:0 !important;
  color:var(--brand-ink) !important;
  box-shadow:0 12px 28px rgba(73,47,146,.22);
}

.btn-primary:hover,
.btn-primary:focus{
  filter:brightness(1.02);
  box-shadow:0 16px 32px rgba(73,47,146,.28);
}

.btn-primary:focus-visible{
  outline:3px solid rgba(73,47,146,.3);
  outline-offset:2px;
}

.btn-primary:active{
  transform:translateY(1px);
  box-shadow:0 10px 20px rgba(73,47,146,.24);
}

.btn-primary:disabled,
.btn-primary.disabled{
  background:linear-gradient(135deg, rgba(122,92,207,.6), rgba(73,47,146,.6)) !important;
  box-shadow:none;
  filter:none;
}

.btn-soft-brand{
  background:rgba(73,47,146,.1) !important;
  color:var(--brand) !important;
  border:0 !important;
  box-shadow:none !important;
}

.btn-soft-brand:hover,
.btn-soft-brand:focus{
  background:rgba(73,47,146,.16) !important;
  color:var(--brand) !important;
}

.btn-soft-brand:focus-visible{
  outline:3px solid rgba(73,47,146,.25);
  outline-offset:2px;
}

.btn-soft-brand:active{
  transform:translateY(1px);
}

.card-header-brand{
  background:linear-gradient(135deg, #7A5CCF, #492F92) !important;
  color:var(--brand-ink) !important;
  border-bottom:0 !important;
  padding:1rem 1.5rem;
}

.card-header-brand .h5,
.card-header-brand h2{
  margin:0;
}

.event-attendee-toolbar{
  margin-top:1.5rem;
}

.event-attendee-panel{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:1rem 1.25rem;
  box-shadow:0 6px 18px rgba(73,47,146,.08);
}

.event-attendee-list{
  list-style:none;
  margin:0;
  padding:0;
}

.event-attendee-list__item{
  display:flex;
  flex-direction:column;
  gap:.45rem;
  padding:.75rem 0;
  border-bottom:1px solid var(--border);
}

.event-attendee-list__item:first-child{ padding-top:0; }
.event-attendee-list__item:last-child{ border-bottom:0; padding-bottom:0; }

@media (min-width: 576px){
  .event-attendee-list__item{
    flex-direction:row;
    justify-content:space-between;
    align-items:center;
  }
}

.event-attendee-name{
  font-weight:600;
  color:var(--text);
}

.event-attendee-meta{
  display:flex;
  flex-wrap:wrap;
  gap:.75rem;
  font-size:.9rem;
  color:var(--text-muted);
}

.event-attendee-meta__link{
  color:var(--brand);
  font-weight:600;
  text-decoration:none;
}

.event-attendee-meta__link:hover,
.event-attendee-meta__link:focus{
  text-decoration:underline;
}

/* ===== Hero / welcome ===== */
.welcome-section{
  text-align:center;
  padding:4rem 2rem;
}
.welcome-section h1{
  color:#8e44ad;
  font-size:2.5rem;
  margin-bottom:1rem;
}
.welcome-section p{
  font-size:1.2rem;
  max-width:600px;
  margin:auto;
}

/* ===== PAR-Q responsive layout ===== */
.parq-head{
  display:grid;
  grid-template-columns: 1fr auto auto minmax(260px, 1fr);
  gap:10px;
  padding:8px 10px;
  font-weight:700;
  color:var(--text-muted);
  border-bottom:1px solid var(--border);
  margin-bottom:6px;
}

.parq-questions{ display:flex; flex-direction:column; gap:6px; }

.parq-row{
  display:grid;
  grid-template-columns: 1fr auto auto minmax(260px, 1fr);
  gap:10px;
  align-items:center;
  padding:10px;
  border-bottom:1px solid var(--border);
  border-radius:8px;
  background: var(--surface);
}

.parq-row:last-child{ border-bottom:0; }

.parq-details .form-control{ width:100%; }

/* Error highlight */
.parq-error{ box-shadow:0 0 0 3px rgba(220,53,69,.25); }
.parq-error .form-control.is-invalid{ border-color:#dc3545; }

/* Mobile: stack question above details; radios sit between */
@media (max-width: 576px){
  .parq-head{ display:none; }
  .parq-row{
    grid-template-columns: 1fr;     /* single column */
    gap:8px;
  }
  .parq-yn{ display:inline-flex; align-items:center; gap:.4rem; }
  .parq-details{ order: 3; }        /* ensure details appear below the question + radios */
}

/* ===== Admin Validate: Mobile card layout ===== */
.table-validate .actions .btn-wrap {
  display: inline-flex;
  gap: .5rem;
}

@media (max-width: 576px){
  .table-validate thead { 
    display: none !important; 
  }
  .table-validate tbody tr{
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
  }
  .table-validate tbody td{
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: .5rem;
    border: 0 !important;
    padding: .65rem .8rem !important;
    word-break: break-word;
  }
  .table-validate tbody td::before{
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
  }
  .table-validate tbody td.actions .btn-wrap{
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: .5rem;
  }
  .table-validate tbody td.actions .btn{
    width: 100%;
  }
  .table-validate .badge small{
    font-size: .78rem;
    line-height: 1.2;
  }
}

/* ===== Attendance modal: mobile enhancements ===== */
#attendanceModal .list-group {
  max-height: 40vh;
  overflow: auto;
}
#attendanceModal #bookedUserList {
  max-height: 40vh;
  overflow: auto;
}
#attendanceModal .modal-dialog {
  max-height: 100vh;
}
#attendanceModal .modal-content,
#attendanceModal form {
  height: 100%;
}
#attendanceModal .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
}
#attendanceModal .modal-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  margin: 0;
}
@media (max-width: 576px){
  #attendanceModal .modal-title { font-size: 1.1rem; }
  #attendanceModal .form-control-lg {
    font-size: 1rem;
    padding-top: .6rem;
    padding-bottom: .6rem;
  }
}

/* ===== Attendance modal: stacked attendee row ===== */
#attendanceModal .attendee-item { display: flex; flex-direction: column; }
#attendanceModal .attendee-ident small { line-height: 1.2; }
#attendanceModal .attendee-choices {
  display: flex;
  align-items: center;
  gap: .75rem;
}
#attendanceModal .attendee-choices .form-check { margin: 0; }

/* ===== Footer ===== */
.site-footer{
  background:var(--surface);
  border-top:3px solid var(--brand);
}
.footer-inner{
  max-width:1100px;
  margin:0 auto;
  padding:14px 16px;
  display:flex;
  flex-direction:column;     /* mobile: stacked + centred */
  align-items:center;
  text-align:center;
  gap:.5rem;
  color:var(--text-muted);
  font-size:.95rem;
}
.footer-left .brand{
  font-weight:700;
  letter-spacing:.2px;
  color:var(--brand);
}
.footer-right{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:.5rem;
  justify-content:center;    /* mobile centre */
}
.version-badge{
  display:inline-block;
  padding:.18rem .5rem;
  line-height:1;
  border-radius:999px;
  background:var(--brand);
  color:var(--brand-ink);
  font-weight:600;
  font-size:.85rem;
}

/* >=640px: split footer left|right */
@media (min-width:640px){
  .footer-inner{
    flex-direction:row;
    justify-content:space-between;
    text-align:left;
  }
  .footer-right{ justify-content:flex-end; }
}

/* Responsive typography for welcome */
@media (max-width:768px){
  .welcome-section h1{ font-size:2rem; }
  .welcome-section p{ font-size:1rem; }
}

/* Dark-mode polish (optional, brand-friendly) */
@media (prefers-color-scheme: dark){
  .site-footer{ background:#12101a; border-top-color:#5d49a8; }
  .footer-inner{ color:#c3c8d1; }
  .footer-left .brand{ color:#cbbdf0; }
}

/* Utilities */
.hover-shadow:hover{
  box-shadow:0 0 15px rgba(160,88,188,.4) !important;
  transform:translateY(-3px);
  transition:all .3s ease-in-out;
}
a.forgot-link{ color:#f35b18 !important; text-decoration:underline !important; }
a.forgot-link:hover, a.forgot-link:focus{ opacity:.85; text-decoration:underline; }

/* ===== Admin class pages: mobile polish ===== */

/* Make the top cards a horizontal scroller on phones */
@media (max-width: 576px){
  .top-nav-cards{
    display:flex;
    overflow-x:auto;
    gap:12px;
    padding-bottom: 4px;
    margin-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .top-nav-cards > [class*="col-"]{
    flex: 0 0 auto;
    width: 80%;
    max-width: 320px;
    scroll-snap-align: start;
  }
}

/* Sticky bottom action bar on mobile */
.sticky-actions{
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(249,245,251,0.95), rgba(249,245,251,0.6));
  border-top: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

/* Add bottom padding so content isn't hidden behind sticky bar */
.has-sticky-actions{
  padding-bottom: 80px; /* space for the sticky action bar */
}

/* Bigger, thumb-friendly controls on phones */
@media (max-width: 576px){
  .admin-form .form-control,
  .admin-form .form-select{
    min-height: 44px;
    font-size: 1rem;
  }
  .admin-form .btn{
    min-height: 44px;
  }
}

/* Subtle hover on cards */
.hover-shadow{
  transition: box-shadow .2s ease, transform .2s ease;
}
.hover-shadow:hover{ box-shadow:0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }

/* Compact, phone-first pagination */
@media (max-width: 576px){
  .pagination { overflow-x: auto; white-space: nowrap; }
  .pagination .page-link { padding: .35rem .5rem; font-size: .95rem; }
  /* Hide wide controls on phones */
  .pagination .pg-first,
  .pagination .pg-last,
  .pagination .pg-prev5,
  .pagination .pg-next5 { display: none; }
}


.widget-doodle .doodle-img {
  display: block;
  margin: 0 auto;
  max-height: 300px;     
  width: auto !important;/* prevent Bootstrap .img-fluid forcing 100% width */
  max-width: 100%;       /* never overflow the card on small screens */
  height: auto;          /* keep aspect ratio */
  object-fit: contain;   /* handle odd aspect ratios gracefully */
}

/* Admin stats history: stack rows on phones */
@media (max-width: 600px){
  .stats-history-table thead{ display:none; }
  .stats-history-table{ border-collapse:separate; border-spacing:0; }
  .stats-history-table tbody{ display:flex; flex-direction:column; gap:12px; }
  .stats-history-table tbody tr{
    display:block;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:12px;
    padding:.75rem .85rem;
    box-shadow:0 6px 16px rgba(0,0,0,.05);
  }
  .stats-history-table tbody tr:last-child{ margin-bottom:0; }
  .stats-history-table tbody td{
    display:grid;
    grid-template-columns:minmax(120px, 1fr) 1fr;
    gap:.45rem;
    align-items:center;
    border:0 !important;
    padding:.45rem 0 !important;
  }
  .stats-history-table tbody td::before{
    content:attr(data-label);
    font-weight:600;
    font-size:.85rem;
    color:var(--text-muted);
  }
  .stats-history-table tbody td.actions{
    border-top:1px solid var(--border) !important;
    margin-top:.6rem;
    padding-top:.75rem !important;
    display:flex;
    flex-direction:column;
    gap:.5rem;
  }
  .stats-history-table tbody td.actions::before{
    margin-bottom:.25rem;
  }
  .stats-history-table tbody td.actions .btn{
    width:100%;
  }
}
* ===== Member Settings ===== */
.settings-card {
  border: 1px solid rgba(73,47,146,.08);
  box-shadow: 0 10px 24px rgba(73,47,146,.06);
}

.settings-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(73,47,146,.12);
  background: var(--surface);
}

.settings-card .form-text {
  font-size: .85rem;
}

@media (max-width: 576px) {
  .settings-avatar {
    width: 110px;
    height: 110px;
  }
}
/* ===== Messenger ===== */
.messenger-shell{
  display:flex;
  gap:1.2rem;
  background:var(--surface);
  border-radius:18px;
  box-shadow:0 18px 40px rgba(73,47,146,.08);
  border:1px solid rgba(0,0,0,.04);
  min-height:68vh;
  overflow:hidden;
}
.messenger-cta{
  border:none;
  border-radius:999px;
  padding:.55rem 1.4rem;
  font-weight:600;
  letter-spacing:.01em;
  background:linear-gradient(135deg, #6b4bc9, #3f247f);
  color:#fff;
  box-shadow:0 12px 24px rgba(73,47,146,.22);
  transition:transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.messenger-cta:hover{
  transform:translateY(-1px);
  box-shadow:0 16px 30px rgba(73,47,146,.28);
  filter:brightness(1.03);
  color:#fff;
}
.messenger-cta:focus-visible{
  outline:3px solid rgba(73,47,146,.25);
  outline-offset:2px;
}
.messenger-kind-toggle{
  background:rgba(73,47,146,.08);
  border-radius:999px;
  padding:.35rem;
  gap:.35rem;
}
.messenger-kind-btn{
  border-radius:999px;
  border:1px solid transparent;
  color:#2a1b62;
  font-weight:600;
  padding:.4rem 1rem;
  background:transparent;
  transition:background-color .2s ease, box-shadow .2s ease, color .2s ease, border-color .2s ease;
  margin-left:0;
}
.messenger-kind-btn:hover{
  background:rgba(255,255,255,.8);
  color:#2a1b62;
}
.btn-check:checked + .messenger-kind-btn{
  background:#fff;
  border-color:rgba(73,47,146,.2);
  color:#2a1b62;
  box-shadow:0 8px 16px rgba(73,47,146,.18);
}
.messenger-sidebar{
  width:320px;
  background:linear-gradient(180deg, rgba(73,47,146,.08), rgba(73,47,146,.02));
  border-right:1px solid rgba(73,47,146,.08);
  padding:1.1rem;
  display:flex;
  flex-direction:column;
}
.messenger-sidebar__threads{
  margin:0 -1.1rem;
  padding:0;
  list-style:none;
  overflow-y:auto;
  overflow-x:hidden;
  flex:1 1 auto;
  border-top:1px solid rgba(73,47,146,.1);
}
.messenger-thread{
  display:flex;
  gap:.75rem;
  padding:.85rem 1.1rem;
  align-items:center;
  cursor:pointer;
  border-bottom:1px solid rgba(73,47,146,.06);
  transition:background-color .2s ease, border-color .2s ease;
  text-decoration:none;
  color:inherit;
  overflow:hidden;
  box-sizing:border-box;
}
.messenger-thread:hover{ background:rgba(73,47,146,.08); text-decoration:none; }
.messenger-thread.active{ background:rgba(73,47,146,.16); box-shadow:inset 4px 0 0 var(--brand); }
.messenger-thread__avatar-wrap{
  position:relative;
  width:48px;
  height:48px;
  flex:0 0 48px;
}
.messenger-thread__avatar{
  width:100%;
  height:100%;
  border-radius:50%;
  object-fit:cover;
  border:2px solid rgba(73,47,146,.18);
  display:block;
}
.messenger-thread__avatar-wrap.is-online::after{
  content:"";
  position:absolute;
  right:-1px;
  bottom:-1px;
  width:12px;
  height:12px;
  border-radius:50%;
  background:#24c96b;
  border:2px solid #fff;
  box-shadow:0 0 0 1px rgba(36,201,107,.35);
}
.messenger-thread__body{ flex:1 1 auto; min-width:0; }
.messenger-thread__name{
  font-weight:600;
  color:#2a1b62;
  display:flex;
  align-items:center;
  gap:.35rem;
  min-width:0;
}
.messenger-thread__title{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  flex:1 1 auto;
}
.messenger-thread__snippet{
  font-size:.85rem;
  color:var(--bs-gray-600);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-width:0;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.messenger-thread__badge{
  background:var(--brand);
  color:#fff;
  font-weight:700;
  font-size:.7rem;
  border-radius:999px;
  padding:.15rem .55rem;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:1.35rem;
  line-height:1;
  white-space:nowrap;
  overflow-wrap:normal;
  word-break:normal;
  flex:0 0 auto;
}
.messenger-thread__actions{ display:flex; align-items:center; gap:.35rem; }
.messenger-thread__mute{ border:none; background:transparent; color:var(--bs-gray-500); padding:.2rem .4rem; border-radius:8px; line-height:1; cursor:pointer; font-size:.75rem; }
.messenger-thread__mute.is-muted{ color:var(--bs-primary); }
.messenger-thread__mute:hover{ color:var(--bs-primary); background:rgba(13,110,253,.12); }
.messenger-thread__mute:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }
.messenger-thread__delete{ border:none; background:transparent; color:var(--bs-gray-500); padding:.2rem; border-radius:8px; line-height:1; cursor:pointer; }
.messenger-thread__delete:hover{ color:var(--bs-danger); background:rgba(220,53,69,.12); }
.messenger-thread__delete:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }

.messenger-content{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  background:#fff;
  border-radius:16px;
  border:1px solid rgba(73,47,146,.08);
  padding:1.2rem;
  min-height:60vh;
}
.messenger-content__header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:1rem;
  padding-bottom:.75rem;
  border-bottom:1px solid rgba(73,47,146,.1);
  margin-bottom:1rem;
}
.messenger-content__back{
  font-weight:600;
  padding-left:0;
  padding-right:0;
  color:var(--brand);
}
.messenger-content__back:hover,
.messenger-content__back:focus{
  color:#2a1b62;
  text-decoration:none;
}
.messenger-content__participants{ font-weight:600; color:#2a1b62; }
.messenger-content__status{ font-size:.8rem; color:var(--bs-gray-500); }
.messenger-content__actions{ display:flex; align-items:center; gap:.5rem; }
.messenger-group-members{ display:flex; flex-wrap:wrap; gap:.35rem; }
.group-member-chip{ display:inline-flex; align-items:center; gap:.35rem; background:#f1f3f5; color:#2a1b62; border-radius:999px; padding:.15rem .5rem; font-size:.75rem; }
.group-member-chip button{ border:none; background:transparent; color:var(--bs-gray-600); font-size:.75rem; line-height:1; cursor:pointer; }
.group-member-chip button:hover{ color:var(--bs-danger); }
.messenger-group-avatar{
  display:flex;
  align-items:center;
  gap:.85rem;
}
.messenger-group-avatar__preview{
  width:68px;
  height:68px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid rgba(73,47,146,.18);
  background:#fff;
  box-shadow:0 8px 18px rgba(0,0,0,.1);
}
.messenger-group-avatar__controls{
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
}
.messenger-ghost-btn{
  border-radius:999px;
  border:1px solid rgba(73,47,146,.2);
  background:rgba(73,47,146,.08);
  color:#2a1b62;
}
.messenger-ghost-btn:hover{
  background:rgba(73,47,146,.14);
  color:#2a1b62;
}
.messenger-content__messages{
  flex:1 1 auto;
  overflow-y:auto;
  overflow-x:hidden;
  padding-right:.5rem;
  display:flex;
  flex-direction:column;
  gap:1rem;
}
.messenger-message{
  display:flex;
  align-items:flex-start;
  gap:.75rem;
  max-width:78%;
}
.messenger-message--me{
  margin-left:auto;
  text-align:right;
  flex-direction:row-reverse;
}
.messenger-message__avatar{
  width:42px;
  height:42px;
  border-radius:50%;
  object-fit:cover;
  flex:0 0 42px;
  box-shadow:0 6px 16px rgba(0,0,0,.12);
}
.messenger-message__content{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:.35rem;
  flex:1 1 auto;
  min-width:0;
}
.messenger-message--me .messenger-message__content{ align-items:flex-end; }
.messenger-message__author{
  font-size:.8rem;
  font-weight:600;
  color:var(--bs-gray-600);
}
.messenger-message--me .messenger-message__author{ color:var(--bs-gray-500); }
.messenger-message--me .messenger-message__avatar{ margin-left:.35rem; }
.messenger-message__bubble{
  background:rgba(73,47,146,.08);
  padding:.7rem 1rem;
  border-radius:18px 18px 18px 6px;
  color:#2a1b62;
  line-height:1.4;
  word-break:break-word;
  max-width:100%;
  box-shadow:0 6px 16px rgba(0,0,0,.05);
}
.messenger-message--me .messenger-message__bubble{
  background:linear-gradient(135deg, #7A5CCF, #492F92);
  color:#fff;
  border-radius:18px 18px 6px 18px;
}
.messenger-message__timestamp{ font-size:.75rem; color:var(--bs-gray-500); }
.messenger-message__attachment{ margin-top:.35rem; }
.messenger-message__attachment img{
  width:100%;
  max-width:260px;
  height:auto;
  display:block;
  border-radius:12px;
  box-shadow:0 8px 20px rgba(0,0,0,.12);
}
.messenger-message__attachment audio,
.messenger-message__attachment video{
  width:100%;
  max-width:260px;
  display:block;
  border-radius:12px;
  box-shadow:0 8px 20px rgba(0,0,0,.12);
}
.messenger-message__download{
  margin-top:.35rem;
  font-size:.8rem;
  display:inline-flex;
  align-items:center;
  gap:.25rem;
  color:var(--brand);
  text-decoration:none;
}
.messenger-message__download:hover,
.messenger-message__download:focus{
  text-decoration:underline;
}
.messenger-message__download::before{
  content:'⬇️';
  font-size:.9rem;
}
.messenger-message__attachment video{ height:auto; }
.messenger-message--me .messenger-message__attachment img,
.messenger-message--me .messenger-message__attachment video,
.messenger-message--me .messenger-message__attachment audio{ margin-left:auto; }
.messenger-message__meta{ display:flex; align-items:center; gap:.5rem; font-size:.75rem; color:var(--bs-gray-500); }
.messenger-message__meta--me{ justify-content:flex-end; }
.messenger-message__report{ border:none; background:none; color:var(--bs-danger); padding:0; font-size:.75rem; text-decoration:underline; cursor:pointer; }
.messenger-message__report:hover{ color:var(--bs-danger); text-decoration:none; }
.messenger-message__reactions{ display:flex; align-items:center; gap:.35rem; margin-top:.35rem; flex-wrap:wrap; }
.messenger-message__reaction-bar{ display:flex; gap:.25rem; flex-wrap:wrap; }
.messenger-reaction{ border:1px solid rgba(73,47,146,.2); background:#fff; border-radius:999px; padding:.1rem .45rem; font-size:.8rem; cursor:pointer; }
.messenger-reaction:hover,
.messenger-reaction:focus{ background:rgba(73,47,146,.08); }
.messenger-reaction--add{ border-style:dashed; }
.messenger-reaction--mine{ border-color:var(--brand); background:rgba(73,47,146,.12); }
.messenger-message__content > .messenger-message__reactions{ align-self:flex-start; }
.messenger-message--me .messenger-message__content > .messenger-message__reactions{ align-self:flex-end; }
.messenger-typing{ display:inline-flex; gap:.2rem; align-items:center; margin:0.35rem 0 0.5rem; padding:0.5rem 0.75rem; background:rgba(73,47,146,.07); border-radius:12px; width:fit-content; }
.messenger-typing .dot{ width:6px; height:6px; border-radius:50%; background:rgba(73,47,146,.6); display:inline-block; animation: messengerDot 1s infinite ease-in-out; }
.messenger-typing .dot:nth-child(2){ animation-delay:.15s; }
.messenger-typing .dot:nth-child(3){ animation-delay:.3s; }
@keyframes messengerDot{
  0%, 80%, 100%{ opacity:.2; transform:translateY(0); }
  40%{ opacity:1; transform:translateY(-2px); }
}

.messenger-composer{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:.75rem;
  align-items:flex-end;
  padding-top:1rem;
  border-top:1px solid rgba(73,47,146,.1);
}
.messenger-composer__attachments{ display:flex; align-items:center; gap:.4rem; }
.messenger-composer__attachments .btn{ width:42px; height:42px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; }
.messenger-composer__body{ position:relative; }
.messenger-composer__body textarea{ resize:none; min-height:48px; max-height:160px; }
.messenger-composer__emoji{
  position:absolute;
  bottom:calc(100% + .5rem);
  left:0;
  background:#fff;
  border:1px solid rgba(73,47,146,.12);
  box-shadow:0 18px 40px rgba(18,10,44,.18);
  border-radius:14px;
  padding:.4rem;
  display:grid;
  grid-template-columns:repeat(8, 1fr);
  gap:.25rem;
  max-height:240px;
  overflow-y:auto;
  min-width:240px;
  z-index:1050;
}
.messenger-composer__emoji button{
  background:none;
  border:0;
  font-size:1.3rem;
  line-height:1;
  padding:.2rem;
  border-radius:8px;
  cursor:pointer;
  transition:transform .15s ease, background-color .15s ease;
}
.messenger-composer__emoji button:hover,
.messenger-composer__emoji button:focus{
  transform:scale(1.15);
  background:rgba(73,47,146,.08);
  outline:none;
}
.messenger-composer__emoji button:focus-visible{
  box-shadow:0 0 0 2px rgba(73,47,146,.3);
}
.messenger-composer__preview{ margin-top:.5rem; background:rgba(73,47,146,.05); border-radius:12px; padding:.5rem; display:flex; gap:.5rem; align-items:center; }
.messenger-composer__preview img{ max-width:120px; border-radius:10px; }
.messenger-composer__preview video,
.messenger-composer__preview audio{ max-width:260px; }
.messenger-gif-picker{ position:absolute; bottom:100%; left:0; right:0; background:#fff; border:1px solid rgba(73,47,146,.12); border-radius:12px; padding:.5rem; box-shadow:0 10px 30px rgba(0,0,0,.1); z-index:10; }
.messenger-gif-picker__controls{ margin-bottom:.5rem; }
.messenger-gif-picker__grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(110px, 1fr)); gap:.35rem; max-height:240px; overflow-y:auto; }
.messenger-gif-thumb{ border:none; padding:0; background:transparent; border-radius:10px; overflow:hidden; width:100%; aspect-ratio:1/1; cursor:pointer; }
.messenger-gif-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.messenger-reaction-picker{ position:fixed; background:#fff; border:1px solid rgba(73,47,146,.12); border-radius:12px; padding:.35rem; display:flex; flex-wrap:wrap; gap:.2rem; box-shadow:0 10px 30px rgba(0,0,0,.12); z-index:1000; max-width:240px; }
.messenger-reaction-picker .messenger-reaction{ border:none; background:transparent; padding:.35rem; font-size:1.1rem; line-height:1; }

.messenger-audio-player{
  width:100%;
  max-width:260px;
  display:block;
  border-radius:12px;
  box-shadow:0 8px 20px rgba(0,0,0,.12);
}

.messenger-composer__preview button{ margin-left:auto; }
.messenger-composer__actions .btn{ padding:.6rem 1.2rem; font-weight:600; }

.messenger-new-convo .list-group-item{ cursor:pointer; }
.messenger-new-convo .list-group-item:hover{ background:rgba(73,47,146,.08); }

@media (max-width: 991.98px){
  .messenger-shell{ flex-direction:column; min-height:75vh; }
  .messenger-sidebar{
    width:100%;
    border-right:0;
    border-bottom:1px solid rgba(73,47,146,.1);
    flex:1 1 auto;
    min-height:0;
  }
  .messenger-sidebar__threads{ max-height:none; }
  .messenger-content{ border:0; box-shadow:none; padding:1rem 0; }
  .messenger-content__messages{ padding:0; }
  .messenger-shell--show-list .messenger-content{ display:none; }
  .messenger-shell--show-thread .messenger-sidebar{ display:none; }
  .messenger-shell--show-thread .messenger-content{ padding-top:0; }
  .messenger-shell--show-thread .messenger-content__header{ align-items:center; }
  .messenger-shell--show-thread .messenger-content__back[hidden]{ display:none !important; }
  .messenger-shell--show-thread .messenger-content__back{ margin-right:auto; }
  .messenger-shell--show-list .messenger-content__back,
  .messenger-shell--show-list .messenger-content__status{ display:none; }
}

@media (max-width: 575.98px){
  .messenger-composer{ grid-template-columns:1fr; }
  .messenger-composer__attachments{ order:2; }
  .messenger-composer__actions{ order:3; justify-self:flex-end; }
  .messenger-composer__emoji{ grid-template-columns:repeat(6, 1fr); min-width:200px; }
  .messenger-message{ max-width:100%; }
}
