/* =========================================================
   AuthifyMe Pay — Enhancements (transitions, micro-UX)
   Fichier partagé par toutes les pages.
   ========================================================= */

/* --- Cross-Document View Transitions (Chrome, Edge, Safari 18+) --- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: authify-fade-out 0.28s cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: authify-fade-in 0.32s cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes authify-fade-out {
  from { opacity: 1; transform: translateY(0) }
  to   { opacity: 0; transform: translateY(-8px) }
}
@keyframes authify-fade-in {
  from { opacity: 0; transform: translateY(12px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* --- Smooth scroll global --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

/* --- Barre de progression de scroll (top, gold) --- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #c9a84c, #e8d48b);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.6);
  z-index: 10000;
  transition: width 0.08s linear;
  pointer-events: none;
  view-transition-name: authify-progress;
}

/* --- Loader de navigation (s'affiche pendant le chargement d'une page) --- */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(201, 168, 76, 0.15);
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  overflow: hidden;
}
#page-loader::before {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #c9a84c 30%, #e8d48b 50%, #c9a84c 70%, transparent);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.8);
  animation: authify-loader-slide 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
#page-loader.active {
  opacity: 1;
  visibility: visible;
}
@keyframes authify-loader-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

/* --- Bouton retour en haut --- */
#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #c9a84c;
  color: #091a2a;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.9);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
  box-shadow: 0 8px 24px rgba(9, 26, 42, 0.25), 0 0 0 0 rgba(201, 168, 76, 0.4);
  z-index: 500;
}
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
#back-to-top:hover {
  background: #e8d48b;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(9, 26, 42, 0.35), 0 0 0 6px rgba(201, 168, 76, 0.15);
}
#back-to-top:active {
  transform: translateY(-1px) scale(1);
}

/* --- Surlignage de la page active dans la navigation --- */
.nav-active,
a.nav-active,
.mega-menu a.nav-active {
  color: #c9a84c !important;
  font-weight: 600;
}
.nav-links-info a.nav-active {
  color: #c9a84c !important;
}
.mobile-menu a.nav-active {
  color: #c9a84c !important;
}

/* --- Breadcrumb discret pour sous-pages --- */
.authify-breadcrumb {
  background: #f8fafc;
  border-bottom: 1px solid #e8ecf0;
  padding: 0.9rem 0;
  font-size: 0.8rem;
  color: #6b7280;
  letter-spacing: 0.02em;
}
.authify-breadcrumb .container-bc {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.authify-breadcrumb a {
  color: #2881bb;
  text-decoration: none;
  transition: color 0.2s;
}
.authify-breadcrumb a:hover {
  color: #091a2a;
}
.authify-breadcrumb .sep {
  color: #d0d7de;
  margin: 0 0.15rem;
}
.authify-breadcrumb .current {
  color: #091a2a;
  font-weight: 500;
}
@media (max-width: 768px) {
  .authify-breadcrumb {
    padding: 0.75rem 0;
    font-size: 0.75rem;
  }
  .authify-breadcrumb .container-bc {
    padding: 0 18px;
  }
}

/* --- Micro-animations additionnelles --- */
a, button {
  -webkit-tap-highlight-color: transparent;
}

/* Respect du prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto }
  #scroll-progress { transition: none }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* --- Cache back-to-top sur écrans très petits (pour pas gêner) --- */
@media (max-width: 380px) {
  #back-to-top {
    width: 42px;
    height: 42px;
    bottom: 1rem;
    right: 1rem;
  }
}
