/**
 * Styles.css - Calor IA PWA Wrapper
 * 
 * Layout em tela cheia para encapsular o app Streamlit
 * Responsivo para Android e iOS
 */

/* ============================================================================
   VARIÁVEIS CSS (DESIGN TOKENS)
   ============================================================================ */

:root {
  /* Cores principais */
  --color-primary: #16A8A8;           /* Azul esverdeado */
  --color-accent: #FF6B35;            /* Laranja */
  --color-background: #FFFFFF;        /* Branco */
  --color-text: #1A1A1A;              /* Preto suave */
  --color-text-light: #FFFFFF;        /* Texto em fundo escuro */
  
  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, #16A8A8 0%, #0D7A7A 100%);
  
  /* Espaçamentos */
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* Fontes */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Helvetica Neue', Arial, sans-serif;
  
  /* Transições */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.5s ease;
}

/* ============================================================================
   RESET E BASE
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--color-background);
  color: var(--color-text);
  
  /* Prevenir zoom indesejado em iOS */
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Suporte para dispositivos com notch (iPhone X+) */
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ============================================================================
   BOTÃO DE ABERTURA MANUAL
   ============================================================================ */

#open-app-button {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0) + var(--spacing-xl));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  
  background-color: var(--color-accent);
  color: var(--color-text-light);
  border: none;
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

#open-app-button:hover {
  background-color: #FF8456;
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.5);
}

#open-app-button:active {
  transform: translateX(-50%) translateY(0);
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
}

/* ============================================================================
   SPLASH SCREEN / LOADING
   ============================================================================ */

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity var(--transition-medium);
}

/* Estado oculto com transição suave */
#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Logo na splash screen */
.loader-logo {
  width: 120px;
  height: 120px;
  margin-bottom: var(--spacing-lg);
  animation: pulse 2s ease-in-out infinite;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Título na splash screen */
.loader-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-xl);
  letter-spacing: -0.5px;
  text-align: center;
}

/* Spinner animado */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Texto de ajuda */
.helper-text {
  margin-top: var(--spacing-xl);
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
  max-width: 360px;
  line-height: 1.7;
  padding: 0 var(--spacing-lg);
}

.helper-text-secondary {
  margin-top: var(--spacing-md);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  max-width: 340px;
  line-height: 1.6;
  padding: 0 var(--spacing-lg);
}

/* ============================================================================
   ANIMAÇÕES
   ============================================================================ */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* ============================================================================
   RESPONSIVIDADE
   ============================================================================ */

/* Mobile pequeno (até 375px) */
@media (max-width: 375px) {
  .loader-logo {
    width: 96px;
    height: 96px;
  }
  
  .loader-title {
    font-size: 28px;
  }
  
  .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }
}

/* Tablets e landscape */
@media (min-width: 768px) {
  .loader-logo {
    width: 140px;
    height: 140px;
  }
  
  .loader-title {
    font-size: 36px;
  }
}

/* Orientação landscape em mobile */
@media (orientation: landscape) and (max-height: 500px) {
  .loader-logo {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-md);
  }
  
  .loader-title {
    font-size: 24px;
    margin-bottom: var(--spacing-md);
  }
  
  .spinner {
    width: 36px;
    height: 36px;
  }
}

/* ============================================================================
   UTILITÁRIOS
   ============================================================================ */

/* Classe para esconder elementos */
.hidden {
  display: none !important;
}

/* Prevenir seleção de texto */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ============================================================================
   MELHORIAS DE PERFORMANCE
   ============================================================================ */

/* Aceleração de hardware para animações */
.loader-logo,
.spinner,
#loading-screen {
  will-change: transform, opacity;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
