/* ==========================================================================
   MSB Tahfeez - iOS Add to Home Screen instructions
   Scoped to .pwa-* so it cannot affect the Flutter application.
   ========================================================================== */

:root {
  --pwa-primary: #0B4D3C;
  --pwa-accent-gold: #D4AF37;
  --pwa-text-main: #1C1B18;
  --pwa-text-muted: #5E6966;
  --pwa-border: #E8E4DA;
  --pwa-shadow: 0 24px 60px -12px rgba(11, 77, 60, 0.28), 0 0 0 1px rgba(11, 77, 60, 0.08);
}

.pwa-overlay,
.pwa-overlay * {
  box-sizing: border-box;
}

.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(11, 77, 60, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-overlay.pwa-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.pwa-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 24px 24px;
  padding: 18px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--pwa-border);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF8F3 100%);
  box-shadow: var(--pwa-shadow);
  color: var(--pwa-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transform: translateY(28px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-overlay.pwa-visible .pwa-card {
  transform: translateY(0);
}

.pwa-drag-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #D8D4C8;
}

.pwa-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #E5E0D6;
  border-radius: 50%;
  background: #F2F0EA;
  color: #6B7370;
  font: 22px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pwa-close-btn:active {
  background: #E8E4DC;
}

.pwa-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 34px;
  margin-bottom: 14px;
}

.pwa-app-icon {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  border: 2px solid var(--pwa-accent-gold);
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(11, 77, 60, 0.16);
}

.pwa-header-text {
  min-width: 0;
}

.pwa-title {
  margin: 0;
  color: var(--pwa-primary);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.pwa-subtitle {
  margin: 3px 0 0;
  color: var(--pwa-text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.pwa-desc {
  margin: 0 0 14px;
  color: #3E4B47;
  font-size: 14px;
  line-height: 1.5;
}

.pwa-ios-instructions {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-bottom: 12px;
  padding: 15px 16px;
  border: 1px dashed rgba(11, 77, 60, 0.25);
  border-radius: 16px;
  background: rgba(11, 77, 60, 0.05);
}

.pwa-instruction-step {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  color: var(--pwa-text-main);
  font-size: 14px;
  line-height: 1.45;
}

.pwa-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--pwa-primary);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.pwa-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin: 0 2px;
  color: var(--pwa-primary);
  vertical-align: -4px;
}

.pwa-note {
  margin: 0 0 16px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #FFF8E6;
  color: #6B5208;
  font-size: 12.5px;
  line-height: 1.45;
}

.pwa-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pwa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 13px 18px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pwa-btn:active {
  transform: scale(0.985);
}

.pwa-btn-primary {
  background: linear-gradient(135deg, #0B4D3C 0%, #166550 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(11, 77, 60, 0.24);
}

.pwa-btn-secondary {
  min-height: 40px;
  padding: 9px;
  background: transparent;
  color: var(--pwa-text-muted);
  font-size: 14px;
  font-weight: 500;
}

.pwa-btn-secondary:active {
  background: rgba(0, 0, 0, 0.04);
}

body.pwa-modal-open {
  overflow: hidden;
}

@media (min-width: 640px) {
  .pwa-overlay {
    align-items: center;
    padding: 24px;
  }

  .pwa-card {
    max-height: calc(100vh - 48px);
    padding: 26px 28px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 24px;
    transform: translateY(20px) scale(0.97);
  }

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

  .pwa-drag-handle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-overlay,
  .pwa-card,
  .pwa-btn {
    transition: none;
    transform: none;
  }
}
