/* TimaLove — installation PWA : popup compact + bouton « Télécharger » (fonds plats, palette officielle) */

/* ===== Bouton « Télécharger » de la navigation ===== */
.pwa-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 0.8rem 0 0.65rem;
  border: 0;
  border-radius: var(--radius-pill, 9999px);
  background: var(--rose-primary, #c2185b);
  color: var(--white, #fff);
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(194, 24, 91, 0.3);
  transition: background 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.pwa-nav-btn:hover { background: var(--hover-primary, #a0144c); color: var(--white, #fff); box-shadow: 0 6px 16px rgba(194, 24, 91, 0.36); }
.pwa-nav-btn:active { transform: scale(0.96); }
.pwa-nav-btn:focus-visible { outline: 3px solid rgba(194, 24, 91, 0.4); outline-offset: 2px; }
.pwa-nav-btn svg { width: 1rem; height: 1rem; flex: none; }
.pwa-nav-btn[hidden] { display: none !important; }

/* Intégration dans les en-têtes */
html.pwa-can-install .explorer__top { grid-template-columns: 1fr auto 1fr; }
html.pwa-can-install .explorer__top > :first-child { justify-self: start; }
html.pwa-can-install .explorer__top > :last-child { justify-self: end; }
.pubtop__spacer { display: flex; justify-content: flex-end; align-items: center; height: auto; }
.app-header__actions { display: inline-flex; align-items: center; gap: 0.75rem; }
.navbar__pwa { margin-left: auto; }
.welcome__pwa {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 20;
  background: var(--white, #fff);
  color: var(--rose-primary, #c2185b);
  box-shadow: 0 6px 18px rgba(61, 34, 38, 0.22);
}
.welcome__pwa:hover { background: var(--rose-pale, #fce4ec); color: var(--hover-primary, #a0144c); }
@media (min-width: 768px) { .navbar__pwa { margin-left: 1rem; } }

/* Mobile, en-têtes d'app (logo centré + icônes) : bouton rond, bien visible */
@media (max-width: 480px) {
  .explorer__top .pwa-nav-btn,
  .pubtop .pwa-nav-btn,
  .welcome__pwa {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    animation: pwa-pulse 2.4s ease-out 3;
  }
  .explorer__top .pwa-nav-btn svg,
  .pubtop .pwa-nav-btn svg,
  .welcome__pwa svg { width: 1.2rem; height: 1.2rem; }
  .explorer__top .pwa-nav-btn__label,
  .pubtop .pwa-nav-btn__label,
  .welcome__pwa .pwa-nav-btn__label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}
@keyframes pwa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(194, 24, 91, 0.45), 0 4px 12px rgba(194, 24, 91, 0.3); }
  70% { box-shadow: 0 0 0 10px rgba(194, 24, 91, 0), 0 4px 12px rgba(194, 24, 91, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(194, 24, 91, 0), 0 4px 12px rgba(194, 24, 91, 0.3); }
}

/* Très petits écrans : icône seule partout */
@media (max-width: 359px) {
  .pwa-nav-btn { width: 2.25rem; padding: 0; }
  .pwa-nav-btn__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 768px) {
  .pwa-nav-btn { height: 2.5rem; padding: 0 1.1rem 0 0.95rem; font-size: 0.9rem; }
}

/* ===== Popup ===== */
.pwa-sheet {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  font-family: var(--font-sans, "DM Sans", system-ui, sans-serif);
}
.pwa-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(61, 34, 38, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.pwa-sheet.is-open.is-guide .pwa-backdrop { opacity: 1; pointer-events: auto; }

.pwa-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border: 1px solid rgba(194, 24, 91, 0.1);
  border-radius: 20px;
  background: var(--white, #fff);
  color: var(--text-primary, #2d1f22);
  box-shadow: 0 12px 40px rgba(61, 34, 38, 0.24);
  opacity: 0;
  transform: translateY(24px);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease;
  pointer-events: auto;
}
.pwa-sheet.is-open .pwa-card { opacity: 1; transform: none; }
.pwa-sheet.has-arrow .pwa-card { bottom: calc(64px + env(safe-area-inset-bottom)); }

.pwa-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--rose-light, #f8e8ea);
  color: var(--bordeaux, #5c2430);
  cursor: pointer;
  transition: background 0.2s ease;
}
.pwa-close:hover { background: var(--rose-pale, #fce4ec); }
.pwa-close svg { width: 16px; height: 16px; }

.pwa-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 30px;
}
.pwa-app-icon {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 14px;
  border: 1px solid rgba(194, 24, 91, 0.12);
  box-shadow: 0 4px 12px rgba(194, 24, 91, 0.14);
}
.pwa-text { min-width: 0; }
.pwa-text h2 {
  margin: 0;
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--bordeaux, #5c2430);
}
.pwa-text p {
  margin: 3px 0 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-secondary, #6b5a5e);
}

.pwa-btn {
  width: 100%;
  height: 46px;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-pill, 9999px);
  background: var(--rose-primary, #c2185b);
  color: var(--white, #fff);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(194, 24, 91, 0.28);
  transition: background 0.2s ease, transform 0.12s ease;
}
.pwa-btn:hover { background: var(--hover-primary, #a0144c); }
.pwa-btn:active { transform: scale(0.98); }
.pwa-btn svg { width: 18px; height: 18px; }
.pwa-btn--soft {
  background: var(--rose-light, #f8e8ea);
  color: var(--bordeaux, #5c2430);
  box-shadow: none;
}
.pwa-btn--soft:hover { background: var(--rose-pale, #fce4ec); }
.pwa-btn:focus-visible, .pwa-close:focus-visible {
  outline: 3px solid rgba(194, 24, 91, 0.4);
  outline-offset: 2px;
}

/* Méthode pas à pas */
.pwa-steps {
  list-style: none;
  counter-reset: pwa;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.pwa-steps li {
  counter-increment: pwa;
  position: relative;
  padding: 9px 10px 9px 42px;
  border-radius: 12px;
  background: var(--rose-light, #f8e8ea);
  font-size: 0.86rem;
  line-height: 1.45;
}
.pwa-steps li::before {
  content: counter(pwa);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--rose-primary, #c2185b);
  color: var(--white, #fff);
  font-size: 0.74rem;
  font-weight: 700;
}
.pwa-steps strong { color: var(--bordeaux, #5c2430); }
.pwa-ico {
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.26em;
  color: #007aff;
}
.pwa-key {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--white, #fff);
  font-weight: 700;
  color: var(--bordeaux, #5c2430);
}
.pwa-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted, #9b8a8e);
}

/* Flèche vers le bouton Partager de Safari (iPhone) */
.pwa-arrow {
  position: absolute;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: 40px;
  height: 40px;
  margin-left: -20px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: var(--white, #fff);
  color: var(--rose-primary, #c2185b);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.pwa-arrow svg { width: 22px; height: 22px; }
.pwa-sheet.has-arrow .pwa-arrow { display: grid; animation: pwa-bounce 1.2s ease-in-out infinite; }
@keyframes pwa-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Petits téléphones : éléments réduits */
@media (max-width: 374px) {
  .pwa-card { left: 8px; right: 8px; padding: 14px; border-radius: 18px; }
  .pwa-app-icon { width: 44px; height: 44px; border-radius: 12px; }
  .pwa-text h2 { font-size: 0.96rem; }
  .pwa-text p { font-size: 0.78rem; }
  .pwa-btn { height: 42px; font-size: 0.88rem; margin-top: 12px; }
  .pwa-steps li { font-size: 0.8rem; padding: 8px 8px 8px 38px; }
}

/* Tablette / ordinateur : carte flottante en bas à droite */
@media (min-width: 768px) {
  .pwa-card {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 380px;
    padding: 20px;
  }
  .pwa-sheet.has-arrow .pwa-card { bottom: 24px; }
  .pwa-sheet.has-arrow .pwa-arrow { display: none; }
  .pwa-sheet.is-open.is-guide .pwa-backdrop { opacity: 0; pointer-events: none; }
  .pwa-app-icon { width: 56px; height: 56px; }
  .pwa-text h2 { font-size: 1.12rem; }
}

/* Dans l'application installée : rien à proposer */
@media (display-mode: standalone), (display-mode: minimal-ui) {
  .pwa-nav-btn, .pwa-sheet { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-card, .pwa-backdrop { transition: none; }
  .explorer__top .pwa-nav-btn, .pubtop .pwa-nav-btn, .welcome__pwa { animation: none; }
  .pwa-sheet.has-arrow .pwa-arrow { animation: none; }
}
