/* ============================================================================
   PADIFIX — PWA POLISH & NATIVE APP EXPERIENCE STYLES (pwa.css)
   ============================================================================ */

/* 0. BRANDED RESILIENT PWA APP SPLASH SCREEN */
#pwa-app-splash {
  position: fixed;
  inset: 0;
  background: #0A0E17;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
  pointer-events: none;
}

#pwa-app-splash.splash-fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-logo-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-logo-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #D4AF37;
  border-right-color: #006B3F;
  animation: splash-spin 1.2s linear infinite;
}

.splash-logo-mark {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #006B3F 0%, #059669 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 107, 63, 0.4);
}

.splash-brand-title {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  margin: 0;
}

.splash-brand-accent {
  color: #34D399;
}

.splash-brand-subtitle {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 0.82rem;
  color: #9CA3AF;
  margin: 0;
}

@keyframes splash-spin {
  to { transform: rotate(360deg); }
}

/* 1. STANDALONE INSTALLED MODE ADAPTIVITY */
body.pwa-mode {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body.pwa-mode input,
body.pwa-mode textarea,
body.pwa-mode select {
  -webkit-user-select: text;
  user-select: text;
}

/* 2. FLOATING INSTALL BADGE (Header/Navigation) */
.pwa-install-nav-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(0, 107, 63, 0.18);
  border: 1px solid rgba(0, 107, 63, 0.5);
  color: #34D399;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.pwa-install-nav-btn:hover {
  background: rgba(0, 107, 63, 0.35);
  border-color: #34D399;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 107, 63, 0.25);
}

.pwa-install-nav-btn svg {
  width: 14px;
  height: 14px;
}

/* 3. ANDROID & GENERAL PWA INSTALL BOTTOM SHEET */
.pwa-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pwa-sheet-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.pwa-install-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(180deg, #161F30 0%, #0D131F 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 107, 63, 0.3);
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  transform: translateY(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.pwa-install-sheet.active {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.pwa-sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  margin: -8px auto 16px auto;
}

.pwa-sheet-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.pwa-sheet-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #006B3F 0%, #059669 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 107, 63, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.pwa-sheet-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pwa-sheet-title-group h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}

.pwa-sheet-title-group p {
  font-size: 0.85rem;
  color: #9CA3AF;
  margin: 0;
}

.pwa-sheet-perks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.pwa-perk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #E5E7EB;
}

.pwa-perk-item svg {
  color: #34D399;
  flex-shrink: 0;
}

.pwa-sheet-actions {
  display: flex;
  gap: 12px;
}

.pwa-btn-dismiss {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  color: #9CA3AF;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-btn-dismiss:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

.pwa-btn-install {
  flex: 2;
  background: linear-gradient(135deg, #006B3F 0%, #059669 100%);
  color: #FFFFFF;
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 107, 63, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-btn-install:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 107, 63, 0.5);
  filter: brightness(1.05);
}

/* 4. iOS ADD TO HOME SCREEN GUIDED DRAWER */
.pwa-ios-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(180deg, #161F30 0%, #0D131F 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.6);
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  transform: translateY(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.pwa-ios-sheet.active {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 18px 0 22px 0;
}

.pwa-ios-step-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px 14px;
}

.pwa-step-num {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(0, 107, 63, 0.3);
  border: 1px solid #34D399;
  color: #34D399;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-step-text {
  font-size: 0.88rem;
  color: #D1D5DB;
  line-height: 1.4;
}

.pwa-step-text strong {
  color: #FFFFFF;
}

.pwa-ios-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 6px;
  margin: 0 3px;
  color: #60A5FA;
}

.pwa-ios-done-btn {
  width: 100%;
  background: linear-gradient(135deg, #006B3F 0%, #059669 100%);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
}

/* 5. SERVICE WORKER FLOATING UPDATE TOAST */
.sw-update-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-250%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(212, 175, 55, 0.2);
  z-index: 10000;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
  max-width: 90vw;
}

.sw-update-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sw-update-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid #D4AF37;
  color: #D4AF37;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: pulse-update 2s infinite;
}

.sw-update-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #F3F4F6;
  white-space: nowrap;
}

.sw-update-btn {
  background: #D4AF37;
  color: #0A0E17;
  border: none;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sw-update-btn:hover {
  background: #F3E5AB;
  transform: scale(1.04);
}

@keyframes pulse-update {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.85; }
}

/* ============================================================================
   3. DATA SAVER & LOW-BANDWIDTH STYLES (PHASE 10.15)
   ============================================================================ */
body.data-saver-mode * {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

body.data-saver-mode .hero-video,
body.data-saver-mode video {
  display: none !important;
}

body.data-saver-mode .data-saver-badge {
  display: inline-flex !important;
}

/* ============================================================================
   4. OFFLINE STATUS BANNER & SAVED HANDS DRAWER (PHASE 10.15)
   ============================================================================ */
#offline-status-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #B45309;
  color: #FFF;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  padding: 6px 12px;
  z-index: 100000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.is-offline #offline-status-banner {
  display: block;
}

.saved-artisan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #F1F5F9;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bookmark-icon-btn {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.bookmark-icon-btn:hover {
  transform: scale(1.15);
}

