/* ==========================================================
   public/css/pages.css
   Styles spécifiques aux pages (anniversaires, livre, browse, profile)
   ========================================================== */

/* ===== Browse / Liste de tous les membres ===== */
.browse-toolbar {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--s-3);
  background: var(--c-overlay);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.browse-toolbar .search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.browse-toolbar .search-box input { padding-left: 2.4rem; }
.browse-toolbar .search-box .material-symbols-rounded {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-muted);
  pointer-events: none;
}

.filter-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 0.35rem 0.85rem;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--c-text);
  cursor: pointer;
  transition: all var(--t-fast);
}
.filter-chip:hover { border-color: var(--teal-500); }
.filter-chip.active {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: white;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-3);
}
@media (max-width: 480px) {
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

.member-card {
  background: var(--c-surface);
  border-radius: var(--r-md);
  padding: var(--s-3);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--c-text);
  box-shadow: var(--sh-sm);
}
.member-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-lg);
  text-decoration: none;
  color: var(--c-text);
}
.member-card .avatar { width: 64px; height: 64px; font-size: 1rem; }
.member-card .name { font-weight: 600; font-size: 0.92rem; line-height: 1.2; }
.member-card .meta { font-size: 0.78rem; color: var(--c-text-muted); }

/* ===== Page profil ===== */
.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-6);
  background: var(--c-overlay);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  align-items: center;
  margin-bottom: var(--s-4);
  box-shadow: var(--sh-md);
}
@media (max-width: 600px) {
  .profile-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: var(--s-4);
    gap: var(--s-3);
  }
  .profile-hero .avatar { margin: 0 auto; }
}
.profile-hero h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin-bottom: 0.3rem;
  color: var(--teal-800);
}
.profile-hero .lifespan {
  font-size: 1rem;
  color: var(--c-text-muted);
  margin-bottom: var(--s-3);
}
.profile-hero .badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
@media (max-width: 600px) { .profile-hero .badges { justify-content: center; } }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
@media (max-width: 768px) {
  .profile-grid { grid-template-columns: 1fr; }
}

.profile-section {
  background: var(--c-overlay);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--sh-sm);
}
.profile-section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
  margin-bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.profile-section h2 .material-symbols-rounded {
  color: var(--teal-500);
  font-size: 1.2rem;
}

.relations-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.relations-list a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border-radius: var(--r-md);
  color: var(--c-text);
  transition: background var(--t-fast);
}
.relations-list a:hover {
  background: var(--c-bg);
  text-decoration: none;
}
.relations-list .info { flex: 1; min-width: 0; }
.relations-list .name { font-weight: 600; font-size: 0.92rem; }
.relations-list .meta { font-size: 0.78rem; color: var(--c-text-muted); }

.bio {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--c-text);
  text-align: justify;
}
.bio.empty { color: var(--c-text-subtle); font-style: italic; text-align: center; }

/* ===== Anniversaires ===== */
.month-tabs {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding: var(--s-2) 0;
  scrollbar-width: thin;
}
.month-tabs button {
  padding: 0.45rem 0.8rem;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--c-surface);
  color: var(--c-text-muted);
  flex-shrink: 0;
  border: 1.5px solid var(--c-border);
  transition: all var(--t-fast);
}
.month-tabs button:hover { border-color: var(--teal-500); color: var(--teal-700); }
.month-tabs button.active {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: white;
}

.birthday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.birthday-card {
  background: var(--c-overlay);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  box-shadow: var(--sh-sm);
  transition: all var(--t-fast);
  text-decoration: none;
  color: var(--c-text);
}
.birthday-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  color: var(--c-text);
  text-decoration: none;
}
.birthday-card .info { flex: 1; min-width: 0; }
.birthday-card .name { font-weight: 600; }
.birthday-card .date { font-size: 0.85rem; color: var(--c-text-muted); }
.birthday-card .age-pill {
  background: var(--rose-500);
  color: white;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.birthday-card.in-memoriam .age-pill {
  background: var(--c-text-muted);
}
.birthday-card.in-memoriam .info { color: var(--c-text-muted); }

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--c-text-muted);
  margin: var(--s-6) 0 var(--s-3);
}
.section-title .count {
  background: var(--teal-700);
  color: white;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
}

/* ===== Statistiques ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.stat-card {
  background: var(--c-overlay);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  text-align: center;
  box-shadow: var(--sh-sm);
}
.stat-card .number {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--teal-700);
  font-family: var(--font-serif);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.stat-card .label {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card.female .number { color: var(--rose-500); }
.stat-card.male .number { color: var(--c-male); }

.gender-bar {
  display: flex;
  height: 32px;
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: var(--s-2);
}
.gender-bar .seg-male {
  background: var(--c-male);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}
.gender-bar .seg-female {
  background: var(--c-female);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ===== Livre de famille (impression) ===== */
.book-actions {
  background: var(--c-overlay);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: var(--s-4);
}
.book-page {
  background: white;
  margin: 0 auto var(--s-4);
  padding: 2.5cm 2cm;
  max-width: 21cm;
  min-height: 27cm;
  box-shadow: var(--sh-xl);
  border-radius: var(--r-md);
}
.book-page-header {
  text-align: center;
  border-bottom: 2px solid var(--teal-500);
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-5);
}
.book-page-header h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--teal-800);
}
.book-page-header p { color: var(--c-text-muted); }

.book-entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-divider);
  page-break-inside: avoid;
}
.book-entry:last-child { border-bottom: none; }
.book-entry .photo {
  width: 70px;
  height: 70px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: white;
}
.book-entry .photo.male { background: var(--c-male); }
.book-entry .photo.female { background: var(--c-female); }
.book-entry .photo img { width: 100%; height: 100%; object-fit: cover; }
.book-entry .info h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--teal-800);
}
.book-entry .info .lifespan {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  margin-bottom: 0.4rem;
}
.book-entry .info .meta {
  font-size: 0.85rem;
  line-height: 1.5;
}

@media print {
  body {
    background: white !important;
    background-image: none !important;
    padding: 0 !important;
  }
  .navbar, .toast-stack, .book-actions, .fab { display: none !important; }
  .book-page {
    box-shadow: none;
    margin: 0;
    border-radius: 0;
    page-break-after: always;
  }
}

/* ===== Pages d'erreur ===== */
.error-page {
  text-align: center;
  padding: var(--s-12) var(--s-4);
  max-width: 560px;
  margin: var(--s-8) auto;
  background: var(--c-overlay);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
}
.error-page .emoji {
  font-size: 5rem;
  margin-bottom: var(--s-3);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}
.error-page .code {
  font-family: var(--font-serif);
  font-size: 4rem;
  font-weight: 700;
  color: var(--teal-700);
  line-height: 1;
}
.error-page .title {
  font-size: 1.4rem;
  margin: var(--s-2) 0 var(--s-3);
}
.error-page .description {
  color: var(--c-text-muted);
  margin-bottom: var(--s-5);
  line-height: 1.65;
}
.error-page .actions {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
