/* =================================================================
   BuildTheRift - Améliorations Visuelles et Fonctionnelles
   Fichier d'amélioration unifié pour tous les modules
   ================================================================= */

/* ===================================================================
   1. AMÉLIORATIONS DE PERFORMANCE
   =================================================================== */

/* Optimisation des images avec lazy loading visuel */
img {
  will-change: transform;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Optimisation des animations pour éviter le reflow */
.animate-card {
  will-change: transform, box-shadow;
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===================================================================
   2. AMÉLIORATIONS UX - FEEDBACK VISUEL
   =================================================================== */

/* Meilleur feedback sur les boutons */
.btn, button, [role="button"] {
  position: relative;
  overflow: hidden;
}

.btn::after, button::after, [role="button"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after, button:active::after, [role="button"]:active::after {
  width: 300px;
  height: 300px;
}

/* Skeleton loaders pour un meilleur UX de chargement */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.skeleton-title {
  height: 2rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-image {
  height: 200px;
  width: 100%;
}

/* ===================================================================
   3. AMÉLIORATIONS D'ACCESSIBILITÉ
   =================================================================== */

/* Meilleur contraste pour le texte */
.text-high-contrast {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Focus visible pour la navigation clavier */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to content pour l'accessibilité */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 1rem;
  text-decoration: none;
  z-index: 10000;
}

.skip-to-content:focus {
  top: 0;
}

/* Indicateur de zone cliquable plus visible */
[role="button"], button, .btn, a {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 102, 204, 0.3);
}

/* ===================================================================
   4. AMÉLIORATIONS MOBILE
   =================================================================== */

/* Meilleur espacement tactile */
@media (max-width: 768px) {
  .btn, button, a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Menu mobile amélioré */
  .mobile-menu {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.98);
    backdrop-filter: blur(20px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
  }

  .mobile-menu.active {
    transform: translateX(0);
  }

  .mobile-menu-nav {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1rem;
  }

  .mobile-menu-nav .nav-link {
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
  }
}

/* Amélioration des zones de swipe sur mobile */
@media (hover: none) and (pointer: coarse) {
  .swipeable {
    touch-action: pan-y;
    user-select: none;
  }
}

/* ===================================================================
   5. AMÉLIORATIONS VISUELLES - CARDS
   =================================================================== */

/* Cards avec effet parallax au survol */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.card-3d:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) translateZ(10px);
}

.card-3d-inner {
  transform: translateZ(20px);
}

/* Cartes avec effet de révélation au scroll */
.reveal-card {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Gradient borders animés */
.gradient-border {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gradient-border:hover::before {
  opacity: 1;
  animation: rotate-gradient 3s linear infinite;
}

@keyframes rotate-gradient {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ===================================================================
   6. AMÉLIORATIONS DE TEXTE ET TYPOGRAPHIE
   =================================================================== */

/* Texte avec effet de brillance au survol */
.text-shine {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--primary) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: background-position 0.5s ease;
}

.text-shine:hover {
  background-position: right center;
}

/* Effet de typing pour les titres */
.typing-effect {
  overflow: hidden;
  border-right: 2px solid var(--primary);
  white-space: nowrap;
  animation: typing 3s steps(40) 1s forwards, blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* ===================================================================
   7. AMÉLIORATIONS DES FORMULAIRES
   =================================================================== */

/* Labels flottants pour les inputs */
.floating-label {
  position: relative;
}

.floating-label input,
.floating-label select {
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
}

.floating-label label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: all 0.3s ease;
  pointer-events: none;
}

.floating-label input:focus ~ label,
.floating-label input:not(:placeholder-shown) ~ label,
.floating-label select:focus ~ label,
.floating-label select:not([value=""]) ~ label {
  top: 0.75rem;
  font-size: 0.75rem;
  color: var(--primary);
}

/* Validation visuelle des formulaires */
.form-input.valid {
  border-color: var(--secondary);
}

.form-input.invalid {
  border-color: var(--accent);
}

.form-feedback {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-feedback.valid {
  color: var(--secondary);
}

.form-feedback.invalid {
  color: var(--accent);
}

/* ===================================================================
   8. AMÉLIORATIONS DES MODALES ET OVERLAYS
   =================================================================== */

/* Modal moderne avec backdrop blur */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-strong), var(--glow-primary);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
  animation: modalBounce 0.5s ease;
}

@keyframes modalBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* ===================================================================
   9. AMÉLIORATIONS DES TOOLTIPS
   =================================================================== */

/* Tooltips modernes - Désactivé pour les tool-cards */
[data-tooltip]:not(.tool-card) {
  position: relative;
  cursor: help;
}

[data-tooltip]:not(.tool-card)::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.95);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

[data-tooltip]:not(.tool-card)::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

[data-tooltip]:not(.tool-card):hover::before,
[data-tooltip]:not(.tool-card):hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ===================================================================
   10. AMÉLIORATIONS DES LISTES ET GRILLES
   =================================================================== */

/* Liste avec animations décalées */
.stagger-list > * {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s ease forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-list > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-list > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-list > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-list > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-list > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-list > *:nth-child(n+7) { animation-delay: 0.35s; }

/* Grid responsive avec auto-fill amélioré */
.responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--space-lg);
}

