/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

/* ==================== ANIMATIONS PERSONNALISÉES ==================== */
/* Utilisées dans le styleguide et les formulaires */

/* Fade + Slide Up (pour formulaires) */
@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In simple (pour éléments décalés) */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Scale In (pour popups, modals) */
@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide Right (pour éléments latéraux) */
@keyframes slideRight {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Classes utilitaires pour les animations */
.animate-fade-slide-up {
  animation: fadeSlideUp 0.5s ease-out forwards;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out forwards;
}

.animate-slide-right {
  animation: slideRight 0.4s ease-out forwards;
}

/* Shake (pour erreurs de validation) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* Délais pour animation staggered */
.animation-delay-100 { animation-delay: 0.1s; }
.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-300 { animation-delay: 0.3s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-500 { animation-delay: 0.5s; }

/* État initial pour les éléments avec animation-fill-mode: both */
.animate-fade-in,
.animate-fade-slide-up,
.animate-scale-in,
.animate-slide-right {
  opacity: 0;
}

/* ==================== LOADING STATES ==================== */
/* Utilisés pour les états de chargement (boutons, skeletons) */

/* Spinner circulaire */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Spinner pour bouton (plus petit, blanc) */
.btn-loading .loading-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border-width: 2px;
  margin-right: 0.5rem;
}

/* Bouton en état loading */
.btn-loading {
  position: relative;
  cursor: wait;
  opacity: 0.85;
}

.btn-loading .loading-text {
  font-weight: 500;
}

/* Shimmer effect pour skeletons (effet de brillance qui passe) */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Pulse animation (Tailwind-compatible fallback) */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Loading overlay pour sections entières */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  border-radius: inherit;
  z-index: 10;
}

.loading-overlay .loading-spinner {
  width: 2rem;
  height: 2rem;
  color: #E85D4C; /* em-primary */
}

/* Loading dots (trois points qui rebondissent) */
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background-color: currentColor;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ==================== PAGE TRANSITIONS (Turbo) ==================== */
/* Transitions smooth entre les pages via Turbo Drive */
/* Utilisé par page_transition_controller.js */

/* Configuration de la transition sur l'élément principal */
.page-transition {
  /* Transition fluide sur opacity et transform */
  /* 250ms = rapide et subtil, cubic-bezier pour un easing naturel */
  transition:
    opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
  /* Performance : indique au navigateur de préparer ces propriétés */
  will-change: opacity, transform;
}

/* État de sortie : désactivé pour éviter le flash visible */
/* Turbo Drive gère déjà la transition de manière fluide */
.page-transition-out {
  /* Garde le contenu visible pendant le chargement */
  opacity: 1;
  transform: none;
}

/* État d'entrée : animation très subtile (quasi invisible) */
.page-transition-in {
  animation: pageTransitionIn 150ms ease-out forwards;
}

/* Keyframes pour l'animation d'entrée - très subtile */
@keyframes pageTransitionIn {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 1;
  }
}

/* ==================== TURBO PROGRESS BAR ==================== */
/* Barre de progression Turbo (apparait en haut lors du chargement) */

/* Personnalisation de la barre Turbo native */
.turbo-progress-bar {
  /* Couleur primary EventMatch */
  background-color: #E85D4C;
  /* Hauteur légèrement plus épaisse pour être visible */
  height: 3px;
  /* Position fixe en haut */
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
}

/* ==================== REDUCE MOTION ==================== */
/* Respect des préférences d'accessibilité */
/* Désactive les animations pour les utilisateurs qui les préfèrent réduites */

@media (prefers-reduced-motion: reduce) {
  .page-transition,
  .page-transition-out,
  .page-transition-in {
    transition: none;
    animation: none;
    transform: none;
  }
}

/* ==================== AVATAR CROPPER ==================== */
/* Styles pour le composant de recadrage d'avatar avec Cropper.js */
/* Utilisé par avatar_cropper_controller.js */

/* Container du composant */
.avatar-upload {
  /* Rien de special, juste pour namespace */
}

/* Zone de preview avec overlay au hover */
.avatar-upload .group:hover .absolute {
  cursor: pointer;
}

/* Container de l'image à cropper */
.cropper-container {
  min-height: 200px;
  max-height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
}

/* Image source pour Cropper.js */
.cropper-image {
  display: block;
  max-width: 100%;
  max-height: 400px;
}

/* === PERSONNALISATION DE CROPPER.JS === */
/* Couleurs EventMatch sur les éléments du cropper */

/* Zone de crop - bordure primaire */
.cropper-view-box {
  outline: 2px solid #E85D4C;
  outline-color: rgba(232, 93, 76, 0.85);
}

/* Points de redimensionnement */
.cropper-point {
  background-color: #E85D4C;
  width: 12px;
  height: 12px;
  opacity: 1;
}

.cropper-point.point-se {
  width: 16px;
  height: 16px;
}

/* Lignes de la grille (guides) */
.cropper-line {
  background-color: #E85D4C;
}

/* Centre (croix de visée) */
.cropper-center {
  opacity: 0.5;
}

/* Face (zone de crop) - léger overlay */
.cropper-face {
  background-color: transparent;
}

/* Overlay sombre autour de la zone de crop */
.cropper-modal {
  background-color: rgba(0, 0, 0, 0.6);
}

/* Lignes de la grille 3x3 (guides) - plus subtiles */
.cropper-dashed {
  border-color: rgba(255, 255, 255, 0.5);
}

/* === BOUTONS DE CONTROLE DU CROPPER === */
.cropper-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background-color: #FAF8F5; /* em-cream */
  color: #6B6B6B; /* em-gray */
  border: 1px solid #F0EBE3; /* em-sand */
  transition: all 0.2s ease;
  cursor: pointer;
}

.cropper-control-btn:hover {
  background-color: #F0EBE3; /* em-sand */
  color: #1A1A1A; /* em-dark */
  border-color: #E85D4C; /* em-primary */
}

.cropper-control-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(232, 93, 76, 0.3); /* ring em-primary */
}

.cropper-control-btn:active {
  transform: scale(0.95);
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .cropper-container {
    min-height: 180px;
    max-height: 300px;
  }

  .cropper-image {
    max-height: 280px;
  }

  .cropper-control-btn {
    width: 36px;
    height: 36px;
  }
}

/* === REDUCE MOTION POUR CROPPER === */
@media (prefers-reduced-motion: reduce) {
  .cropper-control-btn {
    transition: none;
  }

  .cropper-control-btn:active {
    transform: none;
  }
}

/* ==================== HERO TOGGLE ==================== */
/* Toggle anime pour basculer entre les audiences client/pro */
/* Utilise par hero_toggle_controller.js */

/* Etat actif du bouton toggle (texte blanc sur fond primary) */
.hero-toggle--active {
  color: #FFFFFF;
}

/* Etat inactif du bouton toggle (texte gris) */
.hero-toggle--inactive {
  color: #6B6B6B; /* em-gray */
}

/* Transition smooth pour le changement de couleur */
.hero-toggle--active,
.hero-toggle--inactive {
  transition: color 0.2s ease-out;
}

/* Respect des preferences d'accessibilite */
@media (prefers-reduced-motion: reduce) {
  .hero-toggle--active,
  .hero-toggle--inactive {
    transition: none;
  }
}
