/* ==========================================================================
   APP SHELL (PWA) - Thanh điều hướng app, gợi ý cài app, nút bật thông báo
   Chỉ bổ sung, không thay đổi giao diện website hiện có.
   ========================================================================== */

/* ---------- Thanh điều hướng dưới đáy (chỉ khi mở bằng app đã cài) ---------- */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1500;
  display: flex;
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom);
}

.app-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 4px 6px;
  min-height: 56px;
  text-decoration: none;
  color: #6c757d;
  font-size: 0.72rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.app-tab-ico {
  font-size: 1.3rem;
  line-height: 1;
  filter: grayscale(0.6);
  opacity: 0.8;
}

.app-tab.active {
  color: #2d6a4f;
}

.app-tab.active .app-tab-ico {
  filter: none;
  opacity: 1;
  transform: scale(1.08);
}

body.has-app-tabbar {
  padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important;
}

/* Đẩy nút Zalo/Hotline nổi lên trên thanh điều hướng */
body.has-app-tabbar .floating-contact {
  bottom: calc(76px + env(safe-area-inset-bottom)) !important;
}

/* Trong app: chừa vùng tai thỏ / status bar */
html.pwa-standalone body {
  padding-top: env(safe-area-inset-top);
}

/* ---------- Gợi ý cài app (web di động) ---------- */
.app-install {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 1600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  padding: 10px 10px 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: appSlideUp 0.35s ease-out;
}

.app-install img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
}

.app-install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.app-install-text b {
  font-size: 0.92rem;
  color: #1b4332;
}

.app-install-text span {
  font-size: 0.78rem;
  color: #6c757d;
}

.app-install-close {
  background: none;
  border: 0;
  color: #adb5bd;
  font-size: 1rem;
  padding: 6px;
  cursor: pointer;
}

.app-btn {
  background: #2d6a4f;
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.app-btn:active {
  background: #1b4332;
}

/* ---------- Nút bật thông báo ---------- */
.app-push-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1550;
  display: flex;
  align-items: center;
  max-width: calc(100% - 24px);
  background: #1b4332;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(27, 67, 50, 0.35);
  animation: appSlideUp 0.35s ease-out;
}

body.has-app-tabbar .app-push-pill {
  bottom: calc(74px + env(safe-area-inset-bottom));
}

.app-push-go {
  background: none;
  border: 0;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 11px 6px 11px 16px;
  cursor: pointer;
  text-align: left;
}

.app-push-x {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  padding: 11px 14px 11px 8px;
  cursor: pointer;
}

/* ---------- Hộp thoại hướng dẫn & toast ---------- */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.app-modal-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: appSlideUp 0.3s ease-out;
}

.app-modal-card h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: #1b4332;
}

.app-modal-card ol {
  margin: 0 0 10px 20px;
  padding: 0;
  line-height: 1.9;
  font-size: 0.93rem;
}

.app-modal-note {
  font-size: 0.82rem;
  color: #6c757d;
  margin: 0 0 14px;
}

.app-modal-card .app-btn {
  width: 100%;
  padding: 12px;
}

.app-ios-share {
  display: inline-block;
  border: 1.5px solid #0a84ff;
  color: #0a84ff;
  border-radius: 5px;
  padding: 0 5px;
  font-size: 0.8rem;
}

.app-toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top));
  transform: translate(-50%, -20px);
  z-index: 3100;
  background: #2b2d42;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  max-width: calc(100% - 32px);
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes appSlideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.app-push-pill {
  animation-name: appPillUp;
}

@keyframes appPillUp {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
