/* ============================================================
   CJP School Audit v3, user app page layout.
   Tokens and component classes come from css/styles.css.
   This file adds page layout and page specific pieces only.
   ============================================================ */

/* ---------- views ---------- */
.view { min-height: 60vh; }
.view > .container { padding-top: 16px; padding-bottom: 28px; }
.view-title { margin-top: 6px; }

/* ---------- navbar extras ---------- */
/* The navbar carries .glass in v3; keep only its bottom edge line. */
.navbar.glass { border-top: none; border-left: none; border-right: none; }
.avatar-name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .avatar-name { display: none; } .avatar-btn { padding-right: 5px; } }

/* the bottom nav center action is an anchor in this page */
.bottom-nav a.bn-fab { display: grid; place-items: center; text-decoration: none; }

/* ---------- home command center ---------- */
.home-shell { display: block; }
.home-map {
  position: relative; z-index: 0;
  height: 42vh; min-height: 240px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.home-side { padding: 14px; }
.home-panel {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px 20px;
}
.home-panel-title { margin-bottom: 12px; }

/* KPI tiles: swipeable row on small screens, 2 by 2 grid on desktop */
.home-kpis {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(146px, 1fr);
  gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  padding-bottom: 4px; scrollbar-width: none;
}
.home-kpis::-webkit-scrollbar { display: none; }
.home-kpis .kpi-tile { scroll-snap-align: start; }
.home-kpis .sk-kpi { height: 78px; }

.home-strip { margin: 14px 0 8px; }
.home-legend { margin-bottom: 4px; row-gap: 4px; }

.home-filter-toggle { margin-top: 12px; }
.home-filters { display: none; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.home-filters.open { display: flex; }
.home-filters select.input-sm { flex: 1 1 30%; min-width: 118px; max-width: 100%; }
.home-filters .f-search { flex: 1 1 100%; min-width: 130px; }

.home-chart { margin-top: 18px; }
.home-chart-title { font-size: 0.92rem; margin-bottom: 8px; }
.home-feed-link { display: none; margin-top: 20px; width: 100%; }

/* phone and tablet preview of the latest reports */
.home-preview-wrap { padding-bottom: 12px; }
.home-preview-title { margin: 4px 0 12px; }
.home-preview { display: flex; flex-direction: column; gap: 10px; }
.prev-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.prev-thumb { width: 74px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; flex: none; background: var(--surface-2); }
.prev-glyph { width: 74px; height: 56px; border-radius: var(--radius-sm); flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 1.4rem; }
.prev-body { min-width: 0; flex: 1; }
.prev-name { font-weight: 700; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prev-meta { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prev-card .status-chip { flex: none; }
.home-preview-more { text-align: center; margin: 16px 0 6px; }
.home-preview .sk-prev { height: 76px; }

@media (min-width: 768px) {
  .home-map { height: 50vh; }
  .home-side { padding: 18px 20px; }
}
@media (min-width: 1080px) {
  .home-shell { display: grid; grid-template-columns: minmax(0, 1fr) 470px; align-items: start; }
  .home-map-col { position: sticky; top: var(--nav-h); }
  .home-map {
    height: calc(100vh - var(--nav-h)); min-height: 420px;
    border-bottom: none; border-right: 1px solid var(--line);
  }
  .home-side { padding: 22px 22px 32px; }
  .home-panel { padding: 22px; }
  .home-kpis { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr 1fr; overflow: visible; padding-bottom: 0; }
  .home-filter-toggle { display: none; }
  .home-filters { display: flex; margin-top: 14px; }
  .home-feed-link { display: inline-flex; }
  .home-preview-wrap { display: none; }
}

/* ---------- feed page (vertical, single column) ---------- */
.feed-wrap { max-width: 560px; }
.feed-sub { margin: -4px 0 18px; }
.feed-stream { display: flex; flex-direction: column; gap: 18px; }
.feed-more { text-align: center; margin: 18px 0 6px; }

.post-card { overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.post-avatar { width: 40px; height: 40px; font-size: 1.05rem; background: var(--grad-accent); }
.post-head-text { min-width: 0; flex: 1; cursor: pointer; }
.post-school { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-head .status-chip { flex: none; }

/* media area is edge to edge inside the card */
.post-media { background: var(--surface-2); }
.post-media img.post-single { display: block; width: 100%; max-height: 62vh; object-fit: cover; }
.post-media video.post-single { display: block; width: 100%; max-height: 62vh; background: #000; }
.post-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.post-strip::-webkit-scrollbar { display: none; }
.post-strip-cell { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 3; }
.post-strip-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-strip-cell video { width: 100%; height: 100%; display: block; background: #000; }
.post-strip-cell .media-loading { height: 100%; }
.post-dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 0; }
.post-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background 0.15s ease; }
.post-dots .dot.active { background: var(--accent); }

.post-actions { padding: 4px 8px 0; flex-wrap: wrap; }
.post-desc-row { padding: 2px 14px 6px; }
.post-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.92rem; overflow-wrap: anywhere; }
.post-more { font-size: 0.85rem; }
.post-latest { padding: 0 14px 8px; font-size: 0.88rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-latest strong { color: var(--ink); }
.post-composer { display: flex; gap: 8px; padding: 2px 14px 14px; }
.post-composer .input { margin-bottom: 0; flex: 1; }
.feed-stream .sk-card { overflow: hidden; }

/* skeleton helpers (shared shapes) */
.sk-thumb { aspect-ratio: 16 / 9; border-radius: 0; }
.sk-line { height: 14px; margin: 12px 14px 0; }
.sk-line.sk-short { width: 55%; margin-bottom: 16px; }

/* ---------- approval state (my reports + detail) ---------- */
.pill-warn { background: #fdf3d7; color: #7a5600; }
.pend-banner {
  display: flex; gap: 8px; align-items: flex-start;
  background: #fdf3d7; color: #7a5600;
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
  font-size: 0.88rem;
}
.my-pend-note {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 0.82rem; color: #7a5600;
  background: #fdf3d7; border-radius: var(--radius-sm);
  padding: 8px 10px; margin-top: 8px;
}
@media (prefers-color-scheme: dark) {
  .pill-warn, .pend-banner, .my-pend-note { background: #3a2f10; color: #fab219; }
}

/* ---------- detail ---------- */
.detail-wrap { max-width: 720px; }
.back-row { margin: 2px 0 12px; }
.detail-card { padding: 16px; margin-bottom: 14px; overflow: hidden; }
@media (min-width: 768px) { .detail-card { padding: 22px; } }
.detail-media { margin-bottom: 14px; }
.detail-media .media-cell.media-wide { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.detail-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 4px; }
.detail-title-row h2 { margin: 0; overflow-wrap: anywhere; }
.detail-meta { margin-bottom: 10px; }
.detail-loc { font-size: 0.9rem; margin: 10px 0 4px; }
.detail-section-title { margin: 18px 0 8px; }
.detail-actions { flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }
.detail-actions .flag-link { margin-left: auto; }
.comments-card { padding: 16px; margin-bottom: 20px; }
@media (min-width: 768px) { .comments-card { padding: 22px; } }
.composer textarea.input { flex: 1; }
.cmt-count { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.comment-item .avatar { margin-top: 3px; }
.comment-flag { margin-left: auto; flex: none; }

/* ---------- submit ---------- */
.view-submit .wizard-card { margin-bottom: 20px; }
.success-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px;
}

/* ---------- my reports ---------- */
.my-wrap { max-width: 720px; }
.my-list { display: flex; flex-direction: column; gap: 12px; }
.my-card { padding: 14px 16px; cursor: pointer; }
.my-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.my-card-top strong { min-width: 0; overflow-wrap: anywhere; }
.my-badges { display: inline-flex; align-items: center; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.my-counts { display: flex; gap: 14px; margin-top: 6px; color: var(--ink-2); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.my-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* owner edit sheet */
.own-edit-modal .category-grid { margin-bottom: 6px; }

/* ---------- profile ---------- */
.profile-wrap { max-width: 560px; }
.profile-card { padding: 16px; margin-bottom: 14px; }
@media (min-width: 768px) { .profile-card { padding: 20px; } }
.profile-acct { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-acct-info { min-width: 0; flex: 1; }
.profile-acct-info .acct-name { overflow-wrap: anywhere; }
.profile-name-row { display: flex; gap: 8px; align-items: flex-start; }
.profile-name-row .input { flex: 1; }
.profile-lang-row { margin: 6px 0 2px; }
.profile-signout { margin-top: 4px; }
.profile-foot { margin-top: 6px; }
