/* ===== Annif — style festif ===== */

@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-var.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --violet: #7b2ff7;
  --magenta: #d3208b;
  --orange: #ff7a3d;
  --grad-main: linear-gradient(135deg, #7b2ff7, #d3208b 55%, #ff7a3d);
  --grad-hero: linear-gradient(135deg, #6a11cb, #b620ba 50%, #ff5470);
  --ink: #2d2440;
  --muted: #877fa0;
  --card-shadow: 0 8px 26px rgba(123, 47, 247, 0.10);
  --radius: 20px;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at -10% -10%, rgba(211, 32, 139, 0.08), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(255, 122, 61, 0.10), transparent 60%),
    #faf6ff;
  background-attachment: fixed;
  padding-bottom: 130px;
  min-height: 100vh;
}

/* ===== En-tête ===== */

.app-header {
  background: var(--grad-main);
  color: #fff;
  padding: calc(18px + env(safe-area-inset-top)) 0 22px;
  border-radius: 0 0 26px 26px;
  box-shadow: 0 10px 30px rgba(123, 47, 247, 0.30);
  margin-bottom: 20px;
}

.app-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.app-subtitle {
  font-size: 0.86rem;
  opacity: 0.88;
  font-weight: 700;
}

.app-main { max-width: 1140px; }

/* ===== Navigation basse ===== */

.app-nav {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(45, 36, 64, 0.20);
  z-index: 1030;
}

.app-nav button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 18px;
  font-weight: 800;
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  transition: color 0.15s;
}

.app-nav button .ico { font-size: 1.15rem; line-height: 1.2; }

.app-nav button.active {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 4px 14px rgba(211, 32, 139, 0.35);
}

/* ===== Bouton flottant + ===== */

.btn-fab {
  position: fixed;
  right: 18px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  background: var(--grad-main);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(211, 32, 139, 0.40);
  z-index: 1030;
  transition: transform 0.15s;
}

.btn-fab:hover { transform: scale(1.08); }

/* ===== Carte héro (accueil) ===== */

.hero-card {
  position: relative;
  overflow: hidden;
  background: var(--grad-hero);
  color: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(106, 17, 203, 0.30);
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
}

.hero-card::before { width: 190px; height: 190px; top: -70px; right: -50px; }
.hero-card::after { width: 240px; height: 240px; bottom: -120px; left: -80px; }

.hero-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.85;
  margin-bottom: 14px;
}

.hero-body {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.hero-avatars { display: flex; }

.hero-avatars .avatar.big {
  width: 62px;
  height: 62px;
  font-size: 1.35rem;
  border: 3px solid rgba(255, 255, 255, 0.85);
}

.hero-avatars .avatar.big + .avatar.big { margin-left: -14px; }

.hero-names { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }

.hero-date { font-weight: 700; opacity: 0.92; margin-top: 3px; }

.hero-date-hijri { font-size: 0.86rem; font-weight: 700; opacity: 0.85; margin-top: 2px; }

.hero-age { font-size: 0.88rem; font-weight: 700; opacity: 0.92; margin-top: 3px; }

.hero-counter {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.hero-count { font-size: 3rem; font-weight: 800; line-height: 1; }

.hero-count-label { font-weight: 700; opacity: 0.9; }

.hero-today .hero-count { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* Ballons du jour J */
.balloons span {
  position: absolute;
  bottom: -46px;
  font-size: 1.7rem;
  animation: float-up 5.5s linear infinite;
  opacity: 0.85;
  z-index: 0;
}
.balloons span:nth-child(1) { left: 8%; animation-delay: 0s; }
.balloons span:nth-child(2) { left: 30%; animation-delay: 1.8s; }
.balloons span:nth-child(3) { left: 55%; animation-delay: 0.9s; }
.balloons span:nth-child(4) { left: 72%; animation-delay: 2.6s; }
.balloons span:nth-child(5) { left: 88%; animation-delay: 1.3s; }

@keyframes float-up {
  from { transform: translateY(0) rotate(0deg); opacity: 0.85; }
  to { transform: translateY(-360px) rotate(14deg); opacity: 0; }
}

/* ===== Sections & cartes membre ===== */

.section-title {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 24px 0 12px;
}

.upcoming-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 576px) { .upcoming-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 992px) { .upcoming-grid { grid-template-columns: repeat(4, 1fr); } }

.list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) { .list-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .list-grid { grid-template-columns: repeat(3, 1fr); } }

.member-card {
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: rise 0.35s ease both;
}

.member-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(123, 47, 247, 0.18);
}

.member-card.is-today {
  background: #fff5fa;
  outline: 2px solid var(--magenta);
}

.member-info { flex: 1; min-width: 0; }

