/**
 * TAXFREESHOPS.JP PWA Styles
 */

/* ============================================
   Offline Notification Banner
   ============================================ */
.pwa-offline-banner {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  background: #f44336;
  color: white;
  padding: 10px 16px;
  text-align: center;
  z-index: 1050;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pwa-offline-banner .icon-signal {
  margin-right: 8px;
}

/* Update Notification Banner */
.pwa-update-banner {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  background: #2196F3;
  color: white;
  padding: 10px 16px;
  text-align: center;
  z-index: 1051;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.pwa-update-banner .btn {
  margin-left: 10px;
}

/* ============================================
   Offline Mode Display Control
   ============================================ */

/* Elements hidden when offline */
body.offline .online-only {
  display: none !important;
}

/* Elements shown only when offline */
.offline-only {
  display: none;
}

body.offline .offline-only {
  display: block !important;
}

/* ============================================
   PWA Mode Display Control
   ============================================ */

/* Elements hidden when in PWA standalone mode */
body.pwa .pwa-hide {
  display: none !important;
}

/* Elements shown only in PWA standalone mode */
.pwa-only {
  display: none;
}

body.pwa .pwa-only {
  display: block !important;
}

/* ============================================
   Bookmark Button
   ============================================ */
.pwa-bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-bookmark-btn [class*="icon-"] {
  font-size: 16px;
}

.pwa-bookmark-btn .bookmark-text {
  font-size: 14px;
}

.pwa-bookmark-btn.bookmarked {
  background-color: #e60012;
  border-color: #e60012;
  color: white;
}

.pwa-bookmark-btn.bookmarked:hover {
  background-color: #c5000f;
  border-color: #c5000f;
}

/* Bookmark button - floating style */
.pwa-bookmark-btn-float {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e60012;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0;
}

.pwa-bookmark-btn-float [class*="icon-"] {
  font-size: 24px;
}

.pwa-bookmark-btn-float .bookmark-text {
  display: none;
}

.pwa-bookmark-btn-float.bookmarked {
  background: #4CAF50;
}

/* ============================================
   PWA Modal (Push Notification Dialog)
   ============================================ */
.pwa-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.pwa-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.15);
}

.pwa-modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.pwa-modal-body {
  padding: 28px 24px 12px;
  text-align: center;
}

.pwa-modal-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: #222;
  line-height: 1.5;
}

.pwa-modal-desc {
  margin: 0;
  font-size: 14px;
  color: #888;
  line-height: 1.6;
}

.pwa-modal-footer {
  padding: 16px 24px 28px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pwa-modal-footer .btn {
  min-width: 120px;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
}

.pwa-modal-footer .btn-default {
  background: #f0f0f0;
  border: 1px solid #ddd;
  color: #666;
}

.pwa-modal-footer .btn-dark {
  background: #222;
  border: 1px solid #222;
  color: #fff;
}

/* ============================================
   Offline Page Styles
   ============================================ */
.pwa-offline-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: #f5f5f5;
}

.pwa-offline-page .offline-icon {
  font-size: 80px;
  color: #ccc;
  margin-bottom: 24px;
}

.pwa-offline-page h1 {
  font-size: 24px;
  color: #333;
  margin-bottom: 16px;
}

.pwa-offline-page p {
  font-size: 16px;
  color: #666;
  margin-bottom: 32px;
  max-width: 400px;
}

.pwa-offline-page .btn {
  min-width: 200px;
}

/* ============================================
   Install Prompt Banner (optional)
   ============================================ */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 16px 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1049;
}

.pwa-install-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.pwa-install-banner-content {
  flex: 1;
}

.pwa-install-banner-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.pwa-install-banner-desc {
  font-size: 13px;
  color: #666;
}

.pwa-install-banner-close {
  padding: 8px;
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 480px) {
  .pwa-modal-body {
    padding: 24px 20px 8px;
  }

  .pwa-modal-title {
    font-size: 16px;
  }

  .pwa-modal-desc {
    font-size: 13px;
  }

  .pwa-modal-footer {
    padding: 12px 20px 24px;
  }

  .pwa-modal-footer .btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 14px;
  }

  .pwa-offline-banner,
  .pwa-update-banner {
    top: 0;
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* ============================================
   PWA Mode - Adjust for standalone display
   ============================================ */
body.pwa {
  /* Safe area for notched devices
     NOTE: padding-top is NOT set here.
     body padding-top (110px etc.) is defined in custom.css media queries
     and must not be overridden. */
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Adjust navbar for PWA mode */
body.pwa .navbar-fixed-top {
  top: env(safe-area-inset-top);
}

/* Adjust offline banner position in PWA mode */
body.pwa .pwa-offline-banner {
  top: calc(50px + env(safe-area-inset-top));
}

body.pwa .pwa-update-banner {
  top: calc(50px + env(safe-area-inset-top));
}
