/* FreshWeb — PWA update bar + Preferences alerts UI (mobile-first). */

.pwa-update-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: #1a1a1a;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.pwa-update-bar.is-visible {
  display: flex;
}

.pwa-update-bar__text {
  margin: 0;
  font-weight: 500;
}

.pwa-update-bar__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pwa-update-bar__btn {
  appearance: none;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #ffc107;
  color: #1a1a1a;
}

.pwa-update-bar__btn:hover,
.pwa-update-bar__btn:focus-visible {
  filter: brightness(1.05);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.pwa-update-bar__btn--ghost {
  background: transparent;
  color: #f0f0f0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 500;
}

.pwa-update-bar__hint {
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: #ffc107;
}

.pwa-update-bar--force .pwa-update-bar__text {
  font-weight: 600;
}

body.pwa-update-bar-open {
  scroll-padding-top: 56px;
}

/* -------------------------------------------------------------------------- */
/* Preferences — App alerts & updates (PWA / mobile layout + readable contrast) */
/* Overrides global hero .btn-primary { background:white; color:#f9d71c }      */
/* -------------------------------------------------------------------------- */

#preferencesPanel .preference-item--stack.pwa-push-pref {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.85rem;
}

#preferencesPanel .pwa-push-pref .preference-header {
  flex: none;
  width: 100%;
}

#preferencesPanel .pwa-push-status {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #666;
  min-height: 1.25rem;
}

#preferencesPanel .pwa-push-status.is-error {
  color: #a94442;
}

#preferencesPanel .pwa-push-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  margin: 0;
}

#preferencesPanel .pwa-push-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  box-shadow: none;
  transform: none;
}

#preferencesPanel .pwa-push-actions .btn:hover:not(:disabled),
#preferencesPanel .pwa-push-actions .btn:active:not(:disabled) {
  transform: none;
}

/* Primary: brand yellow with dark text (readable on mobile) */
#preferencesPanel .pwa-push-actions .btn-primary {
  background: #f9d71c;
  color: #1a1a1a;
  border: 2px solid #e6c400;
}

#preferencesPanel .pwa-push-actions .btn-primary:hover:not(:disabled) {
  background: #f0ce12;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#preferencesPanel .pwa-push-actions .btn-primary:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  opacity: 1;
}

/* Secondary: outlined, dark text on white */
#preferencesPanel .pwa-push-actions .btn-secondary {
  background: #ffffff;
  color: #333333;
  border: 2px solid #dee2e6;
}

#preferencesPanel .pwa-push-actions .btn-secondary:hover:not(:disabled) {
  background: #f8f9fa;
  color: #222222;
  border-color: #f9d71c;
}

#preferencesPanel .pwa-push-actions .btn-secondary:disabled {
  background: #ffffff;
  color: #9ca3af;
  border-color: #e5e7eb;
  opacity: 1;
}

/* Stack Theme / Language rows on phone widths (same PWA rhythm) */
@media (max-width: 639px) {
  #preferencesPanel .preference-item:not(.preference-item--stack) {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  #preferencesPanel .preference-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
}

@media (min-width: 640px) {
  #preferencesPanel .pwa-push-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  #preferencesPanel .pwa-push-actions .btn {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 140px;
  }
}
