/* responsive-utils.css - À inclure dans toutes les pages */

/* ================== RESET MOBILE ================== */
* {
  -webkit-tap-highlight-color: rgba(22, 170, 255, 0.2);
  -webkit-touch-callout: none;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================== CLASSES UTILITAIRES ================== */

/* Cacher sur mobile */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Cacher sur desktop */
@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Text alignment responsive */
.text-center-mobile {
  text-align: left;
}

@media (max-width: 768px) {
  .text-center-mobile {
    text-align: center;
  }
}

/* Spacing responsive */
.stack-mobile {
  display: flex;
  gap: 1rem;
}

@media (max-width: 768px) {
  .stack-mobile {
    flex-direction: column;
  }
}

/* Full width on mobile */
.full-width-mobile {
  width: auto;
}

@media (max-width: 768px) {
  .full-width-mobile {
    width: 100% !important;
  }
}

/* Container responsive */
.container-responsive {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

/* ================== TOUCH TARGETS ================== */
/* Minimum 44x44px pour les éléments interactifs sur mobile */
@media (max-width: 768px) {
  button,
  a.btn,
  input[type="button"],
  input[type="submit"],
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ================== SCROLLBAR CUSTOM ================== */
/* Scrollbar fine sur mobile */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }
  
  ::-webkit-scrollbar-track {
    background: rgba(128, 208, 255, 0.05);
  }
  
  ::-webkit-scrollbar-thumb {
    background: rgba(128, 208, 255, 0.3);
    border-radius: 4px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 208, 255, 0.5);
  }
}

/* ================== IMAGES RESPONSIVE ================== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lazy loading optimization */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ================== FOCUS VISIBLE ================== */
/* Améliorer la visibilité du focus pour navigation clavier */
*:focus-visible {
  outline: 2px solid #16aaff;
  outline-offset: 3px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
  outline-color: #80d0ff;
}

/* ================== PREVENT ZOOM ON INPUT FOCUS (iOS) ================== */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* ================== SAFE AREA (iPhone X+) ================== */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ================== ORIENTATION CHANGES ================== */
@media (orientation: landscape) and (max-height: 500px) {
  /* Réduire les paddings en mode paysage sur petits écrans */
  .landing,
  .scan-page,
  .profile-hero,
  .profile-stage {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}

/* ================== PRINT STYLES ================== */
@media print {
  .navbar,
  .footer,
  .menu-toggle,
  .menu-overlay,
  button,
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  a {
    text-decoration: underline;
    color: black !important;
  }
}

/* ================== REDUCED MOTION ================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================== DARK MODE SUPPORT (OPTIONNEL) ================== */
@media (prefers-color-scheme: dark) {
  /* Si vous voulez supporter le dark mode natif */
  /* Décommentez et personnalisez selon vos besoins */
  /*
  body {
    background: #0a0e13;
    color: #f2f8ff;
  }
  */
}

/* ================== PERFORMANCE ================== */
/* Utiliser will-change avec parcimonie */
.navbar,
.menu-overlay,
.navbar-links {
  will-change: transform;
}

/* GPU acceleration pour animations fluides */
.icon-btn,
.landing-button,
.footer-cta,
.profile-cta {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ================== LOADING STATES ================== */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(128, 208, 255, 0.3);
  border-top-color: #80d0ff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================== SKELETON LOADING ================== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(128, 208, 255, 0.1) 25%,
    rgba(128, 208, 255, 0.2) 50%,
    rgba(128, 208, 255, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================== ERROR STATES ================== */
.error-message {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.success-message {
  color: #4de6a3;
  background: rgba(77, 230, 163, 0.1);
  border: 1px solid rgba(77, 230, 163, 0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}