.m-name {
  font-weight: 800;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-date { font-size: 0.8rem; color: var(--muted); font-weight: 700; }

.m-date-hijri { font-size: 0.74rem; color: #16a085; font-weight: 700; margin-top: 1px; }

.age-badge {
  display: inline-block;
  background: #f1ecfb;
  color: var(--violet);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-left: 4px;
}

.avatar {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.member-card.mini .avatar { width: 40px; height: 40px; min-width: 40px; font-size: 0.9rem; }

img.avatar.photo {
  display: block;
  object-fit: cover;
}

.avatar.g0 { background: linear-gradient(135deg, #7b2ff7, #a55eea); }
.avatar.g1 { background: linear-gradient(135deg, #d3208b, #ff5470); }
.avatar.g2 { background: linear-gradient(135deg, #ff7a3d, #ffb35c); }
.avatar.g3 { background: linear-gradient(135deg, #2ec4b6, #5bd9cd); }
.avatar.g4 { background: linear-gradient(135deg, #4c9aff, #7ab8ff); }
.avatar.g5 { background: linear-gradient(135deg, #e67e22, #f5a623); }
.avatar.g6 { background: linear-gradient(135deg, #6a89cc, #82ccdd); }
.avatar.g7 { background: linear-gradient(135deg, #e056a0, #f78fb3); }

.days-chip {
  background: #f1ecfb;
  color: var(--violet);
  font-weight: 800;
  font-size: 0.76rem;
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}

.days-chip.soon { background: #ffe9e2; color: #e8531f; }

.days-chip.today {
  background: var(--grad-main);
  color: #fff;
  animation: pulse 1.6s ease-in-out infinite;
}

/* ===== Groupes par mois ===== */

.month-group { margin-bottom: 6px; }

.month-header {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 0.98rem;
  margin: 22px 0 10px;
}

.month-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--mc, var(--violet));
}

.month-count {
  background: #ece7f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 9px;
}

.m1 { --mc: #7b2ff7; } .m2 { --mc: #d3208b; } .m3 { --mc: #ff5470; }
.m4 { --mc: #ff7a3d; } .m5 { --mc: #f5a623; } .m6 { --mc: #2ec4b6; }
.m7 { --mc: #16a085; } .m8 { --mc: #4c9aff; } .m9 { --mc: #6a89cc; }
.m10 { --mc: #9b59b6; } .m11 { --mc: #e056a0; } .m12 { --mc: #c0392b; }

/* ===== Recherche ===== */

.search-wrap { margin-bottom: 6px; }

.search-wrap input {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  box-shadow: var(--card-shadow);
}

.search-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(123, 47, 247, 0.25);
}

/* ===== Réglages ===== */

.settings-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--card-shadow);
  margin-bottom: 14px;
}

.settings-card h3 { font-size: 1rem; font-weight: 800; margin-bottom: 10px; }

.settings-subsection {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f0ecf9;
}

.settings-subsection h4 {
  font-size: 0.9rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.form-check-input:checked {
  background-color: var(--violet);
  border-color: var(--violet);
}

.form-check-label { font-weight: 700; }

/* ===== Sélecteur de photo (modale) ===== */

.photo-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.photo-picker {
  position: relative;
  cursor: pointer;
  display: inline-block;
}

.photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--grad-main);
  color: #fff;
  font-weight: 800;
  font-size: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 3px 10px rgba(45, 36, 64, 0.28);
}

/* ===== Boutons / modale / toast ===== */

.btn-gradient {
  background: var(--grad-main);
  border: 0;
  color: #fff;
  font-weight: 800;
}

.btn-gradient:hover, .btn-gradient:focus { color: #fff; filter: brightness(1.07); }

.btn-outline-primary { --bs-btn-color: var(--violet); --bs-btn-border-color: var(--violet);
  --bs-btn-hover-bg: var(--violet); --bs-btn-hover-border-color: var(--violet); font-weight: 800; }

.modal-content { border: 0; border-radius: 22px; }

.modal-title { font-weight: 800; }

.form-label { font-weight: 800; font-size: 0.86rem; }

#app-toast { background: #2d2440; color: #fff; border-radius: 14px; font-weight: 700; }

/* ===== États vides ===== */

.empty-state {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  padding: 46px 12px;
  font-size: 1.02rem;
  line-height: 1.9;
}

/* ===== Confettis ===== */

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  overflow: hidden;
}

#confetti-layer i {
  position: absolute;
  top: -3vh;
  display: block;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to { transform: translateY(108vh) rotate(var(--rot, 540deg)); }
}

/* ===== Animations d'apparition ===== */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card, .settings-card, .month-header { animation: rise 0.35s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
