/* --------------------------------------------------------------------------
   9. Announcements — page & cards

   Loaded after style.css in head.php, so it can override any matching rule
   from the global stylesheet via cascade order.

   The detail view is a real `.bottom-sheet` (assets/components/bottomSheet.css)
   and is NOT styled here. Earlier versions of this file contained a parallel
   `.popup-overlay` / `.popup-content-box` definition — that block was removed
   once the detail view migrated to the canonical sheet component.
   -------------------------------------------------------------------------- */
.announcements-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 8px;
}

.page-header-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 14px;
  margin: 0 -16px 14px;
  background: var(--color-bg-app-alt);
}

/* Non-sticky variant used when the page already has a sticky topbar
   (added in head.php when $pageTitle is set). Same shape, no sticky. */
.page-header-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
}

.page-header-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--color-ink);
}

.page-header-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-mid);
  transition: color 0.2s ease;
}

.page-header-subtitle.all-caught-up {
  color: var(--color-slate);
}

.mark-all-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-secondary);
  box-shadow: var(--shadow-card);
  font-size: 1.05rem;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    color 0.2s ease;
}

.mark-all-btn:hover {
  color: var(--color-primary-mid);
}

.mark-all-btn:active {
  transform: scale(0.92);
}

/* --- List & cards ------------------------------------------------------- */
.announcement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement-card {
  position: relative;
  display: flex;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px;
  cursor: pointer;
  animation: fadeInUp 0.3s ease both;
  transition:
    transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.announcement-card:active {
  transform: scale(0.985);
}

.announcement-card.unread {
  border-color: var(--color-primary-light);
}

.announcement-card.unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--gradient-primary-h);
}

.announcement-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: var(--color-paper);
  color: var(--color-secondary);
}

.announcement-card.unread .announcement-icon {
  background: var(--color-primary-light);
  color: var(--color-primary-mid);
}

.announcement-content {
  flex: 1 1 auto;
  min-width: 0;
}

.announcement-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.announcement-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-card.unread .announcement-title {
  font-weight: 800;
}

.announcement-time {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-slate);
  white-space: nowrap;
  padding-top: 2px;
}

.announcement-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--color-slate);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.unread-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary-mid);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* --- Empty state ---------------------------------------------------------*/
.announcement-empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--color-slate);
}

.announcement-empty p {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Shared page header — sticky native-style back-nav bar.
   Used by announcements.php and sat.php (and any other secondary page that
   needs the same back-button + centered title chrome).
   -------------------------------------------------------------------------- */
.ann-page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 246, 250, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.09);
}

.ann-header-inner {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 52px;
  padding: 0 1px;
  gap: 8px;
}

.ann-back-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: #000000;
  font-size: 26px;
  font-weight: 500;
  padding: 4px 0;
  line-height: 1;
  justify-self: start;
  white-space: nowrap;
}

.ann-back-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.ann-header-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.3px;
  justify-self: center;
}
