/**
 * UNIVGA PWA — Écran d'accueil premium
 * Affiché uniquement en mode installé (app), injecté dans .account-content.
 * Inspiré des meilleures apps d'apprentissage : hero dégradé, carte « continuer »
 * en superposition, statistiques animées, tuiles d'accès rapide.
 */

:root {
  --uvg-blue: #0B4F8C;
  --uvg-blue-2: #1565C0;
  --uvg-green: #1E7A34;
  --uvg-ink: #16263a;
  --uvg-muted: #6b7a90;
  --uvg-bg: #f4f7fb;
}

/* Anti-flash : tant que l'accueil n'est pas prêt, masquer le tableau de bord
   rendu côté serveur et la barre supérieure (la vue par défaut est l'accueil). */
html.univga-pwa-standalone.univga-home-booting #tab-dashboard,
html.univga-pwa-standalone.univga-home-booting .account-topbar {
  display: none !important;
}
html.univga-pwa-standalone.univga-home-booting .account-content {
  background: var(--uvg-bg) !important;
}

/* Quand l'accueil est actif : contenu plein-cadre, topbar masquée */
html.univga-pwa-standalone .account-content.univga-home-active {
  padding: 0 !important;
  margin: 0 !important;
  background: var(--uvg-bg) !important;
}
html.univga-pwa-standalone .univga-account-wrapper.univga-home-mode .account-topbar {
  display: none !important;
}

/* ───────── Conteneur ───────── */
#univga-app-home {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--uvg-ink);
  background: var(--uvg-bg);
  padding-bottom: 28px;
  animation: uvgHomeIn .5s ease both;
}
@keyframes uvgHomeIn { from { opacity: 0; } to { opacity: 1; } }

#univga-app-home .uvg-section {
  padding: 0 18px;
}
#univga-app-home .uvg-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 18px 12px;
}
#univga-app-home .uvg-section-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
#univga-app-home .uvg-section-head a {
  font-size: .82rem;
  font-weight: 700;
  color: var(--uvg-blue-2);
  text-decoration: none;
}

/* ───────── HERO ───────── */
#univga-app-home .uvg-hero {
  position: relative;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 20px 64px;
  background: linear-gradient(135deg, #0B4F8C 0%, #1565C0 48%, #1E7A34 128%);
  color: #fff;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(11, 79, 140, .28);
}
#univga-app-home .uvg-hero::before,
#univga-app-home .uvg-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  filter: blur(2px);
}
#univga-app-home .uvg-hero::before { width: 180px; height: 180px; top: -70px; right: -40px; }
#univga-app-home .uvg-hero::after  { width: 120px; height: 120px; bottom: 10px; left: -50px; background: rgba(255,255,255,.08); }

#univga-app-home .uvg-hero-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#univga-app-home .uvg-hello {
  font-size: .9rem;
  font-weight: 600;
  opacity: .9;
  margin: 0 0 3px;
}
#univga-app-home .uvg-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -.02em;
  line-height: 1.15;
}
#univga-app-home .uvg-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  font-size: .74rem;
  font-weight: 700;
}
#univga-app-home .uvg-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid rgba(255, 255, 255, .85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  flex: none;
  cursor: pointer;
}

/* ───────── Carte « Continuer » (superposée) ───────── */
#univga-app-home .uvg-continue {
  position: relative;
  z-index: 3;
  margin: -46px 18px 0;
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: 0 14px 34px rgba(11, 79, 140, .16);
  animation: uvgUp .55s .05s cubic-bezier(.2,.7,.3,1) both;
}
#univga-app-home .uvg-continue-thumb {
  width: 64px; height: 64px;
  border-radius: 16px;
  flex: none;
  background: linear-gradient(135deg, var(--uvg-blue), var(--uvg-green));
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 6px 16px rgba(11, 79, 140, .25);
}
#univga-app-home .uvg-continue-info { min-width: 0; flex: 1; }
#univga-app-home .uvg-continue-eyebrow {
  font-size: .68rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--uvg-green); margin: 0 0 2px;
}
#univga-app-home .uvg-continue-title {
  font-size: .98rem; font-weight: 800; margin: 0 0 8px;
  line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#univga-app-home .uvg-continue-bar {
  height: 7px; border-radius: 999px; background: #e9eef5; overflow: hidden;
}
#univga-app-home .uvg-continue-bar > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--uvg-blue-2), var(--uvg-green));
  width: 0; transition: width 1s .2s ease;
}
#univga-app-home .uvg-continue-pct {
  font-size: .72rem; color: var(--uvg-muted); font-weight: 700; margin-top: 5px; display: block;
}
#univga-app-home .uvg-continue-go {
  flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--uvg-blue), var(--uvg-blue-2));
  color: #fff; font-size: 1rem;
  box-shadow: 0 6px 16px rgba(11, 79, 140, .35);
  display: grid; place-items: center;
}
#univga-app-home .uvg-continue-go:active { transform: scale(.92); }

