/* ============================================
   PWA INSTALL BANNER & MODAL STYLES
   Matches the app's design system
   ============================================ */

/* Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: -200px;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 1rem 1rem 1.5rem 1rem;
  z-index: 9999;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 3px solid var(--primary-color, #6366f1);
}

/* Add padding for devices with notch/home indicator */
@supports (padding: env(safe-area-inset-bottom)) {
  .pwa-install-banner {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

.pwa-install-banner.pwa-banner-visible {
  bottom: 0;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.pwa-banner-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.25rem;
}

.pwa-banner-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.4;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.pwa-btn-install,
.pwa-btn-info,
.pwa-btn-close {
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-btn-install {
  background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pwa-btn-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.pwa-btn-install:active {
  transform: translateY(0);
}

.pwa-btn-info {
  background: var(--bg-secondary, #f8fafc);
  color: var(--primary-color, #6366f1);
  padding: 0.625rem;
  border-radius: 10px;
  font-size: 1.125rem;
  width: 40px;
  height: 40px;
}

.pwa-btn-info:hover {
  background: var(--bg-tertiary, #f1f5f9);
}

.pwa-btn-close {
  background: transparent;
  color: var(--text-tertiary, #94a3b8);
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 1.125rem;
}

.pwa-btn-close:hover {
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-secondary, #64748b);
}

/* Modal Overlay */
.pwa-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: all 0.3s ease;
  opacity: 0;
}

.pwa-modal-overlay.pwa-modal-visible {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 1;
}

.pwa-modal-overlay.pwa-modal-closing {
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  opacity: 0;
}

/* Modal */
.pwa-modal {
  background: white;
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.pwa-modal-overlay.pwa-modal-visible .pwa-modal {
  transform: scale(1) translateY(0);
}

.pwa-modal-overlay.pwa-modal-closing .pwa-modal {
  transform: scale(0.9) translateY(20px);
}

.pwa-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pwa-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin: 0;
}

.pwa-modal-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary, #94a3b8);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.pwa-modal-close:hover {
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-secondary, #64748b);
}

.pwa-modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.pwa-install-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.pwa-install-step:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.pwa-step-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9375rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pwa-step-content {
  flex: 1;
}

.pwa-step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.375rem;
}

.pwa-step-desc {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.5;
}

.pwa-modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

.pwa-btn-primary {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-color, #6366f1), var(--secondary-color, #8b5cf6));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pwa-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.pwa-btn-primary:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .pwa-banner-content {
    gap: 0.75rem;
  }
  
  .pwa-banner-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 1.25rem;
  }
  
  .pwa-banner-title {
    font-size: 0.9375rem;
  }
  
  .pwa-banner-subtitle {
    font-size: 0.8125rem;
  }
  
  .pwa-btn-install {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .pwa-btn-info {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .pwa-modal {
    border-radius: 16px;
  }
  
  .pwa-modal-header,
  .pwa-modal-body,
  .pwa-modal-footer {
    padding: 1.25rem;
  }
}

/* Animation keyframes */
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Ensure banner is above bottom navigation if present */
.pwa-install-banner {
  bottom: -200px; /* Hidden by default */
}

@media (min-width: 768px) {
  .pwa-install-banner {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    border-radius: 16px 16px 0 0;
  }
}
