/* Estilos básicos para o PWA */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Controle de orientação */
  -webkit-transform: rotate(0deg);
  -moz-transform: rotate(0deg);
  -ms-transform: rotate(0deg);
  transform: rotate(0deg);
}

* {
  box-sizing: border-box;
}

#root {
  min-height: 100vh;
}

/* Estilos para PWA */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pwa-install-banner button {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pwa-install-banner button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsividade */
@media (max-width: 768px) {
  .pwa-install-banner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* Estilos para notificações offline */
.offline-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #f44336;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(244, 67, 54, 0.3);
  z-index: 1001;
  font-weight: 600;
}

.online-notification {
  background: #4caf50;
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
}

/* Controle de orientação para PWA */
@media screen and (orientation: landscape) {
  html, body {
    overflow-x: auto;
  }
}

@media screen and (orientation: portrait) {
  html, body {
    overflow-x: hidden;
  }
}

/* Evita rotação automática forçada */
@media (display-mode: standalone) {
  body {
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Permite rotação natural sem forçar */
  html {
    -ms-touch-action: manipulation;
    touch-action: manipulation;
  }
}

/* Estilos específicos para modo PWA */
body.pwa-mode {
  /* Desabilita rotação forçada */
  -webkit-transform: none !important;
  -moz-transform: none !important;
  -ms-transform: none !important;
  transform: none !important;
  
  /* Controle de overflow */
  overflow-x: hidden;
  
  /* Fixa altura para evitar problemas de viewport */
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

body.pwa-mode #root {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* iOS PWA specific fixes */
@supports (-webkit-touch-callout: none) {
  body.pwa-mode {
    /* iOS Safari PWA height fix */
    min-height: -webkit-fill-available;
  }
}