/* ========================================
   VRTherapy - Loading Overlay - Interface Moderne Uniquement
   Version nettoyée et optimisée
   ======================================== */

/* ========================================
   RESET ET BASE
   ======================================== */

body {
  margin: 0 !important;
  padding: 0 !important;
  background: linear-gradient(135deg, #ffffff, #f8fafc) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  overflow: hidden !important;
}

/* ========================================
   OVERLAY DE CHARGEMENT PRINCIPAL
   ======================================== */

#vrtherapy-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
  color: white !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 999999 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  overflow: hidden !important;
}

.vrtherapy-content {
  text-align: center;
  color: white;
  max-width: 500px;
  width: 90%;
  position: relative;
}

.vrtherapy-logo {
  font-size: 80px;
  margin-bottom: 20px;
  animation: vrtherapy-pulse 2s ease-in-out infinite;
}

.vrtherapy-title {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #f1f5f9;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.vrtherapy-subtitle {
  font-size: 18px;
  color: #cbd5e1;
  margin-bottom: 40px;
  font-weight: 400;
}

/* ========================================
   BARRE DE PROGRESSION MODERNE
   ======================================== */

.vrtherapy-progress-container {
  margin-bottom: 30px;
}

.vrtherapy-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 15px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.vrtherapy-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 50%, #10b981 100%);
  border-radius: 12px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.vrtherapy-progress-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: vrtherapy-shimmer 2s linear infinite;
}

.vrtherapy-percentage {
  font-size: 28px;
  font-weight: 700;
  color: #3b82f6;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ========================================
   STATUS ET DÉTAILS
   ======================================== */

.vrtherapy-status-container {
  margin-bottom: 30px;
}

.vrtherapy-status {
  font-size: 16px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 8px;
}

.vrtherapy-details {
  font-size: 14px;
  color: #94a3b8;
  font-weight: 400;
  min-height: 20px;
}

/* ========================================
   ANIMATION DE CHARGEMENT
   ======================================== */

.vrtherapy-loading-animation {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.vrtherapy-dot {
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  animation: vrtherapy-bounce 1.4s ease-in-out infinite both;
}

.vrtherapy-dot:nth-child(1) { animation-delay: -0.32s; }
.vrtherapy-dot:nth-child(2) { animation-delay: -0.16s; }
.vrtherapy-dot:nth-child(3) { animation-delay: 0s; }

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes vrtherapy-pulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 1; 
  }
  50% { 
    transform: scale(1.05); 
    opacity: 0.8; 
  }
}

@keyframes vrtherapy-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes vrtherapy-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  } 
  40% {
    transform: scale(1);
  }
}

@keyframes vrtherapy-fade-out {
  0% { 
    opacity: 1; 
    visibility: visible; 
  }
  100% { 
    opacity: 0; 
    visibility: hidden; 
  }
}

/* ========================================
   TRANSITION VERS INTERFACE MODERNE
   ======================================== */

/* Interface moderne cachée initialement */
#tauri-app {
  display: none !important;
  opacity: 0 !important;
}

#tauri-app.vrtherapy-ready {
  display: flex !important;
  opacity: 1 !important;
  animation: vrtherapy-fade-in 0.5s ease-in !important;
}

@keyframes vrtherapy-fade-in {
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Transition de masquage de l'overlay */
#vrtherapy-overlay.vrtherapy-fade-out {
  animation: vrtherapy-fade-out 0.6s ease-out forwards !important;
}

/* ========================================
   LOADER D'IMPORT MANUEL
   ======================================== */

#vrtherapy-import-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  pointer-events: all;
}

.import-loader-backdrop {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-loader-content {
  background: linear-gradient(135deg, #1e293b, #334155);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  color: white;
  min-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.import-loader-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #f1f5f9;
}

.import-loader-filename {
  font-size: 16px;
  color: #3b82f6;
  margin-bottom: 30px;
  font-weight: 500;
}

.import-progress-container {
  margin-bottom: 20px;
}

.import-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.import-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 8px;
  transition: width 0.3s ease;
}

.import-percentage {
  font-size: 18px;
  font-weight: 600;
  color: #3b82f6;
}

.import-status {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.import-spinner {
  display: flex;
  justify-content: center;
}

.spinner-ring {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: vrtherapy-spin 1s linear infinite;
}

@keyframes vrtherapy-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========================================
   UTILITAIRES DE DEBUG
   ======================================== */

.vrtherapy-debug-info {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: #10b981;
  padding: 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  z-index: 1000000;
  min-width: 200px;
  display: none;
}

.vrtherapy-debug-info.visible {
  display: block;
}

.debug-mode .vrtherapy-debug-info {
  display: block;
}

.debug-mode #vrtherapy-overlay {
  border: 2px dashed #3b82f6;
}

.debug-mode .vrtherapy-content::after {
  content: 'DEBUG MODE';
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
}

.debug-mode .vrtherapy-progress-fill {
  background: linear-gradient(90deg, #ef4444 0%, #f97316 50%, #eab308 100%);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .vrtherapy-content {
    padding: 1.5rem;
    max-width: 320px;
  }
  
  .vrtherapy-logo {
    font-size: 64px;
    margin-bottom: 20px;
  }
  
  .vrtherapy-title {
    font-size: 32px;
    margin-bottom: 10px;
  }
  
  .vrtherapy-subtitle {
    font-size: 16px;
    margin-bottom: 28px;
  }
  
  .vrtherapy-percentage {
    font-size: 24px;
  }
  
  .import-loader-content {
    min-width: 300px;
    padding: 30px;
  }
}

@media (max-width: 480px) {
  .vrtherapy-content {
    padding: 1rem;
    max-width: 280px;
  }
  
  .vrtherapy-logo {
    font-size: 48px;
    margin-bottom: 16px;
  }
  
  .vrtherapy-title {
    font-size: 28px;
  }
  
  .vrtherapy-subtitle {
    font-size: 14px;
  }
  
  .vrtherapy-percentage {
    font-size: 20px;
  }
  
  .vrtherapy-status {
    font-size: 14px;
  }
  
  .vrtherapy-details {
    font-size: 12px;
  }
  
  .import-loader-content {
    min-width: 280px;
    padding: 24px;
  }
}