/* ================================================================
   PWA INSTALL STYLES - Agenpsi
   Botão/Banner centralizado no topo com design moderno
   ================================================================ */

/* Reset e variáveis de cor */
:root {
  --pwa-primary: #a11692;
  --pwa-primary-light: #c21fa8;
  --pwa-text: #ffffff;
  --pwa-shadow: rgba(161, 22, 146, 0.8);
  --pwa-success: #10b981;
  --pwa-border-radius: 12px;
}

/* ================================================================
   BOTÃO DE INSTALAÇÃO - Design Premium Centralizado no Topo
   ================================================================ */

.install-pwa-button {
  position: fixed !important;
  top: 6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  
  padding: 14px 32px;
  
  background: linear-gradient(335deg, var(--pwa-primary) 0%, var(--pwa-primary-light) 100%);
  color: var(--pwa-text);
  
  border: none;
  border-radius: 50px;  
  
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  
  box-shadow: 0 8px 24px var(--pwa-shadow), 0 0 1px rgba(0, 0, 0, 0.05);
  
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInTop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  
  backdrop-filter: blur(10px);
}

.install-pwa-button:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 12px 32px var(--pwa-shadow), 0 0 1px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, var(--pwa-primary-light) 0%, var(--pwa-primary) 100%);
}

.install-pwa-button:active {
  transform: translateX(-50%) translateY(0);
  box-shadow: 0 4px 12px var(--pwa-shadow);
}

.install-pwa-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.install-pwa-button svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
  animation: pulse 2s ease-in-out infinite;
}

/* Animação de pulso no ícone */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Animação de entrada do topo */
@keyframes slideInTop {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Animação de saída para o topo */
@keyframes slideOutTop {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px);
  }
}

/* ================================================================
   MENSAGEM DE SUCESSO
   ================================================================ */

.install-success-message {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  
  display: flex;
  align-items: center;
  gap: 12px;
  
  padding: 16px 24px;
  
  background: linear-gradient(335deg, var(--pwa-primary) 0%, var(--pwa-primary-light) 100%);
  color: var(--pwa-text);
  
  border-radius: 50px;
  border: solid 1px white;
  
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  
  box-shadow: 0 8px 24px var(--light-magenta), 0 0 1px rgba(0, 0, 0, 0.05);
  
  animation: slideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  max-width: 90%;
  max-width: min(500px, 90vw);
  
  backdrop-filter: blur(10px);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.install-success-message svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  stroke-width: 2;
  stroke: var(--pwa-text);
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Animação de rotação (refresh) */
@keyframes spin {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(0deg);
  }
  50% {
    transform: scale(1.1) rotate(180deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(360deg);
  }
}

.install-success-message.fade-out {
  animation: slideOutTop 0.3s ease-out forwards;
}

/* Animação do checkmark */
@keyframes checkmark {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-45deg);
  }
  50% {
    transform: scale(1.1) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Animação de entrada */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ================================================================
   MENSAGEM iOS (Instruções Web Clip)
   ================================================================ */

.install-ios-instructions {
  position: fixed;
  top: calc(3rem + 70px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  
  display: flex;
  align-items: flex-start;
  gap: 12px;
  
  padding: 16px 24px;
  
  background: #f0f9ff;
  color: #0284c7;
  
  border-radius: var(--pwa-border-radius);
  border: 2px solid #0284c7;
  border-left: 4px solid #0284c7;
  
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  
  box-shadow: 0 10px 40px rgba(2, 132, 199, 0.15), 0 0 1px rgba(0, 0, 0, 0.05);
  
  animation: slideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  max-width: 90%;
  max-width: min(400px, 90vw);
}

.install-ios-instructions svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.install-ios-instructions strong {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  color: #0284c7;
}

.install-ios-instructions br {
  content: '';
}

.install-ios-instructions br::after {
  content: '';
  display: block;
  height: 4px;
}

/* ================================================================
   RESPONSIVIDADE
   ================================================================ */

@media (max-width: 768px) {
  .install-pwa-button {
    padding: 12px 24px;
    font-size: 14px;
  }
  
  .install-pwa-button svg {
    width: 18px;
    height: 18px;
  }
  
  .install-success-message,
  .install-ios-instructions {
    transform: translateX(0);
    max-width: none;
    font-size: 13px;
    padding: 12px 16px;
  }
  
  .install-success-message {
    left: 10px;
    right: 10px;
    padding: 12px 16px;
    font-size: 12px;
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .install-pwa-button {
    width: auto;
    max-width: none;
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 13px;
  }
  
  .install-pwa-button svg {
    width: 16px;
    height: 16px;
  }
  
  .install-pwa-button span {
    flex: 1;
  }
  
  .install-success-message {
    padding: 12px 16px;
    font-size: 12px;
    white-space: normal;
  }
}

/* ================================================================
   DARK MODE SUPPORT (futuro)
   ================================================================ */
/*
  @media (prefers-color-scheme: dark) {
    .install-success-message {
      background: #1a1a2e;
      color: #10b981;
      border-color: #10b981;
    }

    .install-ios-instructions {
      background: #1a2a3a;
      color: #38bdf8;
      border-color: #38bdf8;
    }
}
*/

/* ================================================================
   ACESSIBILIDADE
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .install-pwa-button,
  .install-success-message,
  .install-ios-instructions {
    animation: none !important;
  }
  
  .install-pwa-button svg {
    animation: none !important;
  }
  
  .install-pwa-button,
  .install-pwa-button:hover,
  .install-pwa-button:active {
    transition: none !important;
  }
}

/* Focus visível para acessibilidade */
.install-pwa-button:focus-visible {
  outline: 3px solid var(--pwa-primary);
  outline-offset: 2px;
}