/* ───────── Statistiques ───────── */
#univga-app-home .uvg-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 18px 0;
}
#univga-app-home .uvg-stat {
  background: #fff;
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(11, 79, 140, .07);
}
#univga-app-home .uvg-stat i {
  font-size: 1.05rem;
  width: 34px; height: 34px; line-height: 34px;
  border-radius: 11px;
  margin-bottom: 6px;
  display: inline-block;
}
#univga-app-home .uvg-stat-num { font-size: 1.3rem; font-weight: 800; line-height: 1; }
#univga-app-home .uvg-stat-lbl { font-size: .68rem; color: var(--uvg-muted); font-weight: 600; margin-top: 4px; }
#univga-app-home .uvg-stat.s1 i { background: #e7f0fb; color: var(--uvg-blue-2); }
#univga-app-home .uvg-stat.s2 i { background: #e6f6ec; color: var(--uvg-green); }
#univga-app-home .uvg-stat.s3 i { background: #f3ecfc; color: #7b3ff2; }

/* ───────── Tuiles d'accès rapide ───────── */
#univga-app-home .uvg-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
  padding: 0 18px;
}
#univga-app-home .uvg-tile {
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  color: var(--uvg-ink);
  font-size: .68rem;
  font-weight: 600;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
#univga-app-home .uvg-tile-ico {
  width: 58px; height: 58px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 1.25rem;
  box-shadow: 0 6px 16px rgba(11, 79, 140, .1);
  transition: transform .16s ease;
}
#univga-app-home .uvg-tile:active .uvg-tile-ico { transform: scale(.9); }
#univga-app-home .uvg-tile span {
  max-width: 72px; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Palette des tuiles */
.uvg-c-blue   { background: #e7f0fb; color: #1565C0; }
.uvg-c-green  { background: #e6f6ec; color: #1E7A34; }
.uvg-c-violet { background: #f0eafc; color: #7b3ff2; }
.uvg-c-amber  { background: #fdf0db; color: #d98a08; }
.uvg-c-pink   { background: #fde7f1; color: #d63384; }
.uvg-c-teal   { background: #e2f6f5; color: #0d9488; }
.uvg-c-indigo { background: #e8e9fd; color: #4f46e5; }
.uvg-c-orange { background: #fde9e0; color: #ea580c; }
.uvg-c-cyan   { background: #e0f4fc; color: #0891b2; }
.uvg-c-slate  { background: #eaeef3; color: #475569; }

/* ───────── Agenda / bandeau ───────── */
#univga-app-home .uvg-banner {
  margin: 22px 18px 0;
  border-radius: 20px;
  padding: 18px 20px;
  background: linear-gradient(120deg, #0B4F8C, #1E7A34);
  color: #fff;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 12px 28px rgba(11, 79, 140, .22);
  position: relative; overflow: hidden;
}
#univga-app-home .uvg-banner i.bg {
  position: absolute; right: -10px; bottom: -18px; font-size: 6rem; opacity: .14;
}
#univga-app-home .uvg-banner .ico {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 1.2rem;
}
#univga-app-home .uvg-banner h4 { margin: 0 0 2px; font-size: 1rem; font-weight: 800; }
#univga-app-home .uvg-banner p { margin: 0; font-size: .8rem; opacity: .92; }
#univga-app-home .uvg-banner .go { margin-left: auto; font-size: 1.1rem; opacity: .9; }

@keyframes uvgUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
#univga-app-home .uvg-anim { animation: uvgUp .5s cubic-bezier(.2,.7,.3,1) both; }
#univga-app-home .uvg-anim.d1 { animation-delay: .08s; }
#univga-app-home .uvg-anim.d2 { animation-delay: .14s; }
#univga-app-home .uvg-anim.d3 { animation-delay: .20s; }
