/* PWA Install Guide — iPhone / iPad */
.pwa-ios-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: "Noto Sans Thai", "Sarabun", -apple-system, BlinkMacSystemFont, sans-serif;
  animation: pwa-ios-fade-in 0.25s ease;
}

@keyframes pwa-ios-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pwa-ios-dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: min(90vh, 640px);
  overflow-y: auto;
  background: #0d0d0d;
  color: #f5f5f5;
  border-radius: 16px;
  border: 1px solid rgba(255, 215, 0, 0.35);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.pwa-ios-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.pwa-ios-header {
  padding: 28px 24px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pwa-ios-header h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffd700;
  letter-spacing: 0.02em;
}

.pwa-ios-header p {
  margin: 0;
  font-size: 0.875rem;
  color: #9ca3af;
  line-height: 1.5;
}

.pwa-ios-browser {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pwa-ios-browser-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pwa-ios-browser--ok .pwa-ios-browser-dot { background: #22c55e; }
.pwa-ios-browser--warn .pwa-ios-browser-dot { background: #f59e0b; }
.pwa-ios-browser--bad .pwa-ios-browser-dot { background: #ef4444; }

.pwa-ios-body {
  padding: 20px 24px;
}

.pwa-ios-alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.pwa-ios-alert--info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.pwa-ios-alert--warn {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.pwa-ios-alert--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

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

.pwa-ios-steps li {
  position: relative;
  margin-bottom: 12px;
  padding: 14px 14px 14px 48px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.875rem;
  line-height: 1.65;
  color: #e5e7eb;
  counter-increment: pwa-step;
}

.pwa-ios-steps li::before {
  content: counter(pwa-step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  font-size: 0.75rem;
  font-weight: 700;
}

.pwa-ios-steps li strong {
  color: #fff;
  font-weight: 600;
}

.pwa-ios-kbd {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8125rem;
  color: #fff;
  vertical-align: baseline;
}

.pwa-ios-kbd--safari {
  background: #007aff;
  border-color: #0066d6;
  color: #fff;
}

/* ไอคอนแชร์ iOS — สี่เหลี่ยม + ลูกศรชี้ขึ้น (Chrome มุมขวาบน) */
.pwa-ios-share-glyph {
  display: inline-block;
  width: 13px;
  height: 15px;
  margin: 0 2px;
  border: 2px solid #4285f4;
  border-radius: 3px;
  vertical-align: -3px;
  position: relative;
  background: transparent;
}

.pwa-ios-share-glyph::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid #4285f4;
}

.pwa-ios-footnote {
  margin: 16px 0 0;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.55;
  text-align: center;
}

.pwa-ios-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 24px 24px;
}

.pwa-ios-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}

.pwa-ios-btn:active { opacity: 0.85; }

.pwa-ios-btn--primary {
  background: #ffd700;
  color: #000;
}

.pwa-ios-btn--secondary {
  background: transparent;
  color: #9ca3af;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Bottom banner */
.pwa-ios-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: #0d0d0d;
  border-top: 1px solid rgba(255, 215, 0, 0.4);
  font-family: "Noto Sans Thai", "Sarabun", -apple-system, sans-serif;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

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

.pwa-ios-bar-text strong {
  display: block;
  font-size: 0.875rem;
  color: #fff;
  font-weight: 600;
}

.pwa-ios-bar-text span {
  font-size: 0.75rem;
  color: #9ca3af;
}

.pwa-ios-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-ios-bar-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #ffd700;
  color: #000;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.pwa-ios-bar-dismiss {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #888;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

/* PWA — แถบให้ผู้ใช้กดอัปเดตเมื่อมี SW ใหม่ */
.pwa-update-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(90deg, #1a1a00, #111);
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  border-bottom: 2px solid #ffd700;
  font-family: "Noto Sans Thai", "Sarabun", -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.pwa-update-text {
  flex: 1 1 200px;
  text-align: center;
}

.pwa-update-btn {
  background: #ffd700;
  color: #000;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
}

.pwa-update-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.pwa-update-dismiss {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
