/* BTS Portal PWA Install Button Styles */
/* Botão flutuante + Modal de instalação */

:root {
  --pwa-primary: #0EA5A8;
  --pwa-dark: #0F766E;
  --pwa-light: #e8f9f8;
  --pwa-accent: #3B82F6;
  --pwa-success: #28a745;
  --pwa-shadow: 0 4px 12px rgba(14, 165, 168, 0.15);
}

/* ========================================
   BOTÃO FLUTUANTE DE INSTALAÇÃO
   ======================================== */

.pwa-install-container {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pwa-install-container.hidden {
  opacity: 0;
  transform: translateY(-50%) translateX(400px) scale(0.8);
  pointer-events: none;
}

.pwa-install-container.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

/* Botão Principal */
.pwa-install-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--pwa-primary) 0%, var(--pwa-dark) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--pwa-shadow);
  transition: all 0.3s ease;
  min-height: 48px;
  min-width: 48px;
  position: relative;
}

.pwa-install-button:hover {
  background: linear-gradient(135deg, var(--pwa-dark) 0%, #157a70 100%);
  box-shadow: 0 6px 16px rgba(32, 178, 170, 0.3);
  transform: translateY(-2px);
}

.pwa-install-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(32, 178, 170, 0.2);
}

.pwa-install-button:focus {
  outline: 2px solid var(--pwa-accent);
  outline-offset: 2px;
}

.pwa-install-icon {
  display: inline-flex;
  font-size: 18px;
  animation: pwa-float 2s ease-in-out infinite;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
}

.pwa-install-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes pwa-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.pwa-install-text {
  display: none;
  white-space: nowrap;
}

/* Tooltip */
.pwa-install-tooltip {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  margin-bottom: 8px;
  z-index: 10;
}

.pwa-install-button:hover .pwa-install-tooltip {
  opacity: 1;
}

/* Botão Fechar */
.pwa-install-close {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
  opacity: 0;
}

.pwa-install-container:hover .pwa-install-close {
  opacity: 1;
}

.pwa-install-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(90deg);
}

/* ========================================
   TOAST DE SUCESSO
   ======================================== */

.pwa-install-success-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  border-left: 4px solid var(--pwa-success);
  padding: 16px 20px;
  border-radius: 4px;
  box-shadow: var(--pwa-shadow);
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
}

.pwa-install-success-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.pwa-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

.pwa-toast-content i {
  color: var(--pwa-success);
  font-size: 18px;
}

/* ========================================
   MODAL DE INSTALAÇÃO
   ======================================== */

.pwa-install-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.pwa-install-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.pwa-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.pwa-modal-content {
  background: white;
  border-radius: 12px;
  padding: 32px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: pwa-modal-enter 0.3s ease;
}

@keyframes pwa-modal-enter {
  from {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.pwa-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  border-radius: 4px;
}

.pwa-modal-close:hover {
  color: #333;
  background: #f0f0f0;
}

.pwa-modal-body {
  text-align: center;
  margin-bottom: 24px;
}

.pwa-modal-icon {
  display: block;
  font-size: 48px;
  color: var(--pwa-primary);
  margin-bottom: 16px;
  animation: pwa-modal-bounce 2s ease-in-out infinite;
}

@keyframes pwa-modal-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.pwa-modal-body h2 {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  margin: 0 0 12px 0;
}

.pwa-modal-body p {
  font-size: 14px;
  color: #666;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.pwa-modal-benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  background: var(--pwa-light);
  padding: 16px;
  border-radius: 8px;
}

.pwa-modal-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #333;
  margin-bottom: 8px;
}

.pwa-modal-benefits li:last-child {
  margin-bottom: 0;
}

.pwa-modal-benefits i {
  color: var(--pwa-success);
  font-size: 16px;
  flex-shrink: 0;
}

.pwa-modal-footer {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pwa-modal-footer button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  min-height: 40px;
}

.pwa-modal-cancel {
  background: #f0f0f0;
  color: #333;
}

.pwa-modal-cancel:hover {
  background: #e0e0e0;
}

.pwa-modal-install {
  background: linear-gradient(135deg, var(--pwa-primary) 0%, var(--pwa-dark) 100%);
  color: white;
}

.pwa-modal-install:hover {
  background: linear-gradient(135deg, var(--pwa-dark) 0%, #157a70 100%);
  box-shadow: 0 4px 12px rgba(32, 178, 170, 0.3);
}

/* ========================================
   RESPONSIVO - MOBILE
   ======================================== */

@media (max-width: 768px) {
  .pwa-install-container {
    bottom: 16px;
    right: 16px;
  }

  .pwa-install-button {
    padding: 10px 12px;
    min-width: 44px;
  }

  .pwa-install-text {
    display: inline;
  }

  .pwa-modal-content {
    padding: 24px 16px;
    max-width: 100%;
  }

  .pwa-modal-icon {
    font-size: 40px;
  }

  .pwa-modal-body h2 {
    font-size: 20px;
  }

  .pwa-install-tooltip {
    display: none;
  }

  .pwa-modal-footer {
    flex-direction: column;
  }

  .pwa-modal-footer button {
    width: 100%;
  }
}

/* ========================================
   DARK MODE
   ======================================== */

@media (prefers-color-scheme: dark) {
  .pwa-install-button {
    box-shadow: 0 4px 12px rgba(32, 178, 170, 0.2);
  }

  .pwa-install-tooltip {
    background: #222;
  }

  .pwa-modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
  }

  .pwa-modal-body h2 {
    color: #fff;
  }

  .pwa-modal-body p {
    color: #b0b0b0;
  }

  .pwa-modal-benefits {
    background: rgba(32, 178, 170, 0.1);
  }

  .pwa-modal-benefits li {
    color: #e0e0e0;
  }

  .pwa-modal-close {
    color: #666;
  }

  .pwa-modal-close:hover {
    color: #e0e0e0;
    background: #333;
  }

  .pwa-modal-cancel {
    background: #333;
    color: #e0e0e0;
  }

  .pwa-modal-cancel:hover {
    background: #444;
  }

  .pwa-install-success-toast {
    background: #2a2a2a;
    color: #e0e0e0;
  }
}

/* ========================================
   ANIMAÇÕES E TRANSIÇÕES
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .pwa-install-container,
  .pwa-install-button,
  .pwa-install-icon,
  .pwa-modal-content,
  .pwa-install-success-toast {
    animation: none !important;
    transition: none !important;
  }
}

/* Pulso de atenção para o botão */
@keyframes pwa-pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(32, 178, 170, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(32, 178, 170, 0.8);
  }
}

.pwa-install-button.pulse {
  animation: pwa-pulse 2s ease-in-out infinite;
}
