/* 
 * Moziala Mobile Web Styles
 * Optimisé pour une expérience mobile fluide sur le web
 */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Force Mobile Container on All Screens */
#root, 
flutter-view, 
flt-glass-pane {
  max-width: 480px !important;
  width: 100% !important;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  background-color: #ffffff;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments for very small screens */
@media screen and (max-width: 480px) {
  #root, 
  flutter-view, 
  flt-glass-pane {
    max-width: 100% !important;
    box-shadow: none;
  }
}

/* Touch Optimizations */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Allow text selection in inputs */
input,
textarea,
[contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

/* Prevent zoom on input focus (iOS Safari) */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="search"],
textarea,
select {
  font-size: 16px !important;
  transform: scale(1);
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

* {
  -webkit-overflow-scrolling: touch;
}

/* Disable pull-to-refresh on Chrome Android */
body {
  overscroll-behavior-y: contain;
}

/* Custom Scrollbar for Desktop View */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Loading Screen Styles */
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #000000;
  z-index: 9999;
  transition: opacity 0.3s ease-in-out;
}

.loading-container.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Performance Optimizations */
.map-container,
.google-map {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* Disable text size adjust on mobile */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Prevent horizontal scroll */
body {
  overflow-x: hidden;
  position: relative;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Animation Performance */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  * {
    border-width: 2px !important;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #0a0a0a;
  }
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid #d9df3f;
  outline-offset: 2px;
}

/* Disable focus outline for mouse users */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Network status indicator */
.offline-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: #d32f2f;
  color: white;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* PWA Install Prompt */
.pwa-install-prompt {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  background: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  display: none;
}

.pwa-install-prompt.show {
  display: block;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* Optimize images */
img {
  max-width: 100%;
  height: auto;
}

/* Lazy loading hint */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* GPU acceleration for smooth animations */
.animated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

