/**
 * PWA Install Modal Styles
 * Responsive, accessible modal for PWA installation prompts
 */

/* ===========================
   Overlay
   =========================== */
.pwa-install-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 300ms ease;
}

.pwa-install-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ===========================
   Modal Container
   =========================== */
.pwa-install-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  max-width: 480px;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 4rem);
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.pwa-install-modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* ===========================
   Modal Content
   =========================== */
.pwa-modal-content {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 4rem);
}

/* Header */
.pwa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.pwa-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.pwa-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  border-radius: 6px;
  transition: all 150ms ease;
}

.pwa-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.pwa-modal-close:focus {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

/* Body */
.pwa-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.pwa-icon {
  display: block;
  margin: 0 auto 1rem;
  color: #14b8a6;
  stroke-width: 2;
}

.pwa-description {
  font-size: 1rem;
  line-height: 1.6;
  color: #374151;
  text-align: center;
  margin: 0 0 1.5rem;
}

.pwa-note {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #6b7280;
  text-align: center;
  margin: 0;
}

/* Benefits List */
.pwa-benefits {
  background: #f9fafb;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}

.pwa-benefits ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pwa-benefits li {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #374151;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.pwa-benefits li:last-child {
  border-bottom: none;
}

/* Instructions */
.pwa-instructions {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.pwa-instructions-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0c4a6e;
  margin: 0 0 0.75rem;
}

.pwa-instructions-list {
  list-style: none;
  counter-reset: step-counter;
  padding: 0;
  margin: 0;
}

.pwa-instructions-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #1e40af;
}

.pwa-instructions-list li:last-child {
  margin-bottom: 0;
}

.pwa-instructions-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: #3b82f6;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
}

.pwa-instructions-list strong {
  font-weight: 600;
  color: #1e3a8a;
}

/* Footer */
.pwa-modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* Buttons */
.pwa-btn {
  flex: 1;
  height: 44px;
  padding: 0 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-btn:focus {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.pwa-btn-primary {
  background: linear-gradient(to right, #14b8a6, #0d9b8c);
  color: white;
  box-shadow: 0 2px 4px rgba(20, 184, 166, 0.2);
}

.pwa-btn-primary:hover {
  background: linear-gradient(to right, #0d9b8c, #14b8a6);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(20, 184, 166, 0.3);
}

.pwa-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(20, 184, 166, 0.2);
}

.pwa-btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.pwa-btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.pwa-btn-secondary:active {
  background: #f3f4f6;
}

/* ===========================
   Install Banner (Alternative)
   =========================== */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 300ms ease;
  z-index: 9997;
}

.pwa-install-banner.show {
  transform: translateY(0);
}

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

.pwa-banner-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: #14b8a6;
}

.pwa-banner-text {
  flex: 1;
}

.pwa-banner-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.25rem;
}

.pwa-banner-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.pwa-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pwa-banner-btn {
  height: 36px;
  padding: 0 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.pwa-banner-btn-install {
  background: #14b8a6;
  color: white;
}

.pwa-banner-btn-install:hover {
  background: #0d9b8c;
}

.pwa-banner-btn-dismiss {
  background: transparent;
  color: #6b7280;
}

.pwa-banner-btn-dismiss:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ===========================
   Dark Mode
   =========================== */
@media (prefers-color-scheme: dark) {
  .pwa-install-modal {
    background: #1f2937;
  }

  .pwa-modal-header {
    border-bottom-color: #374151;
  }

  .pwa-modal-title {
    color: white;
  }

  .pwa-modal-close {
    color: #9ca3af;
  }

  .pwa-modal-close:hover {
    background: #374151;
    color: white;
  }

  .pwa-description {
    color: #d1d5db;
  }

  .pwa-note {
    color: #9ca3af;
  }

  .pwa-benefits {
    background: #111827;
  }

  .pwa-benefits li {
    color: #d1d5db;
    border-bottom-color: #374151;
  }

  .pwa-instructions {
    background: #1e3a5f;
    border-color: #2563eb;
  }

  .pwa-instructions-title {
    color: #93c5fd;
  }

  .pwa-instructions-list li {
    color: #bfdbfe;
  }

  .pwa-instructions-list strong {
    color: #dbeafe;
  }

  .pwa-modal-footer {
    border-top-color: #374151;
    background: #111827;
  }

  .pwa-btn-secondary {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
  }

  .pwa-btn-secondary:hover {
    background: #4b5563;
    border-color: #6b7280;
  }

  .pwa-install-banner {
    background: #1f2937;
    border-top-color: #374151;
  }

  .pwa-banner-title {
    color: white;
  }

  .pwa-banner-description {
    color: #9ca3af;
  }

  .pwa-banner-btn-dismiss {
    color: #9ca3af;
  }

  .pwa-banner-btn-dismiss:hover {
    background: #374151;
    color: white;
  }
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 640px) {
  .pwa-install-modal {
    max-width: none;
    width: 100%;
    border-radius: 12px 12px 0 0;
    top: auto;
    bottom: 0;
    transform: translate(-50%, 100%);
  }

  .pwa-install-modal.show {
    transform: translate(-50%, 0);
  }

  .pwa-modal-header {
    padding: 1rem;
  }

  .pwa-modal-title {
    font-size: 1.125rem;
  }

  .pwa-modal-body {
    padding: 1rem;
  }

  .pwa-modal-footer {
    padding: 1rem;
    flex-direction: column-reverse;
  }

  .pwa-btn {
    width: 100%;
  }

  .pwa-banner-content {
    flex-wrap: wrap;
  }

  .pwa-banner-actions {
    width: 100%;
    justify-content: stretch;
  }

  .pwa-banner-btn {
    flex: 1;
  }
}

/* ===========================
   Reduced Motion
   =========================== */
@media (prefers-reduced-motion: reduce) {
  .pwa-install-overlay,
  .pwa-install-modal,
  .pwa-install-banner,
  .pwa-btn {
    transition: none;
  }
}