@media (max-width: 640px) {
  .responsive-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   11. AMÉLIORATIONS DES BADGES ET TAGS
   =================================================================== */

/* Badges modernes avec glow */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.badge-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: white;
  box-shadow: 0 0 15px rgba(0, 102, 204, 0.4);
}

.badge-secondary {
  background: var(--secondary);
  border: none;
  color: white;
}

.badge-success {
  background: #10b981;
  border: none;
  color: white;
}

.badge-warning {
  background: #f59e0b;
  border: none;
  color: white;
}

.badge-danger {
  background: var(--accent);
  border: none;
  color: white;
}

.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===================================================================
   12. AMÉLIORATIONS DE PERFORMANCE - IMAGES
   =================================================================== */

/* Image progressive loading */
.progressive-image {
  position: relative;
  overflow: hidden;
  background: var(--bg-glass);
}

.progressive-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progressive-image img {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.progressive-image img.loaded {
  opacity: 1;
}

/* ===================================================================
   13. DARK MODE AMÉLIORÉ
   =================================================================== */

/* Toggle dark mode avec animation */
.theme-toggle {
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.25rem;
  display: flex;
  gap: 0.25rem;
  cursor: pointer;
}

.theme-toggle-option {
  padding: 0.5rem 1rem;
  border-radius: 50px;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}

.theme-toggle-option.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--glow-primary);
}

/* ===================================================================
   14. AMÉLIORATIONS DES TABLEAUX
   =================================================================== */

/* Table moderne responsive */
.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}

.modern-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.modern-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modern-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.modern-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

.modern-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table responsive sur mobile */
@media (max-width: 768px) {
  .modern-table {
    display: block;
    overflow-x: auto;
  }
}

/* ===================================================================
   15. AMÉLIORATIONS DES ICÔNES ET IMAGES
   =================================================================== */

/* Icônes avec animation de spin au hover */
.icon-hover-spin:hover {
  animation: spin 0.8s ease-in-out;
}

/* Icônes avec pulse */
.icon-pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

/* ===================================================================
   16. UTILITAIRES DE TRANSITIONS
   =================================================================== */

/* Transitions fluides */
.transition-all { transition: all 0.3s ease; }
.transition-fast { transition: all 0.15s ease; }
.transition-slow { transition: all 0.6s ease; }

/* Hover effects */
.hover-lift:hover { transform: translateY(-4px); }
.hover-scale:hover { transform: scale(1.05); }
.hover-brightness:hover { filter: brightness(1.1); }

/* ===================================================================
   17. AMÉLIORATIONS PRINT
   =================================================================== */

@media print {
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-top: 0;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #ccc;
  }

  body {
    background: white;
    color: black;
  }
}

/* ===================================================================
   18. SCROLL AMÉLIORÉ
   =================================================================== */

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
  background-clip: padding-box;
}

/* Scroll to top button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-strong);
  z-index: 999;
}

.scroll-to-top.visible {
  opacity: 1;
  pointer-events: all;
}

.scroll-to-top:hover {
  transform: translateY(-4px);
  box-shadow: var(--glow-primary);
}

/* ===================================================================
   19. PROGRESS INDICATORS
   =================================================================== */

/* Progress bar moderne */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* Circular progress */
.circular-progress {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: conic-gradient(
    var(--primary) var(--progress, 0%),
    rgba(255, 255, 255, 0.1) 0%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.circular-progress::before {
  content: '';
  width: 70%;
  height: 70%;
  background: var(--bg-card);
  border-radius: 50%;
  position: absolute;
}

.circular-progress-value {
  position: relative;
  z-index: 1;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===================================================================
   20. ANIMATIONS AVANCÉES
   =================================================================== */

/* Fade variations */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease;
}

.animate-zoom-in {
  animation: zoomIn 0.6s ease;
}

/* ===================================================================
   FIN DES AMÉLIORATIONS
   =================================================================== */
